break;
case LDAP_DN_FORMAT_AD_CANONICAL: {
+ int trailing_slash = 1;
+
/*
* Sort of UFN for DCE DNs: a slash ('/') separated
* global->local DN with no types; strictly speaking,
len += rdnl;
}
- if ( ( bv->bv_val = LDAP_MALLOCX( len + 1, ctx ) ) == NULL ) {
+ if ( ( bv->bv_val = LDAP_MALLOCX( len + 2, ctx ) ) == NULL ) {
rc = LDAP_NO_MEMORY;
break;
}
if ( iRDN && dn2domain( dn, bv, 0, &iRDN ) != 0 ) {
for ( l = bv->bv_len; iRDN >= 0 ; iRDN-- ) {
ber_len_t rdnl;
+
+ trailing_slash = 0;
if ( rdn2ADstr( dn[ iRDN ], &bv->bv_val[ l ],
flags, &rdnl, 0 ) ) {
}
}
+ if ( trailing_slash ) {
+ bv->bv_val[ len ] = '/';
+ len++;
+ }
+
bv->bv_len = len;
bv->bv_val[ bv->bv_len ] = '\0';
+
rc = LDAP_SUCCESS;
} break;