[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
not operator in search ?
hello,
I'm searching in ldap 2.07
all entry that dont have an attribute or/and an object class.
The both dont work,
ldapsearch -b 'dc=ungi,dc=fr' "(!(rep1titre=*))"
ldapsearch -b 'dc=ungi,dc=fr' "(!objectclass=rep1)"
So is it possible to use the not operator (!) ???
rfc2254 tell it's possible, but is it working width ldbm database
thanks for your help.
Arnaud
#################################
# search an atribute is not present
#################################
>> wrong
ldapsearch -b 'dc=ungi,dc=fr' "(!(rep1titre=*))"
bash: !: event not found
>> wrong again
ldapsearch -b 'dc=ungi,dc=fr' "( rep1titre!=*)"
version: 2
#
# filter: ( rep1titre!=*)
# requesting: ALL
#
# search result
search: 2
result: 0 Success
# numResponses: 1
>> ok
ldapsearch -b 'dc=ungi,dc=fr' "( rep1titre=*)"
version: 2
#
# filter: ( rep1titre=*)
# requesting: ALL
#
# 2,dc=ungi,dc=fr
dn: pubid=2,dc=ungi,dc=fr
objectClass: top
objectClass: rep
objectClass: rep1
pubid: 2
reptitre: rennes/rep1
rep1titre: rennes/rep1
# 3,dc=ungi,dc=fr
dn: pubid=3,dc=ungi,dc=fr
objectClass: top
objectClass: rep
objectClass: rep1
pubid: 3
reptitre: rennes/rep1
rep1titre: rennes/rep1titre
# search result
search: 2
result: 0 Success
# numResponses: 3
# numEntries: 2
#################################
# search an object is not present
#################################
>> wrong
ldapsearch -b 'dc=ungi,dc=fr' "(!objectclass=rep1)"
bash: !objectclass=rep1: event not found
>> ok
ldapsearch -b 'dc=ungi,dc=fr' "( objectclass=rep1)"
version: 2
#
# filter: ( objectclass=rep1)
# requesting: ALL
#
# 2,dc=ungi,dc=fr
dn: pubid=2,dc=ungi,dc=fr
objectClass: top
objectClass: rep
objectClass: rep1
pubid: 2
reptitre: rennes/rep1
rep1titre: rennes/rep1
# 3,dc=ungi,dc=fr
dn: pubid=3,dc=ungi,dc=fr
objectClass: top
objectClass: rep
objectClass: rep1
pubid: 3
reptitre: rennes/rep1
rep1titre: rennes/rep1titre
# search result
search: 2
result: 0 Success
# numResponses: 3
# numEntries: 2
#################################
# complete base who deal with objectclass=rep
#################################
ldapsearch -b 'dc=ungi,dc=fr' "( objectclass=rep)"
version: 2
#
# filter: ( objectclass=rep)
# requesting: ALL
#
# rennes,dc=ungi,dc=fr
dn: reptitre=rennes,dc=ungi,dc=fr
objectClass: top
objectClass: rep
reptitre: rennes
# 1,dc=ungi,dc=fr
dn: pubid=1,dc=ungi,dc=fr
objectClass: top
objectClass: rep
pubid: 1
reptitre: rennes
# 2,dc=ungi,dc=fr
dn: pubid=2,dc=ungi,dc=fr
objectClass: top
objectClass: rep
objectClass: rep1
pubid: 2
reptitre: rennes/rep1
rep1titre: rennes/rep1
# 3,dc=ungi,dc=fr
dn: pubid=3,dc=ungi,dc=fr
objectClass: top
objectClass: rep
objectClass: rep1
pubid: 3
reptitre: rennes/rep1
rep1titre: rennes/rep1titre
# search result
search: 2
result: 0 Success
# numResponses: 5
# numEntries: 4