Merge branch 'its10423' into 'master'

Draft: ITS#10423 It is possible via cn=config to add an entry of one database type...

See merge request openldap/openldap!825
This commit is contained in:
Nadezhda Ivanova 2026-02-11 16:20:31 +00:00
commit f415975caf

View file

@ -1147,6 +1147,36 @@ config_copy_controls( Operation *op, SlapReply *rs )
static int
config_unique_db;
static int
CfOc_cmp( const void *c1, const void *c2 );
static int
config_check_db_class(ConfigArgs *c) {
Entry *e;
Attribute *oc_at;
ObjectClass *oc;
BackendInfo *bi;
ConfigOCs co, *bi_ocs, *coptr;
if (!c->ca_op) {
return 0;
}
if ((bi = backend_info(c->argv[1])) == NULL) {
return 0;
}
e = c->ca_op->ora_e;
/* should be present or merged at this point */
if ((oc_at = attr_find( e->e_attrs, slap_schema.si_ad_objectClass )) == NULL)
return 0;
if ( (oc = oc_bvfind( &oc_at->a_nvals[oc_at->a_numvals-1])) == NULL )
return 0;
co.co_name = &oc->soc_cname;
if ((coptr = ldap_avl_find( CfOcTree, &co, CfOc_cmp )) == NULL)
return 0;
bi_ocs = bi->bi_cf_ocs;
if ( coptr != bi_ocs )
return -1;
return 0;
}
static int
config_generic(ConfigArgs *c) {
int i;
@ -1939,6 +1969,10 @@ config_generic(ConfigArgs *c) {
c->be = frontendDB;
config_unique_db |= GOT_FRONTEND;
} else {
if (config_check_db_class(c) != 0) {
sprintf( c->cr_msg, "Entry object class is inconsistent with backend type");
return (1);
}
c->be = backend_db_init(c->argv[1], NULL, c->valx, &c->reply);
if ( !c->be ) {
if ( c->cr_msg[0] == 0 )