Commit 271c3232 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

Fixes ITS#1385

parent 79f76c76
......@@ -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 );
}
}
}
......
......@@ -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 ));
/*
......
......@@ -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,
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment