[Mimedefang] Validating Exchange addresses

Dan Tulovsky dtulovsky at sbigroup.com
Tue Oct 7 14:19:01 EDT 2003


But the "mail" attribute contains only the primary mail address of the
user, not any of the aliases.  You need to get the proxyAddresses
attribute, filter out only the ones that start with "smtp:" and check
against all of them.

Unless, of course, your users all have just one valid email address,
then the "mail" attribute is just fine.

Dan


> Is this going to miss anything? Is there a more efficient way to make 
> the query? (I'm an LDAP newb with only the glossiest idea of its query
> system.)

Be nice to your LDAP server and only request the mail attribute.  Your
ldapsearch command would then look like:

ldapsearch -h $server -x -P2 -s sub "objectclass=*" mail


-----Original Message-----
From: John Rowan Littell [mailto:littejo at earlham.edu] 
Sent: Tuesday, October 07, 2003 8:41 AM
To: mimedefang at lists.roaringpenguin.com
Subject: Re: [Mimedefang] Validating Exchange addresses

-----BEGIN PGP SIGNED MESSAGE-----

Lo, Kenneth Porter and the coffee pot sang in unison:

> Inspired by some samples, I've come up with the following one liner 
> that seems to get all addresses from an Exchange server:
>
> ldapsearch -h "$server" -x -P2 -s sub "objectclass=*" | awk 
> '/^mail:/{print $2;}'
>
[snip]
>
> Is this going to miss anything? Is there a more efficient way to make 
> the query? (I'm an LDAP newb with only the glossiest idea of its query

> system.)

Be nice to your LDAP server and only request the mail attribute.  Your
ldapsearch command would then look like:

ldapsearch -h $server -x -P2 -s sub "objectclass=*" mail

If you stick a '-LLL' in the ldapsearch command line, then you'll have
even less work for awk to do, as the output will look something like
this:

dn: blahblahblah
mail: foo at example.org

dn: blublublub
mail: bar at example.org

...

A quick browse through the man page doesn't show me a way of removing
the DN lines from the output, though, so I think you'll still neet that
awk statement.

  --rowan

- --
John "Rowan" Littell
Systems Administrator
Earlham College Computing Services
http://www.earlham.edu/~littejo/
2003-10-07 07:32
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)
Comment: Made with pgp4pine 1.76

iQCVAwUBP4K0Z5dUNSJ2nf/5AQHkNgP/dRcP+jds3h+fypUOa/DqSLRtLp5UIvPd
7Dvk6Wco1dm+Xlmd+YqNKjpEuXWsQqHOxSd+4pBta2ga3hMujL3c1FfPfvqsWVNu
HM1ez93t0sp7m4R3a0M9TPKQYYClz55N8RjG4fp5LhLkixgNjvZy78KkLkS9OKVL
4YXRLPH8CVc=
=4WLE
-----END PGP SIGNATURE-----

_______________________________________________
MIMEDefang mailing list
MIMEDefang at lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang





More information about the MIMEDefang mailing list