[nSLUG] Script to do LDAP search based on email address?

Jeff Warnica jeffw at chebucto.ns.ca
Fri Oct 17 16:05:47 ADT 2003

>From the command line tools included with openldap (RPMS split up the
libs, tools and servers) the most basic command could be something like:

$ ldapsearch -h ad.artistic.ca -b "o=artistic,c=ca"
"(mail=whoever at artistic.ca)"

The server may or may not require authentication (and/or authorization),
in which case you need some more options. You can limit the attributes
returned by simply listing the ones you want at the end of the above

As a side note "mail" should be used to contain the email address that
the person wants used, which is not necessararly the same thing as the
email address for that person on the system. MTAs which do mail routing
from LDAP data use "mailLocalAddress" and "mailRoutingAddress" for what
I like to think of as alias and mail box, respectivly.

On Fri, 2003-10-17 at 11:03, Donald Teed wrote:
> I'm searching for a script that when given an email address
> can return the username from an LDAP (Active Directory) server.
> I've found scripts that do other things like retrieving records
> based on knowing the name already, or creating a new one, but in
> my case I'm not the LDAP admin, just a user, and I need to do
> lookups based on knowing the domain and the email address.
> Can anyone point me to a place that might have this?
> Perl is the most likely candidate but I'd be willing to
> use anything (other than VBscript/ASP).

More information about the nSLUG mailing list