LDAP search in subdomains

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dirk Bartenschlager (dbart_at_tarsom.com)
Date: 02/24/04


Date: Tue, 24 Feb 2004 16:14:29 +0100

Hi,

I found a script to search for a userid in the AD. I modified it:

-----------------------------------------------------------------------
Set Connection = CreateObject("ADODB.Connection")
Connection.Provider = "ADsDSOObject"
Connection.Open "Active Directory Provider"

Set Command = CreateObject("ADODB.Command")
Command.ActiveConnection = Connection
strName = "UserName"
ADsPath = "dc=eu,dc=intra-global,dc=net" 'here I want to search eu, au,
am, ee domains
sFilter = "(&(objectCategory=person)(objectClass=user)(name=" & strName &
"))"

sAttribsToReturn = "name,distinguishedName"
' Tiefe der Suchabfrage
sDepth = "subTree"

query = "<LDAP://" & ADsPath & ">;" & sFilter & ";" & sAttribsToReturn & ";"
& sDepth
MsgBox "Abfrage: " & query
Command.CommandText = query

Set rs = Command.Execute
MsgBox rs.RecordCount & " Benutzerkonten gefunden, die """ & strName & """
entsprechen."
MsgBox rs.GetString
----------------------------------------------------------------------------

----
Our rootdomain is: dc=intra-global,dc=net
We have several subdomains: dc=eu or dc=am or dc=ee or dc=au
My userid is in the domain eu and if I start the seach for eu it is working.
If I start the search for another domain is not working. Then no user is
found. I started the script on domain controller with admin rights for each
subdomain without success.
Any ideas?
Thanks in advance
Dirk


Relevant Pages

  • Re: notice and warning
    ... You expect some piece of data from a post in your script, eg: userid. ... never make mistakes, but I doubt that. ... post/get/cookie 'rule' and he'll kill your how dataset of users ...
    (comp.lang.php)
  • Re: notice and warning
    ... You expect some piece of data from a post in your script, eg: userid. ... prefer $_REQUEST over $_POST. ... in this instance, it scales more 'easily'. ...
    (comp.lang.php)
  • Re: notice and warning
    ... You expect some piece of data from a post in your script, ... So you use $_REQUEST["userid"] which works perfectly fine as long as you get the userid in via POST. ... Now you find yourself in the situation that when you call this script for any reason without the POST info, you will delete yourself if you prefer $_REQUEST over $_POST. ... They only have to do good clean programming, which is of course the first step to secure applications. ...
    (comp.lang.php)
  • Re: simple login script issue
    ... This script is called auth.php as in included in all of the pages I ... Example SELECT * FROM messages WHERE userid = $userid ORDER by ... I only allow a VERY restrictive set of characters for the username ...
    (alt.php)
  • Re: Access database
    ... double-click on .vbs file) - you have no Server object, ... Set Connection = CreateObject ... if you run script as part of ASP page - you have no WScript object. ... > Dim Connection, sConnString ...
    (microsoft.public.scripting.vbscript)