ldap ObjectSID string to hex <p>I can't figure out how to search in an ldap directory by objectsid string:</p> <pre><code>$string = 'S-0-1-23-4567890123-4567890123-456789012-3456' $ds = ldap_connect('xxxx', xxx); ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); $r = ldap_bind($ds, $bind_rdn, $bind_password); $filter = "(objectSid=$string)"; $sr = ldap_search($ds, $dn, $filter); $users = ldap_get_entries($ds, $sr); </code></pre> <p>Then i read somewhere you should pass it as hex value: /00/00/....</p> <pre><code>$s = preg_replace('/../','\\\\$0',bin2hex($string)); </code></pre> <p>But still no result. If i pass objectSid=* ass filter, i get all results, so i know the query is working :).</p> <p>Thx!</p>