* Properly handle ldapsearch output from OpenLDAP version 2 and above.
  Patch: ldapsearch-output.diff 
  Provided-by: Henrik Holmboe <henrik@holmboe.se> 
  Added-by: Jerome Marant <jerome@debian.org>
  Date: Tue, 17 Oct 2006 10:06:24 +0200 
  Status: fixed upstream 

Index: emacs21-21.4a+1/lisp/net/ldap.el
===================================================================
--- emacs21-21.4a+1.orig/lisp/net/ldap.el	2006-10-17 09:35:11.553434043 +0200
+++ emacs21-21.4a+1/lisp/net/ldap.el	2006-10-17 09:39:57.049573660 +0200
@@ -157,7 +157,7 @@
   :type '(string :tag "`ldapsearch' Program")
   :group 'ldap)
 
-(defcustom ldap-ldapsearch-args '("-B")
+(defcustom ldap-ldapsearch-args '("-x")
   "*A list of additional arguments to pass to `ldapsearch'.
 It is recommended to use the `-T' switch with Netscape's
 implementation to avoid line wrapping.
@@ -587,12 +587,13 @@
 	  (while (looking-at "^\\(\\w*\\)[=:\t ]+\\(<[\t ]*file://\\)?\\(.*\\)$")
 	    (setq name (match-string 1)
 		  value (match-string 3))
-	    (save-excursion
-	      (set-buffer bufval)
-	      (erase-buffer)
-	      (insert-file-contents-literally value)
-	      (delete-file value)
-	      (setq value (buffer-substring (point-min) (point-max))))
+	    (if (string-match "^< file:///\\(.*\\)$" value)
+		(save-excursion
+		  (set-buffer bufval)
+		  (erase-buffer)
+		  (insert-file-contents-literally value)
+		  (delete-file value)
+		  (setq value (buffer-substring (point-min) (point-max)))))
 	    (setq record (cons (list name value)
 			       record))
 	    (forward-line 1))
