From: Sheahan, J. (PCLN-NW) <Joh...@pr...> - 2003-03-17 14:25:48
|
I am using basic code (straight out of the O'Reilly book) to do a bind and search on my LDAP directory. I get no error messages and it always returns successfully but always shows 0 entries found. I am able to successfully search the LDAP structure from a browser and also able to successfully search it using the ldapsearch commands as follows: ##### This works fine /usr/local/bin/ldapsearch -x -b 'dc=Priceline,dc=com' '(uid=jsheahan)' ##### So does this, from a browser ldap://172.21.81.101:389/o=People,dc=priceline,dc=com?cn,homephone,title,emp loyeetype,mail,telephonenumber?sub? ##### Here is my basic code use Net::LDAP; use Net::LDAP::LDIF; $server = "172.21.81.101"; $port = "389"; $basedn = "o=People,dc=priceline,dc=com"; $scope = "sub"; $passwd = "secret"; $binddn = "cn=Manager,dc=priceline,dc=com"; $c = new Net::LDAP($server, port=>$port) or die "Unable to connect to $server: $@\n"; #$c->bind() or die "Unable to bind: $@\n"; $c->bind($binddn, password => $passwd) or die "Unable to bind: $@\n"; $searchobj = $c->search(base => $basedn, scope => $scope, filter => "uid=jsheahan"); die "Bad Search, errorcode #".$searchobj->code() if $searchobj->code(); #process the return values from search() if ($searchobj){ $ldif = new Net::LDAP::LDIF("-"); $ldif->write($searchobj->entries()); $ldif->done(); } |