I am attempting to find all the netgroups that a specific userid is a member of.
On a unix box command line I execute the following:
$ ldaplist netgroup nisNetgroupTriple=(,u3x750
3,)
And I get the following output as I should:
dn: cn=prt,ou=netgroup,dc=gds,
o=lilly.co
m
dn: cn=verdugo,ou=netgroup,dc=
gds,o=lill
y.com
In php, I'm using the following code:
$netgroup_lookup = array("cn");
$netgroup_lookup_filter = "nisNetgroupTriple=".$user
_to_search
;
$netgroup_lookup_result = ldap_search($ld, $ldn, $netgroup_lookup_filter, $netgroup_lookup);
$netgroup_lookup_entries = ldap_get_entries($ld, $netgroup_lookup_result);
to search an existing connection to the ldap server that was able to query for a users passwd database information, but won't return any results for a netgroup lookup.
Here's the output from the above code:
Warning: ldap_search() [function.ldap-search]: Search: Bad search filter in /var/www/html/unixcoe/ldap
/password/
verify.php
on line 55
Warning: ldap_get_entries(): supplied argument is not a valid ldap result resource in /var/www/html/unixcoe/ldap
/password/
verify.php
on line 56
and the output from var_dump(ldap_error($ld));
var_dump(ldap_errno($ld));
string(17) "Bad search filter" int(-7)
the formatted search filter is : nisNetgroupTriple=(,u2x989
8,) ... so I know it's formatting it correctly. I'm guessing that for some reason it's stuck looking at the password database and not the netgroup database, but I've not given it the passwd or netgroup parameters (ou=peaple or ou=netgroup).
Help! I'm new to php so I hope this is something easy I'm missing.
Start Free Trial