Add parsing for manageDIT control.

This commit is contained in:
Kurt Zeilenga 2005-05-13 08:22:08 +00:00
parent 2544a320b9
commit d1143204b2
2 changed files with 31 additions and 0 deletions

View File

@ -28,6 +28,7 @@ static SLAP_CTRL_PARSE_FN parseAssert;
static SLAP_CTRL_PARSE_FN parsePreRead;
static SLAP_CTRL_PARSE_FN parsePostRead;
static SLAP_CTRL_PARSE_FN parseProxyAuthz;
static SLAP_CTRL_PARSE_FN parseManageDIT;
static SLAP_CTRL_PARSE_FN parseManageDSAit;
static SLAP_CTRL_PARSE_FN parseModifyIncrement;
static SLAP_CTRL_PARSE_FN parseNoOp;
@ -161,6 +162,10 @@ static struct slap_control control_defs[] = {
SLAP_CTRL_HIDE|SLAP_CTRL_MODIFY, NULL,
parseModifyIncrement, LDAP_SLIST_ENTRY_INITIALIZER(next) },
#endif
{ LDAP_CONTROL_MANAGEDIT,
(int)offsetof(struct slap_control_ids, sc_manageDIT),
SLAP_CTRL_ACCESS, NULL,
parseManageDIT, LDAP_SLIST_ENTRY_INITIALIZER(next) },
{ LDAP_CONTROL_MANAGEDSAIT,
(int)offsetof(struct slap_control_ids, sc_manageDSAit),
SLAP_CTRL_ACCESS, NULL,
@ -710,6 +715,28 @@ static int parseModifyIncrement (
return LDAP_SUCCESS;
}
static int parseManageDIT (
Operation *op,
SlapReply *rs,
LDAPControl *ctrl )
{
if ( op->o_managedit != SLAP_CONTROL_NONE ) {
rs->sr_text = "manageDIT control specified multiple times";
return LDAP_PROTOCOL_ERROR;
}
if ( ctrl->ldctl_value.bv_len ) {
rs->sr_text = "manageDIT control value not empty";
return LDAP_PROTOCOL_ERROR;
}
op->o_managedit = ctrl->ldctl_iscritical
? SLAP_CONTROL_CRITICAL
: SLAP_CONTROL_NONCRITICAL;
return LDAP_SUCCESS;
}
static int parseManageDSAit (
Operation *op,
SlapReply *rs,

View File

@ -2208,6 +2208,7 @@ struct slap_control_ids {
int sc_preRead;
int sc_postRead;
int sc_proxyAuthz;
int sc_manageDIT;
int sc_manageDSAit;
int sc_modifyIncrement;
int sc_noOp;
@ -2369,6 +2370,9 @@ typedef struct slap_op {
char o_ctrlflag[SLAP_MAX_CIDS]; /* per-control flags */
void **o_controls; /* per-control state */
#define o_managedit o_ctrlflag[slap_cids.sc_manageDIT]
#define get_manageDIT(op) _SCM((op)->o_managedit)
#define o_managedsait o_ctrlflag[slap_cids.sc_manageDSAit]
#define get_manageDSAit(op) _SCM((op)->o_managedsait)