[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: search for DN (Filter)
On 9/20/06, Moire <sec@shee.org> wrote:sec@shee.org> wrote:
>> Maybe a silly question:
>>
>> Is it possible to search for a spezific DN?
>>
>> Lets say, this is my entry:
>>
>> cn=Michael Voss,ou=Eng,o=Firm,dc=domain,dc=org
>>
>> and i want to look direcly for it
>>
>> ldapsearch -x "(dn=cn=Michael Voss,ou=Eng,o=Firm,dc=domain,dc=org)"
>>
>> or similar.
Am 20.09.2006 um 17:50 schrieb Ramzi Tka:
> yes it is possible just correct the syntax using &
i am not sure how to correct. Could you please give an example.
Am 21.09.2006 um 07:38 schrieb Ramzi Tka:
hi,
For example to say that cn must be Michael Voss and ou equal to Eng
you can use
ldapsearch -x '(&(cn=Michael Voss)(ou=Eng))
I have also verified you can use a complete DN this way
ldapsearch -x '(cn=Michael Voss,ou=Eng,o=Firm,dc=domain,dc=org)' ==>
just suppress "dn=" from your line of commands.
Hello, first thanks for your tips.
Of course i can search for attributes inside the entry.
But this search
ldapsearch -x '(&(cn=Michael Voss)(ou=Eng))
could also found an entry under (lets say):
(cn=Michael Voss,ou=Eng,o=Another Firm,dc=domain,dc=org)
not only
(cn=Michael Voss,ou=Eng,o=Firm,dc=domain,dc=org)
Therefor i want to search with the uniq DN:
Your second example dont work for me:
Here my cmd results:
Thats my entry:
ldapsearch -x "(cn=My*)"
# extended LDIF
dn: cn=MyGivenname MySurname,ou=Privat,dc=Adressen,dc=afm
objectClass: top
objectClass: inetOrgPerson
objectClass: person
objectClass: organizationalPerson
objectClass: pilotPerson
displayName: MyGivennameMySurname
givenName: MyGivenname
ou: Sciences
personalTitle:: TXIuIA==
telephoneNumber: +00000000000
description: et cetera
sn: MySurname
cn: MyGivenname MySurname
labeledURI: http://www.void.org
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
now i try to search with DN:
ldapsearch -x "(cn=MyGivenname MySurname,ou=Privat,dc=Adressen,dc=afm)"
# extended LDIF
#
# LDAPv3
# base <> with scope sub
# filter: (cn=MyGivenname MySurname,ou=Privat,dc=Adressen,dc=afm)
# requesting: ALL
#
# search result
search: 2
result: 0 Success
# numResponses: 1
Am 20.09.2006 um 19:19 schrieb Darko Delinac:
Limit the search scope to base (-s base) and as a base use the DN,
something like this:
ldapsearch -x -h my_ldap_server -b "cn=Michael
Voss,ou=Eng,o=Firm,dc=domain,dc=org" -s base
Also Delinac's suggestion would found not just one
entry if there are some childs ...
ldapsearch -x -b "cn=MyGivenname MySurname,ou=Privat,dc=Adressen,dc=afm"
# extended LDIF
#
# LDAPv3
# base <cn=MyGivenname MySurname,ou=Privat,dc=Adressen,dc=afm> with
scope sub
# filter: (objectclass=*)
# requesting: ALL
#
# MyGivenname MySurname, Privat, Adressen.afm
dn: cn=MyGivenname MySurname,ou=Privat,dc=Adressen,dc=afm
objectClass: top
objectClass: inetOrgPerson
objectClass: person
objectClass: organizationalPerson
objectClass: pilotPerson
displayName: MyGivennameMySurname
givenName: MyGivenname
ou: Sciences
personalTitle:: TXIuIA==
telephoneNumber: +00000000000
description: et cetera
sn: MySurname
cn: MyGivenname MySurname
labeledURI: http://www.void.org
# test, MyGivenname MySurname, Privat, Adressen.afm
dn: ou=test,cn=MyGivenname MySurname,ou=Privat,dc=Adressen,dc=afm
objectClass: top
objectClass: inetOrgPerson
objectClass: person
objectClass: organizationalPerson
objectClass: pilotPerson
sn: testchild
cn: testchild
# search result
search: 2
result: 0 Success
# numResponses: 3
# numEntries: 2
Thanks
Moire