Commit 699a0929 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

More dn_normalize -> dnNormalize changes

parent 27f42bba
...@@ -219,9 +219,12 @@ static char* get_alias_dn( ...@@ -219,9 +219,12 @@ static char* get_alias_dn(
int *err, int *err,
const char **errmsg ) const char **errmsg )
{ {
int rc;
char *dn; char *dn;
struct berval *ndn = NULL;
Attribute *a; Attribute *a;
AttributeDescription *aliasedObjectName = slap_schema.si_ad_aliasedObjectName; AttributeDescription *aliasedObjectName
= slap_schema.si_ad_aliasedObjectName;
a = attr_find( e->e_attrs, aliasedObjectName ); a = attr_find( e->e_attrs, aliasedObjectName );
...@@ -252,15 +255,15 @@ static char* get_alias_dn( ...@@ -252,15 +255,15 @@ static char* get_alias_dn(
return NULL; return NULL;
} }
dn = ch_strdup( a->a_vals[0]->bv_val ); rc = dnNormalize( NULL, a->a_vals[0], &ndn );
if( rc != LDAP_SUCCESS ) {
if( dn_normalize(dn) == NULL ) {
ch_free( dn );
*err = LDAP_ALIAS_PROBLEM; *err = LDAP_ALIAS_PROBLEM;
*errmsg = "alias aliasedObjectName value is invalid"; *errmsg = "alias aliasedObjectName value is invalid";
return NULL; return NULL;
} }
dn = ndn->bv_val;
free( ndn );
return dn; return dn;
} }
......
...@@ -574,16 +574,22 @@ cache_find_entry_dn2id( ...@@ -574,16 +574,22 @@ cache_find_entry_dn2id(
const char *dn const char *dn
) )
{ {
char *ndn; int rc;
ID id; struct berval bv;
struct berval *ndn = NULL;
ID id;
ndn = ch_strdup( dn ); bv.bv_val = dn;
(void) dn_normalize( ndn ); bv.bv_len = strlen( dn );
id = cache_find_entry_ndn2id( be, cache, ndn ); rc = dnNormalize( NULL, &bv, &ndn );
if( rc != LDAP_SUCCESS ) {
return NOID;
}
free( ndn ); id = cache_find_entry_ndn2id( be, cache, ndn->bv_val );
ber_bvfree( ndn );
return ( id ); return ( id );
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment