[Date Prev][Date Next]
Re: Can I get objectclass schema info from the API?
> Is there a way to programmatically request through the API the required
> attribute types for a new entry creation given the objectclass?
> ie. Given that I wish to create a new entry of objectclass="inetorgperson" I
> know that I need to create both the "cn" and "sn" entries.
> However, let's say that I didn't know but wished to discover this
> programmatically on the fly.
> Is this possible?
Have a look at libraries/libldap/schema.c; you'll find a bunch of routines:
ldap_str2syntax, ldap_str2matchingrule, ldap_str2attributetype,
ldap_str2objectclass and so on, with the corresponding *_free stuff.
You can use them to parse the results of searching the schema from
a server. You'll need to get the attributes in an objectClass and,
for each attributeType, the related syntaxes to ensure you're appropriately
handling the values.
They're documented in doc/man/man3/ldap_schema.3 (in the HEAD code,