]> git.sur5r.net Git - openldap/commitdiff
Fix for slap tools replica config crash (ITS#1385)
authorKurt Zeilenga <kurt@openldap.org>
Thu, 25 Oct 2001 16:25:44 +0000 (16:25 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 25 Oct 2001 16:25:44 +0000 (16:25 +0000)
servers/slapd/config.c
servers/slapd/proto-slap.h
servers/slapd/repl.c
servers/slapd/tools/mimic.c

index 4f6b1d90394bcbbbf4e7d60aff4e26d3e49a0dd2..7187559928051b102b2eef7e833d71371e90d027 100644 (file)
@@ -953,21 +953,19 @@ read_config( const char *fname )
                                } else {
                                        for ( i = 1; i < cargc; i++ ) {
                                                if ( strncasecmp( cargv[i], "suffix=", 7 ) == 0 ) {
-                                                       char *nsuffix = ch_strdup( cargv[i] + 7 );
-                                                       if ( dn_normalize( nsuffix ) != NULL ) {
-                                                               if ( select_backend( nsuffix, 0 ) == be ) {
-                                                                       charray_add( &be->be_replica[nr]->ri_nsuffix, nsuffix );
-                                                               } else {
-                                                                       Debug( LDAP_DEBUG_ANY,
-                                                                                       "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
-                                                                                       fname, lineno, cargv[i] + 7 );
-                                                               }
-                                                       } else {
+                                                       switch ( add_replica_suffix( be, nr, cargv[i] + 7 ) ) {
+                                                       case 1:
+                                                               Debug( LDAP_DEBUG_ANY,
+                                                                               "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
+                                                                               fname, lineno, cargv[i] + 7 );
+                                                               break;
+
+                                                       case 2:
                                                                Debug( LDAP_DEBUG_ANY,
                                                                                 "%s: line %d: unable to normalize suffix in \"replica\" line (ignored)\n",
                                                                                 fname, lineno, 0 );
+                                                               break;
                                                        }
-                                                       free( nsuffix );
                                                }
                                        }
                                }
index 54f98354d3ff7da645b39c6a75b0a9e421c9efe7..d7a72c83e30efd72d8e2c6114426dbc63dabc774 100644 (file)
@@ -471,6 +471,7 @@ LDAP_SLAPD_F (char *) phonetic LDAP_P(( char *s ));
  * repl.c
  */
 LDAP_SLAPD_F (int) add_replica_info LDAP_P(( Backend *be, const char *host ));
+LDAP_SLAPD_F (int) add_replica_suffix LDAP_P(( Backend *be, int nr, const char *suffix ));
 LDAP_SLAPD_F (void) replog LDAP_P(( Backend *be, Operation *op, char *dn, void *change ));
 
 /*
index 58a271601d296b00de881a616628b3da924205c5..4c01093b52afe04e4ea62ff80d098cf1ff0fa091 100644 (file)
@@ -46,6 +46,30 @@ add_replica_info(
        return( i );
 }
 
+int
+add_replica_suffix(
+    Backend     *be,
+    int                nr,
+    const char  *suffix
+)
+{
+       char    *nsuffix = ch_strdup( suffix );
+       int     rc = 0;
+
+       if ( dn_normalize( nsuffix ) != NULL ) {
+               if ( select_backend( nsuffix, 0 ) == be ) {
+                       charray_add( &be->be_replica[nr]->ri_nsuffix, nsuffix );
+               } else {
+                       rc = 1;
+               }
+       } else {
+               rc = 2;
+       }
+       free( nsuffix );
+
+       return( rc );
+}
+
 void
 replog(
     Backend    *be,
index 30e94f3f081e9719fe77b8b7c4e7230e395f28cf..c46390abfed73ee2b97007b7c71249faf84df1ce 100644 (file)
@@ -171,5 +171,25 @@ void slap_mods_free( Modifications *ml )
 
 int add_replica_info( Backend *be, const char *host )
 {
-       return(0);
+       return 0;
+}
+
+int add_replica_suffix( Backend *be, int nr, const char *suffix )
+{
+       return 0;
+}
+
+int parse_limits( Backend *be, const char *fname, int lineno, int argc, char **argv )
+{
+       return 0;
+}
+
+int parse_limit( const char *arg, struct slap_limits_set *limit )
+{
+       return 0;
+}
+
+int get_limits( Backend *be, const char *ndn, struct slap_limits_set **limit )
+{
+       return 0;
 }