From 93923d43454885e7a31447c8dc6695335cb48aa5 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 11 Jul 2001 20:16:25 +0000 Subject: [PATCH] honors multiple type/value in rdn when generating ufn --- libraries/libldap/getdn.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index e81b9412be..90be475553 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -56,6 +56,7 @@ ldap_dn2ufn( LDAP_CONST char *dn ) { char *ufn; char **vals; + int i; Debug( LDAP_DEBUG_TRACE, "ldap_dn2ufn\n", 0, 0, 0 ); @@ -65,11 +66,25 @@ ldap_dn2ufn( LDAP_CONST char *dn ) return NULL; } - vals = ldap_explode_dn( dn , 1 ); + vals = ldap_explode_dn( dn , 0 ); if( vals == NULL ) { return NULL; } + for ( i = 0; vals[i]; i++ ) { + char **rvals; + + rvals = ldap_explode_rdn( vals[i] , 1 ); + if ( rvals == NULL ) { + LDAP_VFREE( vals ); + return NULL; + } + + LDAP_FREE( vals[i] ); + vals[i] = ldap_charray2str( rvals, " + " ); + LDAP_VFREE( rvals ); + } + ufn = ldap_charray2str( vals, ", " ); LDAP_VFREE( vals ); -- 2.39.5