note 42023 added to function.ldap-get-values-len
| From: | rcrow at NOSPAM dot laptv dot com | Date: | Thu, 29 Apr 2004 21:06:26 +0000 |
| Subject: | note 42023 added to function.ldap-get-values-len | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69012@lists.php.net to get a copy of this message | ||
If you are trying to access BINARY DATA, such as ObjectSID within LDAP, you must first get an
individual entry, as stated under ldap_get_values() function -- "This call needs a
result_entry_identifier, so needs to be preceded by one of the ldap search calls and one of the
calls to get an individual entry."
The following code snippet will get the LDAP objectSID for a specific user.
<?php
/* Get the binary objectsid entry */
/* Be sure that you have included the binary field in your ldap_search. */
$criteria = "samaccountname=$ldapUser";
$justthese = array("memberOf", "objectsid");
$ldapSearchResult = ldap_search($ldapConnectionResult, $ldapBase, $criteria, $justthese);
if (ldap_count_entries($ldapConnectionResult, $ldapSearchResult)){
$ldapResults = ldap_get_entries($ldapConnectionResult, $ldapSearchResult);
$entry = ldap_first_entry($ldapConnectionResult, $ldapSearchResult);
$ldapBinary = ldap_get_values_len ($ldapConnectionResult, $entry, "objectsid");
/* your code here */
}
?>
You then can use something like bin2hex to put the data in a more usable form.
----
Manual Page -- http://www.php.net/manual/en/function.ldap-get-values-len.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42023
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42023&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42023&report=yes
Search -- http://master.php.net/manage/user-notes.php