olcDatabase=config always gets index 0,

don't allow multiple olcDatabase=config entries (ITS#4914)
This commit is contained in:
Ralf Haferkamp 2007-04-05 16:12:24 +00:00
parent 75e1f0ef68
commit d06a8bd198

View File

@ -3958,7 +3958,7 @@ check_name_index( CfEntryInfo *parent, ConfigType ce_type, Entry *e,
{
CfEntryInfo *ce;
int index = -1, gotindex = 0, nsibs, rc = 0;
int renumber = 0, tailindex = 0, isfrontend = 0;
int renumber = 0, tailindex = 0, isfrontend = 0, isconfig = 0;
char *ptr1, *ptr2 = NULL;
struct berval rdn;
@ -3973,9 +3973,14 @@ check_name_index( CfEntryInfo *parent, ConfigType ce_type, Entry *e,
/* See if the rdn has an index already */
dnRdn( &e->e_name, &rdn );
if ( ce_type == Cft_Database && !strncmp( rdn.bv_val + rdn.bv_len -
STRLENOF("frontend"), "frontend", STRLENOF("frontend") ))
isfrontend = 1;
if ( ce_type == Cft_Database ) {
if ( !strncmp( rdn.bv_val + rdn.bv_len - STRLENOF("frontend"),
"frontend", STRLENOF("frontend") ))
isfrontend = 1;
else if ( !strncmp( rdn.bv_val + rdn.bv_len - STRLENOF("config"),
"config", STRLENOF("config") ))
isconfig = 1;
}
ptr1 = ber_bvchr( &e->e_name, '{' );
if ( ptr1 && ptr1 - e->e_name.bv_val < rdn.bv_len ) {
char *next;
@ -3994,6 +3999,9 @@ check_name_index( CfEntryInfo *parent, ConfigType ce_type, Entry *e,
if ( index != -1 || !isfrontend )
return LDAP_NAMING_VIOLATION;
}
if ( isconfig && index != 0 ){
return LDAP_NAMING_VIOLATION;
}
}
/* count related kids */
@ -4014,6 +4022,10 @@ check_name_index( CfEntryInfo *parent, ConfigType ce_type, Entry *e,
renumber = 1;
}
}
/* config DB is always "0" */
if ( isconfig && index == -1 ) {
index = 0;
}
if ( !isfrontend && index == -1 ) {
index = nsibs;
}