mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-03 20:40:05 -05:00
ITS#10423 t is possible via cn=config to add an entry of one database type with the object class of another, causing OpenLDAP to crash
This commit is contained in:
parent
159cea0bba
commit
5b6d3f7f4b
1 changed files with 34 additions and 0 deletions
|
|
@ -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 )
|
||||
|
|
|
|||
Loading…
Reference in a new issue