unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Does anybody have EUDC and OpenLDAP working?
@ 2004-01-15 14:22 Bruce S. Skinner
  2004-01-16  8:15 ` Dmitry Astapov
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce S. Skinner @ 2004-01-15 14:22 UTC (permalink / raw)



When doing a directory search I get the error:

  Opening input file: no such file or directory, 
  /home/skinner/unrecognized option -B

My environment is Emacs v21.2.1, OpenLDAP 2.1.22

regards :-)
BruceS

-- 

Bruce S. Skinner
Defence R&D Canada - Atlantic
9 Grove St.              <mailto:Bruce.Skinner@drdc-rddc.gc.ca>
P.O. Box 1012            <http://www.drdc-rddc.dnd.ca>
Dartmouth  NS
CANADA                    tel: (902) 426-3100 x205
B2Y 3Z7                   fax: (902) 426-9654

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does anybody have EUDC and OpenLDAP working?
  2004-01-15 14:22 Does anybody have EUDC and OpenLDAP working? Bruce S. Skinner
@ 2004-01-16  8:15 ` Dmitry Astapov
  2004-01-16 18:41   ` Martin Morgan
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Astapov @ 2004-01-16  8:15 UTC (permalink / raw)



Evening, Bruce. 

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

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 ...

-- 
Dmitry Astapov //ADEpt
GPG KeyID/fprint: F5D7639D/CA36 E6C4 815D 434D 0498  2B08 7867 4860 F5D7 639D

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does anybody have EUDC and OpenLDAP working?
  2004-01-16  8:15 ` Dmitry Astapov
@ 2004-01-16 18:41   ` Martin Morgan
  2004-01-18 14:49     ` Bruce S. Skinner
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Morgan @ 2004-01-16 18:41 UTC (permalink / raw)



> 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 <adept@ukr.net> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Does anybody have EUDC and OpenLDAP working?
  2004-01-16 18:41   ` Martin Morgan
@ 2004-01-18 14:49     ` Bruce S. Skinner
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce S. Skinner @ 2004-01-18 14:49 UTC (permalink / raw)


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 <mmorgan@wsu.edu> 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 <adept@ukr.net> 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.              <mailto:Bruce.Skinner@drdc-rddc.gc.ca>
P.O. Box 1012            <http://www.drdc-rddc.dnd.ca>
Dartmouth  NS
CANADA                    tel: (902) 426-3100 x205
B2Y 3Z7                   fax: (902) 426-9654

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-18 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-15 14:22 Does anybody have EUDC and OpenLDAP working? Bruce S. Skinner
2004-01-16  8:15 ` Dmitry Astapov
2004-01-16 18:41   ` Martin Morgan
2004-01-18 14:49     ` Bruce S. Skinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).