]> git.sur5r.net Git - openldap/commitdiff
Converted suffixAlias to struct bervals.
authorHoward Chu <hyc@openldap.org>
Sun, 9 Dec 2001 14:57:42 +0000 (14:57 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 9 Dec 2001 14:57:42 +0000 (14:57 +0000)
servers/slapd/config.c
servers/slapd/slap.h
servers/slapd/suffixalias.c

index 1dfef56688a6087e523f0b1f9298fe8e3a4ee854..5bf2a78ec9a7d6b48f13b0c0b0ae51ad25868e9f 100644 (file)
@@ -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 */
index 8de5c2e7d3d391e3df5e0b40460e745382cb1502..d509d068e0b42a12fca8b221dd676398194cfdc4 100644 (file)
@@ -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        */
index 703d90ef8275330cbe983de12e90f2959cb160e5..7c79c16581448dac1c948202c67f003c7e61e876 100644 (file)
@@ -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",