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

Re: How to check if attribute exists?



"Wald, Matthias" wrote:

> Is there a direkt way to check if an entry has a specific attribute (for
> example
> cACertificate or userCertificate) and not via search and get attribute?

Yes: use a filter of '(cACertificate=*)' and do not require attribute
retrieval;
e.g., with the C API:


    char *attrs[] = { LDAP_NO_ATTRS, NULL };
    ldap_search(ld, NULL, LDAP_SCOPE_SUBTREE, '(cACertificate=*)', attrs, 1);

retrieves all the entries that have the attribute cACertificate, but no
values.
Note: LDAP_NO_ATTRS="1.1" as per draft-ietf-ldapext-ldap-c-api-xx.txt
It is defined in ldap.h.

Pierangelo Masarati.

--
Dr. Pierangelo Masarati               | voice: +39 02 2399 8365
Dip. Ing. Aerospaziale                | fax:   +39 02 2399 8334
Politecnico di Milano                 | mailto:masarati@aero.polimi.it
via La Masa 34, 20156 Milano, Italy   | http://www.aero.polimi.it/~masarati