Re: How do I convert sid retrieved from the AD to SDDL string form



Yes, you're right Joe. I changed my code to using DirectorySearcher and then
I put the data into a datarow and then add it to my data table with sid in
SDDL string format.
--
Thanks.


"Joe Kaplan" wrote:

It needs to be a byte[], because the data is a variable length byte array.
AD SIDs are generally bigger than GUIDs, so that isn't a good idea. I think
the problem from your previous code sample was that you were calling
ToString on the data.

I'm still confused why you are using OLEDB for searching AD, but whatever
works for you...

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Pucca" <Pucca@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A498835F-3C6E-4569-B83E-B897B1D90025@xxxxxxxxxxxxxxxx
In the Dataset table definition, what type should I set for storing SID,
which is a byte[]. I tried GUID type but it doesn' like it.
--
Thanks.


"Henning Krause [MVP - Exchange]" wrote:

Hello,

if you are using .NET 2.0, you can pass the byte[] you get from the
objectSid property to a SecurityIdentifier class.

Otherwise, you have at least these options:
1) (easy one) Call the Win32 function ConvertSidToStringSid.
2) (more difficult, but more flexibility) Call the Win32 DsCrackNames
function

Best regards,
Henning Krause

"Pucca" <Pucca@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0972CEEE-1D2D-4605-8C4B-3B4995A2195D@xxxxxxxxxxxxxxxx
I retrieve sid from AD into a dataset table. How can I convert this to
SDDL
format string? My code below is not working.

ReportPreview repPreview = new ReportPreview();
string AdSelect = "select objectSid, cn, operatingSystem,
operatingSystemVersion from 'LDAP://CN=Computers,"; +
delimitedDomain + "'";
string padSelect = "Select cn, meetingName from " +
globalCompPath;
string temp;
int rs, num;
OleDbConnection adCon = new
OleDbConnection("Provider=ADsDSOObject");
OleDbDataAdapter qryAdapter = new OleDbDataAdapter(AdSelect,
adCon);
try
{
DataRow newRow = dsReport.Tables["Computers"].NewRow();

qryAdapter.Fill(dsReport, "AdComputers");
num = dsReport.Tables["AdComputers"].Rows.Count;
for (int y = 0; y <
dsReport.Tables["AdComputers"].Rows.Count; y++)
{
SecurityIdentifier si = new
SecurityIdentifier(dsReport.Tables["AdComputers"].Rows[y][0].ToString());
dsReport.Tables["AdComputers"].Rows[y][0] =
si.Value;
}
--
Thanks.





.



Relevant Pages

  • Re: Domain registration requirement in federated web sso with fore
    ... Thanks a lot Joe for this useful information. ... We have some applications, written in non microsoft languages like Java, ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... internet, then the DNS entries for the resources will need to be ...
    (microsoft.public.windows.server.active_directory)
  • Re: Error setting DirecotrySearchers new ExtendedDN
    ... Thanks Joe, but now I'm worried and confused. ... 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, ... The .NET Framework does not support all versions of every platform. ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.platformsdk.security)
  • Re: ADAM Authentication
    ... Only using ADAM for testing a proof-of-concept; ... "Joe Kaplan" wrote: ... Note that using S.DS for authentication may cause you scalability problems ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.windows.server.active_directory)
  • Re: How to get user id guid
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... UserProfileManager upm = new UserProfileManager; ... I am developing a SSO web part between a SharePoint site and my web ...
    (microsoft.public.dotnet.security)
  • Re: Oh.... Im just wondering whos seen this stumper... RESOLVED !
    ... but I wonder if you saw any controls loaded in the modify ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... just has the granular attribute write permissions ...
    (microsoft.public.windows.server.active_directory)