Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / January 2007

Tip: Looking for answers? Try searching our database.

Is my SID's octet string correct?  I can't find AD object with it.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pucca - 18 Jan 2007 01:01 GMT
Hi, I'm using vs2005, .net 2.0 on win2k server.

Here I'm searching for a Computer object in AD using the sid that I
translate to octet string format for use with DirectorySearcher but it's not
finding it.  But I see it using the ldp.exe.  Is there someting wrong with my
filter or is the problem with the octet string?

sid in sddl: sid = "S-1-5-21-1993962763-879983540-725345543-2608"
searchSID (sid octet string) =
"\\01\\05\\00\\00\\00\\00\\00\\05\\15\\00\\00\\00\\0B\\75\\D9\\76\\B4\\7B\\73\\34\\07\\E5\\3B\\2B\\30\\0A\\00\\00"
My search filter = "(&(objectClass=computer)(objectSid =
\\01\\05\\00\\00\\00\\00\\00\\05\\15\\00\\00\\00\\0B\\75\\D9\\76\\B4\\7B\\73\\34\\07\\E5\\3B\\2B\\30\\0A\\00\\00))"

'for (index = 1; index < dsReport.Tables["PadComputers"].Rows.Count; index++)
{
   dsReport.Tables["PadComputers"].Rows[index]["meetingName"] =
       
dsReport.Tables["PadComputers"].Rows[index]["meetingName"].ToString().Replace("$", "");//Remove the trailing $ of the computer name
   sid = dsReport.Tables["PadComputers"].Rows[index]["cn"].ToString();
   searchSID = CUnityDS.SearchFilterSID(sid);

   dsAD.Filter = "(&(objectClass=computer)" + "(objectSid = " + searchSID +
"))";
   srFound = dsAD.FindOne();
   if (srFound != null)
   {
       DataRow newRow = dsReport.Tables["AdComputers"].NewRow();
       AdDe = srFound.GetDirectoryEntry();
       newRow["objectSid"] = sid;
       newRow["cn"] = AdDe.Properties["cn"].Value.ToString();
       if (AdDe.Properties["operatingSystem"].Value != null)
           newRow["operatingSystem "] =
AdDe.Properties["operatingSystem"].Value.ToString();
       if (AdDe.Properties["operatingSystemVersion"].Value != null)
           newRow["operatingSystemVersion"] =
AdDe.Properties["operatingSystemVersion"].Value.ToString();
       dsReport.Tables["AdComputers"].Rows.Add(newRow);
   }
   else
       continue;
}                
Signature

Thanks.

Joe Kaplan - 18 Jan 2007 03:34 GMT
Are you sure the search base and scope are the same?  That's the only reason
why I think it could be different.  There is also no real point in adding
(objectCategory=computer) on your filter, as SID is unique and is also
indexed.

Joe K.

Signature

Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--

> Hi, I'm using vs2005, .net 2.0 on win2k server.
>
[quoted text clipped - 42 lines]
>        continue;
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.