[Mono-bugs] [Bug 80103][Wis] New - [PATCH] LDAP referal exception should be ignored

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Nov 30 15:24:25 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jlarimer at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80103

--- shadow/80103	2006-11-30 15:24:25.000000000 -0500
+++ shadow/80103.tmp.4594	2006-11-30 15:24:25.000000000 -0500
@@ -0,0 +1,100 @@
+Bug#: 80103
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: jlarimer at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] LDAP referal exception should be ignored
+
+Description of Problem:
+
+  When using System.DirectoryServices.DirectorySearcher to query a Windows 
+Active Directory Server, the results will almost always contain referal 
+nodes. These can probably be ignored, as there are also non-referal 
+responses.
+
+  With the below patch, the Mono DirectorySearcher can be used to query 
+Windows AD servers.
+
+Steps to reproduce the problem:
+
+-----8<------
+
+using System;
+using System.DirectoryServices;
+using System.Collections;
+
+class Test {
+    public static void Main() {
+        try {
+            DirectoryEntry de = new DirectoryEntry
+("LDAP://192.168.1.175/DC=hello,DC=example,DC=com", "username", "password",
+ AuthenticationTypes.ServerBind);
+            DirectorySearcher ds = new DirectorySearcher(de);
+            SearchResultCollection src = ds.FindAll();
+            Console.WriteLine("Found {0}", src.Count);
+
+        } catch (Exception e) {
+            Console.WriteLine("{0}", e);
+        }
+    }
+}
+
+-----8<------
+
+The above code needs compiled with "mcs LdapTest.cs -
+r:System.DirectoryServices.dll". The DirectoryEntry() line should be 
+modified to point to a real Windows Active Directory Server with the 
+correct path and authentication information.
+
+Actual Results:
+
+  LdapReferralException: (10) Referral
+  REFERRAL_ITEM
+
+Expected Results:
+
+  Found xxxx
+
+How often does this happen? 
+
+  Every time, at least against a Windows Server 2003 AD
+
+Additional Information:
+
+  Here is a proposed patch that adds "LdapException.REFERRAL" to the list 
+of ignored exceptions:
+
+
+Index: 
+class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.c
+s
+===================================================================
+--- 
+class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.c
+s        (revision 68591)
++++ 
+class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.c
+s        (working copy)
+@@ -672,6 +672,7 @@
+                                                // in case of this return 
+codes exception should not be thrown
+                                                case 
+LdapException.SIZE_LIMIT_EXCEEDED:
+                                                case 
+LdapException.TIME_LIMIT_EXCEEDED:
++                                               case 
+LdapException.REFERRAL:
+                                                        continue;
+                                                default :
+                                                        throw e;


More information about the mono-bugs mailing list