]> git.sur5r.net Git - openldap/commitdiff
Fixes ITS#1385
authorPierangelo Masarati <ando@openldap.org>
Thu, 25 Oct 2001 15:15:34 +0000 (15:15 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 25 Oct 2001 15:15:34 +0000 (15:15 +0000)
servers/slapd/config.c
servers/slapd/proto-slap.h
servers/slapd/repl.c
servers/slapd/tools/mimic.c

index fbac293f570ee10f0ac6aa25161b04fd3c496ebe..cfeb8c1bae9042b068cc727c9701affdd776cf16 100644 (file)
@@ -1691,22 +1691,21 @@ 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 {
+
+                                                       switch ( add_replica_suffix( be, nr, cargv[i] + 7 ) ) {
+                                                       case 1:
 #ifdef NEW_LOGGING
-                                                                       LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                                                                               "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
-                                                                                               fname, lineno, cargv[i] + 7 ));
+                                                               LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+                                                                               "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
+                                                                               fname, lineno, cargv[i] + 7 ));
 #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 );
+                                                               Debug( LDAP_DEBUG_ANY,
+                                                                               "%s: line %d: suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
+                                                                               fname, lineno, cargv[i] + 7 );
 #endif
-                                                               }
-                                                       } else {
+                                                               break;
+
+                                                       case 2:
 #ifdef NEW_LOGGING
                                                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
                                                                                        "%s: line %d: unable to normalize suffix in \"replica\" line (ignored)\n",
@@ -1716,8 +1715,8 @@ read_config( const char *fname )
                                                                                 "%s: line %d: unable to normalize suffix in \"replica\" line (ignored)\n",
                                                                                 fname, lineno, 0 );
 #endif
+                                                               break;
                                                        }
-                                                       free( nsuffix );
                                                }
                                        }
                                }
index 6933ab6259a549922bd4e1fbfdc8e2356847987d..fad2d895b434e8809f2a126d56624e9567ceafa6 100644 (file)
@@ -499,6 +499,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 e309d942cfc6cf958485eee50b1c2eb9717b0661..dff5b5c82bc7b741aebb3f0f16d6ba4f0b5e9e65 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 2b373f7db6599e33f3c8b389eab33d8b75540516..6783a55402d4c7f904ed2bd4e371c6e72a4f8add 100644 (file)
@@ -204,6 +204,11 @@ int add_replica_info( Backend *be, const char *host )
        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;