= 0; $x = $x - 2) { $result .= substr($hex, $x, 2); } return $result; } function getTextSID($binsid) { $hex_sid = bin2hex($binsid); $rev = hexdec(substr($hex_sid, 0, 2)); $subcount = hexdec(substr($hex_sid, 2, 2)); $auth = hexdec(substr($hex_sid, 4, 12)); $result = "$rev-$auth"; for ($x=0;$x < $subcount; $x++) { $subauth[$x] = hexdec(little_endian(substr($hex_sid, 16 + ($x * 8), 8))); $result .= "-" . $subauth[$x]; } // Cheat by tacking on the S- return 'S-' . $result; } // load the framework /* define('USE_MAMMUT',true); require('Mammut/lib.mammut.php'); import('Mammut.Protocol.LDAP.MFLDAP'); $ldap = new MFLDAP('stwgdvserver'); $ldap->connect('test@stw-crailsheim.dom','test12'); $ldap->disconnect(); */ // $con = ldap_connect ('stwgdvserver', 389); $con = ldap_connect('ldaps://stwoes1', 636); //$con = ldap_connect('ldaps://stwoes2', 389); //$con = ldap_connect('stwnw1', 636); //$con = ldap_connect('ldaps://stwnw2', 636); //ldap_start_tls($con); ldap_bind($con, 'CN=admin,O=STW', '=a4MinZ!'); // ldap_bind($con, 'admin', '=a4MinZ!'); // ldap_bind($con, 'CN=admin,O=STW', '=a4MinZ!'); // $sr=ldap_list($con, "CN=Users,DC=stw-crailsheim,DC=dom", "objectclass=user"); $sr=ldap_list($con, "o=STW", "objectclass=*"); $info = ldap_get_entries($con, $sr); foreach ($info as $i) { echo '
'; /*var_dump($i['name']); var_dump(getTextSID($i['objectsid'][0])); var_dump(bin2hex($i['objectguid'][0])); echo ''; for ($j = 0; $j < $i['count']; $j++) { echo $j.':'.$i[$j]."\n"; $obj = $i[$i[$j]]; for ($k = 0; $k < $obj['count']; $k++) { echo '- '.$k.'('.gettype($obj[$k]).'):'.$obj[$k]."\n"; } }*/ var_dump($i); //echo ''; echo '