From 699a092967cf78afae46904dfe19e1bd8e178845 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 28 Dec 2001 07:41:52 +0000 Subject: [PATCH] More dn_normalize -> dnNormalize changes --- servers/slapd/back-ldbm/alias.c | 13 ++++++++----- servers/slapd/back-ldbm/cache.c | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/servers/slapd/back-ldbm/alias.c b/servers/slapd/back-ldbm/alias.c index e78fb6c537..36ae6869e2 100644 --- a/servers/slapd/back-ldbm/alias.c +++ b/servers/slapd/back-ldbm/alias.c @@ -219,9 +219,12 @@ static char* get_alias_dn( int *err, const char **errmsg ) { + int rc; char *dn; + struct berval *ndn = NULL; Attribute *a; - AttributeDescription *aliasedObjectName = slap_schema.si_ad_aliasedObjectName; + AttributeDescription *aliasedObjectName + = slap_schema.si_ad_aliasedObjectName; a = attr_find( e->e_attrs, aliasedObjectName ); @@ -252,15 +255,15 @@ static char* get_alias_dn( return NULL; } - dn = ch_strdup( a->a_vals[0]->bv_val ); - - if( dn_normalize(dn) == NULL ) { - ch_free( dn ); + rc = dnNormalize( NULL, a->a_vals[0], &ndn ); + if( rc != LDAP_SUCCESS ) { *err = LDAP_ALIAS_PROBLEM; *errmsg = "alias aliasedObjectName value is invalid"; return NULL; } + dn = ndn->bv_val; + free( ndn ); return dn; } diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index d9a7c65149..3f03c66081 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -574,16 +574,22 @@ cache_find_entry_dn2id( const char *dn ) { - char *ndn; - ID id; + int rc; + struct berval bv; + struct berval *ndn = NULL; + ID id; - ndn = ch_strdup( dn ); - (void) dn_normalize( ndn ); + bv.bv_val = dn; + 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 ); } -- 2.39.5