I'm the maintainer of nss_ldapd [1] which is a replacement for nss_ldap. I have been trying to get rid of using deprecated functions while compiling with OpenLDAP 2.4.7.
One of the changes I made was using ldap_str2dn() instead of ldap_explode_dn() and ldap_explode_rdn() to parse the DN of entries returned. However, I ran into the following.
The relevant definitions for ldap_str2dn() in OpenLDAP 2.4.7 are:
typedef struct ldap_ava { [...] } LDAPAVA; typedef LDAPAVA** LDAPRDN; typedef LDAPRDN* LDAPDN; LDAP_F( int ) ldap_str2dn LDAP_P(( LDAP_CONST char *str, LDAPDN *dn, unsigned flags ));
While OpenLDAP 2.1.30 (another version I would like to support) there is:
typedef struct ldap_ava { [...] } LDAPAVA; typedef LDAPAVA** LDAPRDN; typedef LDAPRDN** LDAPDN; LDAP_F( int ) ldap_str2dn LDAP_P(( LDAP_CONST char *str, LDAPDN **dn, unsigned flags ));
This changes the second parameter from struct ldap_ava ******dn to struct ldap_****dn.
What is the best way to use lpap_str2dn() and still be able to compile (and run correctly because it is only a warning with most compilers) with both versions of OpenLDAP? Or would it be better to avoid the function completely?
Thanks.
[1] http://ch.tudelft.nl/~arthur/nss-ldapd/