I know if I have the hex version of a SID, I can open a user
container, but I have the string version, like this one:
S-1-217-1474056490-1223235779-1128711312-1816630683-3775420535
When I try to convert it using Richard Muellers (or anyone else's)
String to Hex routines, it bombs out with an overflow error.
Is there a better way to do this, or does someone have a version of
the function which doesn't overflow?
Thanks
Alan
The best way to do this is to use the Windows API ConvertStringSidToSid
function to convert back to a byte array and then convert that to a hex
string, but you could also do this by hand if you need to. I have .NET code
that does this, but no script.
Joe K.
"Alan" <air...@hotmail.com> wrote in message
news:9lm2uv411vcklpkpn...@4ax.com...
We're considering rewriting in .NET, but concerned about how long it will
take to rewrite all of our components.
Any code you have on converting the SIDs and setting Trustees would be most
appreciated.
Why does this SID overflow when converting?
S-1-217-1474056490-1223235779-1128711312-1816630683-3775420535
Thanks.
A SID is basically an array of bytes composed of 1 byte of revision, 1 byte
of subauthority count, a 6 byte number with the authority name, and then a
variable number of 4 byte sub-authorities that are 32 bit integers (stored
little endian).
So basically, the SID below as an octet string should be:
01050000000000D82A51DC57C318E94890C446439B95476C778508E1
Just out of curiosity, what do you need the octet string of the SID for?
Joe K.
"Alan" <al...@northwoodsoft.com> wrote in message
news:eg0kL5Yx...@TK2MSFTNGP09.phx.gbl...
Our workstation displays the security settings for an article. In AD,
we got the Trustee Name from the DACL (the samAccountName). With
ADAM, we get the SID, not the friendly name. So, I have to use the
SID to find the userPrincipalName, or the container name, which should
be the same in our system.
Given a SDDL formatted SID, I haven't been able to retrieve the
container for that user or group (the trustee). The only way I've
been able to get it has been with the hex representation
(LDAP://<SID=xxxxxx>). So, give a SDDL SID, I have to somehow turn it
back into hex.
If you've got another way to solve this problem PLEASE let me know.
We used to use NameTranslate or a WinNT look up, but neither of those
methods seem to be supported by ADAM.
TIA & Happy Holidays.
--
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan" <air...@hotmail.com> wrote in message
news:ec77uv0qau603akl1...@4ax.com...
To convert to hex, just take a binary representation of a SID (should be 28
bytes), and just convert to hex byte to byte.
--
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan" <air...@hotmail.com> wrote in message
news:tk4fuvc0fepiqlas2...@4ax.com...
--
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan" <air...@hotmail.com> wrote in message
news:anijuvod6jte2n8hn...@4ax.com...
I really could use some help with this, it's for a major manufacturing
customer of both Microsoft and my company. I haven't been able to get
help from our local MS office.
I just tried this from my w2k3 machine, and I can get ADAM user by his SID
from ADSIEdit. Make sure you have the latest version of ADSI.
--
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan" <air...@hotmail.com> wrote in message
news:jp1quv4cn9vhleagi...@4ax.com...
The only success I've had is taking the String version of SID,
converting it to Hex, and then GetObject or
OpenDSObject("LDAP://cmsADAM:389/<SID=hexstring>" there's gotta be an
easier way.
Thanks for hanging in there Dmitri.
--
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan" <air...@hotmail.com> wrote in message
news:4q1suv0r2rgbuouqq...@4ax.com...
>adsldp.dll and adsldpc.dll?
Both are version 5.2.3790.0
--
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Alan" <air...@hotmail.com> wrote in message
news:175tuvoi9b3lff3a3...@4ax.com...
Thanks for pursuing this along the way.