From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruce.Skinner@drdc-rddc.gc.ca (Bruce S. Skinner) Newsgroups: gmane.emacs.help Subject: Re: Does anybody have EUDC and OpenLDAP working? Date: 18 Jan 2004 14:49:00 +0000 Organization: Bell Sympatico Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <874qux5m2a.fsf@drdc-rddc.gc.ca> <87zncoux58.fsf@dimail.umc.com.ua> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1074439007 2086 80.91.224.253 (18 Jan 2004 15:16:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 18 Jan 2004 15:16:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 18 16:16:42 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AiEfK-0002kU-00 for ; Sun, 18 Jan 2004 16:16:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AiEeN-0008Td-Uy for geh-help-gnu-emacs@m.gmane.org; Sun, 18 Jan 2004 10:15:43 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!news.alt.net!wn14feed!worldnet.att.net!207.35.177.252!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.gnus,gnu.emacs.help Original-Lines: 115 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Cache-Post-Path: news.drenet.dnd.ca!unknown@host-131-16.vpn.drenet.dnd.ca X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) Original-NNTP-Posting-Host: 131.136.242.1 Original-X-Complaints-To: abuse@sympatico.ca Original-X-Trace: news20.bellglobal.com 1074437358 131.136.242.1 (Sun, 18 Jan 2004 09:49:18 EST) Original-NNTP-Posting-Date: Sun, 18 Jan 2004 09:49:18 EST Original-Xref: shelby.stanford.edu gnu.emacs.gnus:69610 gnu.emacs.help:120196 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16140 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16140 Hello Martin, I have it working now thanks to Dan Katz (see his post). Your fix is pretty much what he did (see his post in this thread). I would have headed down the -tt option route if I had known about it. The manpage for ldapsearch v2.1.22 is mis-leading " -t Write retrieved values to a set of temporary files. This is useful for dealing with non-ASCII values such as jpegPhoto or audio. " and it doesn't mention option '-tt' anywhere. Thanks very much and regards :-) BruceS Martin Morgan writes: > > Bruce.Skinner@drdc-rddc.gc.ca (Bruce S. Skinner) 14:22 15/1/2004 wrote: > > > > BSS> When doing a directory search I get the error: > > > > BSS> Opening input file: no such file or directory, > > BSS> /home/skinner/unrecognized option -B > > > > BSS> My environment is Emacs v21.2.1, OpenLDAP 2.1.22 > > I've just been struggling with this. > > I think there are two things. First, the variable > ldap-host-parameters-alist has a default option -B, but I think > openldap doesn't recognize this option. So use customize-variable > ldap-host-parameters-alist and delete this. > > Second and more problematic is in the ldap.el file. The function > ldap-search-internal parses the info that comes back from ldapsearch > with this snippet: > > (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)))) > (setq record (cons (list name value) > record)) > (forward-line 1)) > > although written otherwise, the regexp is designed for ldapsearch > storing each search key in a temporary file (with OpenLDAP this would > be accomplished by the variable -tt), and the search itself returning > a list of keys and the file they're stored in. The regexp extracts the > file tag and file name, and then, in the save-excursion retrieves the > info from the file. What actually happens with the default arguments > is that the keys are not saved to file, but are returned as key: value > pairs. The regexp picks up the value, but the value is treated as a > file name. Here's my kludge: > > (while (looking-at "^\\(\\w*\\)[=:\t ]+\\(<[\t ]*file://\\)?\\(.*\\)$") > (setq name (match-string 1) > file (match-string 2) ; mtm -- only match with binary files > value (match-string 3)) > (if file ; mtm -- read any binary files > (save-excursion > (set-buffer bufval) > (erase-buffer) > (insert-file-contents-literally value) > (delete-file value) > (setq value (buffer-substring (point-min) (point-max)))) > ) ; mtm -- end if > > Basically, only replace the value with file contents when a value is > actually returned in a file (apparently, this can happen with the -t > option if, for instance, the LDAP server stores, e.g., pictures of > each entry). > > It's not enough just to feed -tt as an option in > ldap-host-parameters-alist (which would be overkill anyway, storing > all values in temporary files) because earlier in the > ldap-search-internal routine there's an assumption about the format of > the output (that the first line after blank is dn: value) that isn't > true for the default ldapsearch parameters (where the first line after > a blank is a comment). I *think* the non-coding solution is to > customize the ldap-host-parameters-alist to -LLL and -tt. If you go > with this option, you might need to make ensure file naming > conventions so that OpenLDAP deals with spaces in file names > correctly. > > Hope that helps! > > Dmitry Astapov writes: > > > Evening, Bruce. > > > > > > Lucky you. I (with xemacs 21.4.14 and openldap 2.1.23) often get my xemacs > > crashed on the first (after reboot) eudc search. It goes on for quite a > > long time and I honestly dont know what to do about it ... > > This, unfortunately, I cannot help with. -- Bruce S. Skinner Defence R&D Canada - Atlantic 9 Grove St. P.O. Box 1012 Dartmouth NS CANADA tel: (902) 426-3100 x205 B2Y 3Z7 fax: (902) 426-9654