I would suggest checking out Win32::Perms from Roth, the URL is :
http://www.roth.net/perl/perms/
I doubt it's portable to UNIX, however, you can look at it's
Win32::Perms::ResolvSid method, and see how that works.
Also, a good site is : http://perl-ldap.sourceforge.net/FAQ.html
Looking on MSN, which describes the SID structure (urL :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Se
curity/sid_components.asp) it seems to say this:
the format of the sid is S-R-S-S...
Where the first byte is the revision level of the SID structure, the next
48bits (6 bytes) are the authority that issued the SID and then a variable
number of (48bit?) subauthority values, as defined in Winnt.h
But, it's never that simple..
HTH,
!c