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

DN handling



I'd like to see a couple of routines added to the C API
which can then be used to re-implement slapd DN routines.
This would be a good project for someone with a few spare
cycles.

ldap_str2dn( const char* string, LDAPDN **dn, unsigned flags );
ldap_dn2string( LDAPDN **dn, char **str, unsigned flags );

where string is some string representation of a DN,
LDAPDN is a struct'ural representation of the DN, and
flags indicated varies optional behaviors.

str2dn flags would indicate which base form the string is in:
LDAPv3(default), LDAPv2, DCE, etc.., as well whether to
be pedantic or not (default), etc..  dn2str flags would
indicate which output format to use: LDAPv3, LDAPv2, etc..

For a DN structure, I was thinking of something like
	typedef struct ldap_ava {
		char *description;
		BerValue *value;
		unsigned flags;
	} LDAP_AVA;
	typedef LDAP_AVA ** LDAP_RDN;
	typedef LDAP_RDN ** LDAP_DN;

The AVA flags would whether or not the value was a string
encoding (LDAP_AVA_STRING or 0x0) or a binary (BER) encoding
(LDAP_AVA_BINARY or 0x1) encoding.  This is useful for
handling of #xxxxx value forms.

By converting a string to LDAPDN and back to string, one
would produce normalized form.  To produce a true canonical
form (as needed by slapd), the application would need to be
schema aware.

I note that ldap_explode_[r]dn() could then easily be rewritten
in terms of the above routines (and deprecated).

Comments?  Takers?

Kurt