Fixed search scope in DirectorySearcher DoSearch method.
authorAnil Bhatia <anil@mono-cvs.ximian.com>
Mon, 14 Feb 2005 10:26:02 +0000 (10:26 -0000)
committerAnil Bhatia <anil@mono-cvs.ximian.com>
Mon, 14 Feb 2005 10:26:02 +0000 (10:26 -0000)
svn path=/trunk/mcs/; revision=40617

mcs/class/System.DirectoryServices/ChangeLog
mcs/class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.cs

index c81ec3541272daf5431b876a9d79b50df7e3dbec..ce60b2abc71cc94810479a43ecfb2e1a0ec63be7 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-14  Anil Bhatia  <banil@novell.com>
+       * Fixed DoSearch() in DirectorySearcher.cs: Search scope was hardcoded
+       as LdapConnection.SCOPE_SUB. Chnaged to the value contained by
+       _SearchScope.
+
 2004-09-10  Sebastien Pouliot  <sebastien@ximian.com>
 
        * Makefile: Activate unit tests.
index 7e9f62d3fdb482c32ac2a4597ad6428279264a5e..24f1a2794968c2c095699aa305b1fbd1bab03f08 100644 (file)
@@ -616,8 +616,27 @@ namespace System.DirectoryServices
                        InitBlock();
                        String[] attrs= new String[PropertiesToLoad.Count];
                        PropertiesToLoad.CopyTo(attrs,0);
+                       int connScope = LdapConnection.SCOPE_SUB;
+                       switch (_SearchScope)
+                       {
+                       case SearchScope.Base:
+                         connScope = LdapConnection.SCOPE_BASE;
+                         break;
+
+                       case SearchScope.OneLevel:
+                         connScope = LdapConnection.SCOPE_ONE;
+                         break;
+
+                       case SearchScope.Subtree:
+                         connScope = LdapConnection.SCOPE_SUB;
+                         break;
+
+                       default:
+                         connScope = LdapConnection.SCOPE_SUB;
+                         break;
+                       }
                        LdapSearchResults lsc=_conn.Search(     SearchRoot.Fdn,
-                                                                                               LdapConnection.SCOPE_SUB,
+                                                               connScope,
                                                                                                Filter,
                                                                                                attrs,
                                                                                                false);