[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Mailing list query

Stelios A. wrote:
Hello all,

My user.ldif is like:

dn: cn=Somename Somelastname, ou=Users,dc=mydomain,dc=edu,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: person
objectClass: organizationalPerson
objectClass: top
givenName: Somename
sn: Somelastname
cn: Somename Somelastname
uid: ssomelastname
uidNumber: 1002
gidNumber: 100
homeDirectory: /home/ssomelastname
loginShell: /bin/bash
mail: ssomelastname@mydomain.edu.com
userPassword: some password encrypted

Same user for example is under cn=IT,ou=Groups,dc=mydomain,dc=edu,dc=com
Example ldif:

dn: cn=IT,ou=Groups,dc=bca,dc=edu,dc=gr
cn: IT
objectClass: groupOfUniqueNames
uniqueMember: cn=Somename Somelastname,ou=Users,dc=mydomain,dc=edu,dc=com

What I want is somehow to get all uid of the users belonging to each
of my groups in order to build a mailing list with postfix.

I've created a file called ldap-aliases.cf with the following inside:

server_host = ldaps://myhostname
search_base = dc=mydomain,dc=edu,dc=com
scope = sub
version = 3
query_filter = (&(|(objectclass=person)(objectclass=groupofuniquenames)(mail=%s)(ou=Groups)))
result_attribute = uid
bind = yes
bind_dn = cn=admin,dc=mydomain,dc=edu,dc=com
bind_pw = mypasswordwithoutencryption

The above works ok without errors but it just displays all users in my ldap.
I tried several different ways but can't find out how to add to the
query to show me only the cn=IT,ou=Groups,dc=mydomain,dc=edu,dc=com

and also a second more complicated query, that is to show me all users
uid where not belonging to any Group

Any help is much appreciated.

It is not clear (to me) what you want to do. You should carefully rephrase your requirements in terms of LDAP queries. Adding the complexity of postfix configuration to what needs to be clarified first in terms of pure LDAP operations further obscures your needs.


Ing. Pierangelo Masarati OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Fax:     +39 0382 476497
Email:   ando@sys-net.it