From: Howard Chu Date: Sun, 9 Dec 2001 14:57:42 +0000 (+0000) Subject: Converted suffixAlias to struct bervals. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~683 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fd7e23c188b9948e072aba0abc7d9f5ae56a70e2;p=openldap Converted suffixAlias to struct bervals. --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 1dfef56688..5bf2a78ec9 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -1045,11 +1045,10 @@ read_config( const char *fname ) aliased_dn = ch_strdup( cargv[2] ); (void) dn_normalize( aliased_dn ); - charray_add( &be->be_suffixAlias, alias ); - charray_add( &be->be_suffixAlias, aliased_dn ); - - free(alias); - free(aliased_dn); + ber_bvecadd( &be->be_suffixAlias, + ber_bvstr( alias ) ); + ber_bvecadd( &be->be_suffixAlias, + ber_bvstr( aliased_dn ) ); } /* set max deref depth */ diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 8de5c2e7d3..d509d068e0 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -980,7 +980,7 @@ struct slap_backend_db { /* these should be renamed from be_ to bd_ */ char **be_suffix; /* the DN suffixes of data in this backend */ struct berval **be_nsuffix; /* the normalized DN suffixes in this backend */ - char **be_suffixAlias; /* pairs of DN suffix aliases and deref values */ + struct berval **be_suffixAlias; /* pairs of DN suffix aliases and deref values */ char *be_root_dn; /* the magic "root" dn for this db */ char *be_root_ndn; /* the magic "root" normalized dn for this db */ struct berval be_root_pw; /* the magic "root" password for this db */ diff --git a/servers/slapd/suffixalias.c b/servers/slapd/suffixalias.c index 703d90ef82..7c79c16581 100644 --- a/servers/slapd/suffixalias.c +++ b/servers/slapd/suffixalias.c @@ -43,7 +43,7 @@ char *suffix_alias( be->be_suffixAlias != NULL && be->be_suffixAlias[i] != NULL; i += 2 ) { - int aliasLength = strlen (be->be_suffixAlias[i]); + int aliasLength = be->be_suffixAlias[i]->bv_len; int diff = dnLength - aliasLength; if ( diff < 0 ) { @@ -58,11 +58,11 @@ char *suffix_alias( /* XXX or an escaped separator... oh well */ } - if (!strcmp(be->be_suffixAlias[i], &dn[diff])) { + if (!strcmp(be->be_suffixAlias[i]->bv_val, &dn[diff])) { char *oldDN = dn; - dn = ch_malloc( diff + strlen(be->be_suffixAlias[i+1]) + 1 ); + dn = ch_malloc( diff + be->be_suffixAlias[i+1]->bv_len + 1 ); strncpy( dn, oldDN, diff ); - strcpy( &dn[diff], be->be_suffixAlias[i+1] ); + strcpy( &dn[diff], be->be_suffixAlias[i+1]->bv_val ); #ifdef NEW_LOGGING LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "suffix_alias: converted \"%s\" to \"%s\"\n",