]> git.sur5r.net Git - openldap/commitdiff
honors multiple type/value in rdn when generating ufn
authorPierangelo Masarati <ando@openldap.org>
Wed, 11 Jul 2001 20:16:25 +0000 (20:16 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 11 Jul 2001 20:16:25 +0000 (20:16 +0000)
libraries/libldap/getdn.c

index e81b9412be864e18408edd441b3833bb425c2c70..90be4755534525cfc2b9bc2339ab95e80851fc29 100644 (file)
@@ -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 );