I'm trying to search an LDAP for an object of a specific class, but it always returns
result: 32 No such object
Background:
I'm trying to access a PGP Universal server at keyserver.pgp.com which is a PGP server with LDAP access. It has an object of class pgpServerInfo that holds some informatione about how the PGP keys can be retrieved.
I am not well versed with LDAP, so my approach may be completely wrong.
This is what I tried:
ldapsearch -v -x -H ldap://keyserver.pgp.com "(objectclass=pgpServerInfo)"
I've also tried to add -s base
and -s one
, but no difference.
This works:
ldapsearch -v -x -b "cn=PGPServerInfo" -H ldap://keyserver.pgp.com "(objectClass=pgpServerInfo)"
But by doing so, I have to assume the object's name which I would like to avoid.
What's the correct query to find the object?
答案1
If you want to avoid assuming a base name you can try the following:
ldapsearch -v -x -s base -H ldap://keyserver.pgp.com "(objectclass=*)" +
Note the +
in the search. This will list "operational attributes".
This should provide you with a bunch of information including a number of "namingContexts". You can then choose the namingContexts until you get which one you're looking for.