From d1143204b2b0d19069ca2295fc85d8d1f7cbf4b0 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 13 May 2005 08:22:08 +0000 Subject: [PATCH] Add parsing for manageDIT control. --- servers/slapd/controls.c | 27 +++++++++++++++++++++++++++ servers/slapd/slap.h | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 252912b22f..e44ad67c94 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -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, diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 16ed4a632c..474c446073 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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) -- 2.39.5