cleanup objectclass inheritance; don't proceed if initial lookup resulted in a hit with "success" errcode and the base is search; either the filter doesn't match, or the same action is taken twice

This commit is contained in:
Pierangelo Masarati 2005-08-20 18:00:40 +00:00
parent 3dd05cdb2d
commit 6bae592866

View File

@ -39,6 +39,7 @@ static AttributeDescription *ad_errCode;
static AttributeDescription *ad_errText; static AttributeDescription *ad_errText;
static AttributeDescription *ad_errOp; static AttributeDescription *ad_errOp;
static AttributeDescription *ad_errSleepTime; static AttributeDescription *ad_errSleepTime;
static ObjectClass *oc_errAbsObject;
static ObjectClass *oc_errObject; static ObjectClass *oc_errObject;
static ObjectClass *oc_errAuxObject; static ObjectClass *oc_errAuxObject;
@ -79,6 +80,7 @@ typedef struct retcode_t {
unsigned rd_flags; unsigned rd_flags;
#define RETCODE_FNONE 0x00 #define RETCODE_FNONE 0x00
#define RETCODE_FINDIR 0x01 #define RETCODE_FINDIR 0x01
#define RETCODE_FSTOP 0x02
#define RETCODE_INDIR( rd ) ( (rd)->rd_flags & RETCODE_FINDIR ) #define RETCODE_INDIR( rd ) ( (rd)->rd_flags & RETCODE_FINDIR )
} retcode_t; } retcode_t;
@ -183,7 +185,9 @@ retcode_cb_response( Operation *op, SlapReply *rs )
} }
if ( rs->sr_err == LDAP_SUCCESS ) { if ( rs->sr_err == LDAP_SUCCESS ) {
rdc->rdc_flags = SLAP_CB_CONTINUE; if ( ! ( rdc->rdc_flags & RETCODE_FSTOP ) ) {
rdc->rdc_flags = SLAP_CB_CONTINUE;
}
return 0; return 0;
} }
@ -212,8 +216,8 @@ retcode_op_internal( Operation *op, SlapReply *rs )
op2.ors_attrsonly = 0; op2.ors_attrsonly = 0;
op2.ors_attrs = slap_anlist_all_attributes; op2.ors_attrs = slap_anlist_all_attributes;
ber_str2bv_x( "(|(objectClass=errObject)(objectClass=errAuxObject))", ber_str2bv_x( "(objectClass=errAbsObject)",
STRLENOF( "(|(objectClass=errObject)(objectClass=errAuxObject))" ), STRLENOF( "(objectClass=errAbsObject)" ),
1, &op2.ors_filterstr, op2.o_tmpmemctx ); 1, &op2.ors_filterstr, op2.o_tmpmemctx );
op2.ors_filter = str2filter_x( &op2, op2.ors_filterstr.bv_val ); op2.ors_filter = str2filter_x( &op2, op2.ors_filterstr.bv_val );
@ -221,6 +225,9 @@ retcode_op_internal( Operation *op, SlapReply *rs )
op2.o_bd = &db; op2.o_bd = &db;
rdc.rdc_flags = RETCODE_FINDIR; rdc.rdc_flags = RETCODE_FINDIR;
if ( op->o_tag == LDAP_REQ_SEARCH && op->ors_scope == LDAP_SCOPE_BASE ) {
rdc.rdc_flags |= RETCODE_FSTOP;
}
rdc.rdc_tag = op->o_tag; rdc.rdc_tag = op->o_tag;
sc.sc_response = retcode_cb_response; sc.sc_response = retcode_cb_response;
sc.sc_private = &rdc; sc.sc_private = &rdc;
@ -450,8 +457,7 @@ retcode_entry_response( Operation *op, SlapReply *rs, Entry *e )
return SLAP_CB_CONTINUE; return SLAP_CB_CONTINUE;
} }
if ( !is_entry_objectclass( e, oc_errObject, 0 ) if ( !is_entry_objectclass( e, oc_errAbsObject, 0 ) ) {
&& !is_entry_objectclass( e, oc_errAuxObject, 0 ) ) {
return SLAP_CB_CONTINUE; return SLAP_CB_CONTINUE;
} }
@ -1028,9 +1034,9 @@ retcode_init( void )
char *desc; char *desc;
ObjectClass **oc; ObjectClass **oc;
} retcode_oc[] = { } retcode_oc[] = {
{ "errObject", "( 1.3.6.1.4.1.4203.666.11.4.3.1 " { "errAbsObject", "( 1.3.6.1.4.1.4203.666.11.4.3.0 "
"NAME ( 'errObject' ) " "NAME ( 'errAbsObject' ) "
"SUP top STRUCTURAL " "SUP top ABSTRACT "
"MUST ( errCode ) " "MUST ( errCode ) "
"MAY ( " "MAY ( "
"cn " "cn "
@ -1039,18 +1045,16 @@ retcode_init( void )
"$ errText " "$ errText "
"$ errSleepTime " "$ errSleepTime "
") )", ") )",
&oc_errAbsObject },
{ "errObject", "( 1.3.6.1.4.1.4203.666.11.4.3.1 "
"NAME ( 'errObject' ) "
"SUP errAbsObject STRUCTURAL "
")",
&oc_errObject }, &oc_errObject },
{ "errAuxObject", "( 1.3.6.1.4.1.4203.666.11.4.3.2 " { "errAuxObject", "( 1.3.6.1.4.1.4203.666.11.4.3.2 "
"NAME ( 'errAuxObject' ) " "NAME ( 'errAuxObject' ) "
"SUP top AUXILIARY " "SUP errAbsObject AUXILIARY "
"MUST ( errCode ) " ")",
"MAY ( "
"cn "
"$ description "
"$ errOp "
"$ errText "
"$ errSleepTime "
") )",
&oc_errAuxObject }, &oc_errAuxObject },
{ NULL } { NULL }
}; };