/* retcode.c - customizable response for client testing purposes */
-/* $Header$ */
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2005 The OpenLDAP Foundation.
static AttributeDescription *ad_errText;
static AttributeDescription *ad_errOp;
static AttributeDescription *ad_errSleepTime;
+static ObjectClass *oc_errAbsObject;
static ObjectClass *oc_errObject;
+static ObjectClass *oc_errAuxObject;
typedef enum retcode_op_e {
SN_DG_OP_NONE = 0x0000,
typedef struct retcode_cb_t {
unsigned rdc_flags;
ber_tag_t rdc_tag;
+ AttributeName *rdc_attrs;
} retcode_cb_t;
static int
int rc;
op->o_tag = rdc->rdc_tag;
+ if ( op->o_tag == LDAP_REQ_SEARCH ) {
+ rs->sr_attrs = rdc->rdc_attrs;
+ }
rc = retcode_entry_response( op, rs, rs->sr_entry );
op->o_tag = o_tag;
if ( rs->sr_err == LDAP_SUCCESS ) {
rdc->rdc_flags = SLAP_CB_CONTINUE;
+ return 0;
}
- return 0;
+ return SLAP_CB_CONTINUE;
}
static int
op2.ors_attrsonly = 0;
op2.ors_attrs = slap_anlist_all_attributes;
- ber_str2bv_x( "(objectClass=errObject)", STRLENOF( "(objectClass=errObject)" ),
+ ber_str2bv_x( "(objectClass=errAbsObject)",
+ STRLENOF( "(objectClass=errAbsObject)" ),
1, &op2.ors_filterstr, op2.o_tmpmemctx );
op2.ors_filter = str2filter_x( &op2, op2.ors_filterstr.bv_val );
op2.o_bd = &db;
rdc.rdc_flags = RETCODE_FINDIR;
+ if ( op->o_tag == LDAP_REQ_SEARCH ) {
+ rdc.rdc_attrs = op->ors_attrs;
+ }
rdc.rdc_tag = op->o_tag;
sc.sc_response = retcode_cb_response;
sc.sc_private = &rdc;
case LDAP_REQ_ADD:
return retcode_op_add( op, rs );
- case LDAP_REQ_MODIFY:
case LDAP_REQ_BIND:
+ if ( be_isroot_pw( op ) ) {
+ return SLAP_CB_CONTINUE;
+ }
+ /* fallthru */
+
+ case LDAP_REQ_MODIFY:
case LDAP_REQ_DELETE:
case LDAP_REQ_MODRDN:
case LDAP_REQ_COMPARE:
if ( rdi->rdi_ref != NULL ) {
ref = rdi->rdi_ref;
-
- } else if ( default_referral != NULL ) {
+ } else {
ref = default_referral;
}
send_ldap_result( op, rs );
if ( rs->sr_ref != NULL ) {
ber_bvarray_free( rs->sr_ref );
+ rs->sr_ref = NULL;
}
rs->sr_matched = NULL;
rs->sr_text = NULL;
return SLAP_CB_CONTINUE;
}
- if ( !is_entry_objectclass( e, oc_errObject, 0 ) ) {
+ if ( !is_entry_objectclass_or_sub( e, oc_errAbsObject ) ) {
return SLAP_CB_CONTINUE;
}
fprintf( stderr, "%s: line %d: retcode: "
"\"retcode-item <RDN> <retcode> [<text>]\": "
"missing args\n",
- fname, lineno, argv[ 1 ] );
+ fname, lineno );
return 1;
}
char *desc;
ObjectClass **oc;
} retcode_oc[] = {
- { "errObject", "( 1.3.6.1.4.1.4203.666.11.4.3.1 "
- "NAME ( 'errObject' ) "
- "SUP top STRUCTURAL "
+ { "errAbsObject", "( 1.3.6.1.4.1.4203.666.11.4.3.0 "
+ "NAME ( 'errAbsObject' ) "
+ "SUP top ABSTRACT "
"MUST ( errCode ) "
"MAY ( "
"cn "
"$ errText "
"$ errSleepTime "
") )",
+ &oc_errAbsObject },
+ { "errObject", "( 1.3.6.1.4.1.4203.666.11.4.3.1 "
+ "NAME ( 'errObject' ) "
+ "SUP errAbsObject STRUCTURAL "
+ ")",
&oc_errObject },
+ { "errAuxObject", "( 1.3.6.1.4.1.4203.666.11.4.3.2 "
+ "NAME ( 'errAuxObject' ) "
+ "SUP errAbsObject AUXILIARY "
+ ")",
+ &oc_errAuxObject },
{ NULL }
};