Hi, it's already realized. You may convert a binary SID to a text string with Win32::Lanman::SidToString and vice versa with Win32::Lanman::StringToSid.
Regards, Jens -----Original Message----- From: Geaslin, Andrew - GPB [mailto:[EMAIL PROTECTED]] Sent: Freitag, 7. Februar 2003 17:21 To: [EMAIL PROTECTED] Subject: RE: Human readable SIDs & GIDs I recently posted this in lieu of Win32::Perms or Win32::Lanman (though they work just fine) I apologize to the author of these subroutines but I have forgotten his name ... Anyway, one converts binary sid to text and the other text to binary sid should you need it. Win32::LookupAccountName($system, $account, $domain, $binSID, $sidtype); my $txtSID = &SIDbin2text($binSID); print "$account\n"; print "$system\n"; print "$domain\n"; print "$txtSID\n"; print "$sidtype\n"; ## SUBS sub SIDbin2text { my($bin) = @_; my($Revision, $SubAuthorityCount,@IdentifierAuthorities) = unpack("CCnnn", $bin); ($IdentifierAuthorities[0] || $IdentifierAuthorities[1]) and return; my($temp, $temp2, @SubAuthorities) = unpack("VVV$SubAuthorityCount",$bin); return "S-$Revision-$IdentifierAuthorities[2]-".join("-",@SubAuthorities); } sub SIDtext2bin { my($text) = @_; my(@Values) = split(/\-/, $text); ($Values[0] eq "S") or return; return pack("CCnnnV".(@Values-3), $Values[1], @Values-3, 0, 0, $Values[2], @Values[3..(@Values-1)]); } -Andrew -----Original Message----- From: Colin Eric Johnson [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 6:18 PM To: [EMAIL PROTECTED] Subject: Human readable SIDs & GIDs I feel like a complete knucklehead for asking this as I could swear I saw something about it go over the list a little while ago. But for the life of me I can't find it so here goes. I'd like to be able to convert both the SID and GID (objectSid and objectGid) from the binary form that AD stores them in into the readable forms (S-xxx-). Is there a simple way to do this? Feel free to just point me at the subject for the thread that may have just covered this and I will go away quietly ;-) Colin J. _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
