|
Posted by Steve JORDI on 01/12/07 09:55
Geoffrey,
Thanks for your input.
I have tried to immediately display the entry values right after the
ldap_search followed by ldap_get_entries.
It returns error on almost all of the attributes, stating that "mail"
or "groupMembership" are undefined. Only "surname" seems to work.
I tried to use LDAP Broswer to check whether I can see all of the
attributes, and it's ok, I see everything then. But not from PHP.
Could the ldap server be configured in a manner that it doesn't
retrieve all the attributes? For one user, it gets only 5 attributes
in total. What is pretty low...
$ldapconn = ldap_connect("ldaps://myserver", 636 )
or die( "Can't connect to server<BR>" ) ;
if (ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo "Using LDAPv3<BR>\n";
} else {
echo "Failed to set protocol version to 3";
}
ldap_bind( $ldapconn, "cn=username,ou=mygroup,o=mynetwork,c=country",
$pwd ) ;
$result = ldap_search( $ldapconn, "o=mynetwork,c=country",
"cn=jordi", array( "surname", "mail", "groupMembership" ) ) ;
$entry = ldap_get_entries($ldapconn, $result);
echo "SN =".$entry[0]['sn']."<br>\n" ;
echo "Surname =".$entry[0]["surname"]."<br>\n" ;
echo "mail =".$entry[0]["mail"]."<br>\n" ;
echo "group =".$entry[0]["groupMembership"]."<br>\n" ;
This returns...
Username= username
Using LDAPv3
Notice: Undefined index: sn on line 33
SN =
Surname =Array
Notice: Undefined index: mail on line 35
mail =
Notice: Undefined index: groupMembership on line 36
group =
Sincerely,
Steve JORDI
(Remove the K_I_L_LSPAM from my email address)
------------------------------------------------
1197 Prangins Email: stevejordiK_I_L_LSPAM@hotmail.com
Switzerland WWW: www.sjordi.com
------------------------------------------------
Volcanoes at www.sjordi.com/volcanoes
MovieDB at www.sjmoviedb.com
------------------------------------------------
[Back to original message]
|