help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can Emacs's bundled LDAP package deal with ldaps:// URLs?


From: Tim X
Subject: Re: Can Emacs's bundled LDAP package deal with ldaps:// URLs?
Date: Sat, 04 Dec 2010 09:55:56 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Sean McAfee <eefacm@gmail.com> writes:

> As best I can tell the answer is "No," but I'm hoping someone might be
> able to point out something I missed...
>
> My company provides an LDAP server accessed via an ldaps:// URL.  From
> experimenting with the ldapsearch program on the command line, the only
> way I can access the server is to specify the URL using the -H flag.
> Browsing Emacs's bundled ldap.el file, it appears that it cannot supply
> that flag in its call out to ldapsearch.
>
> My klugy solution has been to use the ldaps URL as my LDAP "host," and
> then sneakily change the -h flag to -H thusly:
>
> (defadvice call-process (before ldapsearch-fix activate disable)
>   (loop for arg in args
>         if (string-match "^-h" arg)
>         do (store-substring arg 1 ?H)
>         and return nil))
>
> (defadvice ldap-search (around ldapsearch-fix activate)
>   (ad-enable-advice 'call-process 'before 'ldapsearch-fix)
>   (ad-activate 'call-process)
>   ad-do-it
>   (ad-disable-advice 'call-process 'before 'ldapsearch-fix)
>   (ad-activate 'call-process))
>
> Is there any better way using the basic functionality, or should I
> report a bug/submit a patch?

Yes, I suspect there is. A couple of things to note. 

Emacs comes with two related packages. One more low level than the
other. Depending on what your doing, you may find one package better
than the other. 

At the low level, you have ldap.el, which is essentially a wrapper
around ldapsearch. At a slightly higher abstraction you have eudc (Emacs
Unified Directory Client). Check out both to determine which provides
the best abstraction for what you want to do. 

Both packages support customization. Note that to get all the custom
stuff, some packages first need to be loaded (i.e. (require 'ldap))

,----[ C-h v ldap-ldapsearch-args RET ]
| ldap-ldapsearch-args is a variable defined in `ldap.el'.
| Its value is ("-LL" "-tt")
| 
| 
| Documentation:
| A list of additional arguments to pass to `ldapsearch'.
| 
| You can customize this variable.
`----

The above argument will likely be of use. However, note that the
ldapsearch program also has a dot rc file that it will use to read
command line argument defaults. This will override the above settings (I
think). So, possibly the problem you have experienced is because of
settings in this file overriding your emacs settings (I cannot remember
if the file is called .ldaprc or what and I don't have the tools on this
system). 

HTH

Tim

-- 
tcross (at) rapttech dot com dot au


reply via email to

[Prev in Thread] Current Thread [Next in Thread]