mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 15:49:34 -05:00
append trailing slash to AD canonical if DN is exactly a domain (ITS#3000)
This commit is contained in:
parent
87a4c01b29
commit
df312502ac
1 changed files with 11 additions and 1 deletions
|
|
@ -3227,6 +3227,8 @@ int ldap_dn2bv_x( LDAPDN dn, struct berval *bv, unsigned flags, void *ctx )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LDAP_DN_FORMAT_AD_CANONICAL: {
|
case LDAP_DN_FORMAT_AD_CANONICAL: {
|
||||||
|
int trailing_slash = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sort of UFN for DCE DNs: a slash ('/') separated
|
* Sort of UFN for DCE DNs: a slash ('/') separated
|
||||||
* global->local DN with no types; strictly speaking,
|
* global->local DN with no types; strictly speaking,
|
||||||
|
|
@ -3251,7 +3253,7 @@ int ldap_dn2bv_x( LDAPDN dn, struct berval *bv, unsigned flags, void *ctx )
|
||||||
len += rdnl;
|
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;
|
rc = LDAP_NO_MEMORY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -3261,6 +3263,8 @@ int ldap_dn2bv_x( LDAPDN dn, struct berval *bv, unsigned flags, void *ctx )
|
||||||
for ( l = bv->bv_len; iRDN >= 0 ; iRDN-- ) {
|
for ( l = bv->bv_len; iRDN >= 0 ; iRDN-- ) {
|
||||||
ber_len_t rdnl;
|
ber_len_t rdnl;
|
||||||
|
|
||||||
|
trailing_slash = 0;
|
||||||
|
|
||||||
if ( rdn2ADstr( dn[ iRDN ], &bv->bv_val[ l ],
|
if ( rdn2ADstr( dn[ iRDN ], &bv->bv_val[ l ],
|
||||||
flags, &rdnl, 0 ) ) {
|
flags, &rdnl, 0 ) ) {
|
||||||
LDAP_FREEX( bv->bv_val, ctx );
|
LDAP_FREEX( bv->bv_val, ctx );
|
||||||
|
|
@ -3301,9 +3305,15 @@ int ldap_dn2bv_x( LDAPDN dn, struct berval *bv, unsigned flags, void *ctx )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( trailing_slash ) {
|
||||||
|
bv->bv_val[ len ] = '/';
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
|
||||||
bv->bv_len = len;
|
bv->bv_len = len;
|
||||||
bv->bv_val[ bv->bv_len ] = '\0';
|
bv->bv_val[ bv->bv_len ] = '\0';
|
||||||
|
|
||||||
|
|
||||||
rc = LDAP_SUCCESS;
|
rc = LDAP_SUCCESS;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue