mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-20 05:43:01 -05:00
don't let back-monitor appear __after__ a database that hides it; currently, only <suffix ""> :-( ; make error messages more descriptive
This commit is contained in:
parent
b86467e0f8
commit
9baa6f4c99
2 changed files with 33 additions and 11 deletions
|
|
@ -1380,8 +1380,10 @@ monitor_back_db_init(
|
|||
BackendDB *be )
|
||||
{
|
||||
int rc;
|
||||
struct berval dn, ndn;
|
||||
struct berval bv;
|
||||
struct berval dn = BER_BVC( SLAPD_MONITOR_DN ),
|
||||
pdn,
|
||||
ndn;
|
||||
BackendDB *be2;
|
||||
|
||||
/*
|
||||
* database monitor can be defined once only
|
||||
|
|
@ -1396,19 +1398,15 @@ monitor_back_db_init(
|
|||
/* indicate system schema supported */
|
||||
SLAP_BFLAGS(be) |= SLAP_BFLAG_MONITOR;
|
||||
|
||||
dn.bv_val = SLAPD_MONITOR_DN;
|
||||
dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1;
|
||||
|
||||
rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL );
|
||||
rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn, NULL );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"unable to normalize monitor DN \"%s\" (%d)\n",
|
||||
"unable to normalize/pretty monitor DN \"%s\" (%d)\n",
|
||||
dn.bv_val, rc, 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
ber_dupbv( &bv, &dn );
|
||||
ber_bvarray_add( &be->be_suffix, &bv );
|
||||
ber_bvarray_add( &be->be_suffix, &pdn );
|
||||
ber_bvarray_add( &be->be_nsuffix, &ndn );
|
||||
|
||||
/* NOTE: only one monitor database is allowed,
|
||||
|
|
@ -1417,6 +1415,22 @@ monitor_back_db_init(
|
|||
|
||||
be->be_private = &monitor_info;
|
||||
|
||||
be2 = select_backend( &ndn, 0, 0 );
|
||||
if ( be2 != be ) {
|
||||
char *type = be2->bd_info->bi_type;
|
||||
|
||||
if ( overlay_is_over( be2 ) ) {
|
||||
slap_overinfo *oi = (slap_overinfo *)be2->bd_info->bi_private;
|
||||
type = oi->oi_orig->bi_type;
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"\"monitor\" database serving namingContext \"%s\" "
|
||||
"is hidden by \"%s\" database serving namingContext \"%s\".\n",
|
||||
pdn.bv_val, type, be2->be_nsuffix[ 0 ].bv_val );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1663,8 +1663,16 @@ config_suffix(ConfigArgs *c)
|
|||
free(pdn.bv_val);
|
||||
free(ndn.bv_val);
|
||||
} else if(tbe) {
|
||||
sprintf( c->msg, "<%s> suffix already served by a preceding backend",
|
||||
c->argv[0] );
|
||||
char *type = tbe->bd_info->bi_type;
|
||||
|
||||
if ( overlay_is_over( tbe ) ) {
|
||||
slap_overinfo *oi = (slap_overinfo *)tbe->bd_info->bi_private;
|
||||
type = oi->oi_orig->bi_type;
|
||||
}
|
||||
|
||||
sprintf( c->msg, "<%s> namingContext \"%s\" already served by "
|
||||
"a preceding %s database serving namingContext",
|
||||
c->argv[0], pdn.bv_val, type );
|
||||
Debug(LDAP_DEBUG_ANY, "%s: %s \"%s\"\n",
|
||||
c->log, c->msg, tbe->be_suffix[0].bv_val);
|
||||
free(pdn.bv_val);
|
||||
|
|
|
|||
Loading…
Reference in a new issue