Im trying to return the SID for all users in our active directory
The problem is that they all return the same!
Our active directory runs in a Windows 2000 native functional level, would this affect it?
I can get any other details from it just not the SID.
the value returned is obviously in binary, and displays as some strange character on the page, and its the same character for every user. I then convert the binary to plain text using the following function:
They all get returned from this as "1-0-0-0-0-0-0"
I dont think the conversion function is the problem here as all the SID's look the same before!
Can anyone help!?!?!
thanks
Andy
The problem is that they all return the same!
Our active directory runs in a Windows 2000 native functional level, would this affect it?
I can get any other details from it just not the SID.
the value returned is obviously in binary, and displays as some strange character on the page, and its the same character for every user. I then convert the binary to plain text using the following function:
Code:
// Converts a little-endian hex-number to one, that 'hexdec' can convert
function littleEndian($hex) {
for ($x=strlen($hex)-2; $x >= 0; $x=$x-2) {
$result .= substr($hex,$x,2);
}
return $result;
}
// Returns the textual SID
function binSIDtoText($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($this->littleEndian(substr($hex_sid,16+($x*8),8)));
$result .= "-".$subauth[$x];
}
return $result;
}
I dont think the conversion function is the problem here as all the SID's look the same before!
Can anyone help!?!?!
thanks
Andy
Comment