]> git.sur5r.net Git - openldap/commitdiff
Add parsing for manageDIT control.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 13 May 2005 08:22:08 +0000 (08:22 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 13 May 2005 08:22:08 +0000 (08:22 +0000)
servers/slapd/controls.c
servers/slapd/slap.h

index 252912b22f8f22cd82332ff3fbc8dee769f73125..e44ad67c941803f622eb45b7647b2e115fb74002 100644 (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,
index 16ed4a632c3f3a3cb8de87554982adb68cf1376c..474c446073b0fd97d842f71db8531f320a48e457 100644 (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)