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

Filtering searches, I have a specific with to filter out something.



Hello list.

I'm fair with OpenLDAP, but I'm trying to figure out one possibly simple 
filter idea..

A nice '(mail=user@domain.com)' as a filter, would find the entries that have 
that attribute with that value. But, what if I wanted to filter out a 
specific object, so that it doesn't show up in that list, say I have the 
following entries:

dn: uid=psi-jack,ou=People,dc=myrddincd,dc=com
uid: psi-jack
cn: Eric Renfro
givenName: Eric
sn: Renfro
mail: psi-jack@myrddincd.com
homeDirectory: /home/psi-jack
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
objectClass: inetLocalMailRecipient
objectClass: CourierMailAccount
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1000
gidNumber: 100
gecos: Eric Renfro
shadowLastChange: 12062
mailLocalAddress: security@myrddincd.com
mailHost: smtp.myrddincd.com
mailDir: myrddincd.com/psi-jack/
userPassword=***********


dn: cn=Administrators,ou=Aliases,dc=myrddincd,dc=com
objectClass: top
objectClass: mailGroup
mail: psi-jack@myrddincd.com
cn: Administrators
mgrpRFC822MailMember: root
mgrpRFC822MailMember: operator
mgrpRFC822MailMember: abuse
mgrpRFC822MailMember: ftp
mgrpRFC822MailMember: ftp-admin
mgrpRFC822MailMember: hostmaster
mgrpRFC822MailMember: news
mgrpRFC822MailMember: admin
mgrpRFC822MailMember: administrator
mgrpRFC822MailMember: virusalert
mgrpRFC822MailMember: netsaint
mgrpRFC822MailMember: faxmaster

dn: uid=psi-jack,dc=psi-jack.dnsalias.com,ou=Mail,dc=myrddincd,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: inetLocalMailRecipient
objectClass: CourierMailAccount
sn: Renfro
cn: Eric Renfro
displayName: Psi-Jack
givenName: Eric
initials: EAR
mail: psi-jack@psi-jack.dnsalias.com
homeDirectory: /home/psi-jack
uidNumber: 1000
gidNumber: 100
mailDir: psi-jack.dnsalias.com/psi-jack/
uid: psi-jack
userPassword=********


If I used a search base of dc=myrddincd,dc=com, with a scope of sub, searching 
by filter (mail=psi-jack@myrddincd.com) would pull the first two entries. 

In example, of a filter which doesn't work: 
(&(mail=psi-jack@myrddincd.com)(!objectClass=mailGroup)), in theory, if that 
would work, it would filter OUT the 2nd entry I've shown, making it show just 
the one account entry.

Can OpenLDAP's filtering do such a thing, and if so, how?

-- 
Eric Renfro
Myrddin Computers & Designs