]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/controls.c
fix ITS#3753
[openldap] / servers / slapd / controls.c
index 26f88654f80c2678cf9c92852660f49225e6cf11..7360e06fcb7fb0dca7440aaeee86fd8442f3ccf7 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_GLOBAL|SLAP_CTRL_UPDATE, NULL,
+               parseManageDIT, LDAP_SLIST_ENTRY_INITIALIZER(next) },
        { LDAP_CONTROL_MANAGEDSAIT,
                (int)offsetof(struct slap_control_ids, sc_manageDSAit),
                SLAP_CTRL_ACCESS, NULL,
@@ -405,8 +410,8 @@ slap_global_control( Operation *op, const char *oid, int *cid )
        if ( cid ) *cid = ctrl->sc_cid;
 
        if ( ( ctrl->sc_mask & SLAP_CTRL_GLOBAL ) ||
-                       ( ( op->o_tag & LDAP_REQ_SEARCH ) &&
-                       ( ctrl->sc_mask & SLAP_CTRL_GLOBAL_SEARCH ) ) )
+               ( ( op->o_tag & LDAP_REQ_SEARCH ) &&
+               ( ctrl->sc_mask & SLAP_CTRL_GLOBAL_SEARCH ) ) )
        {
                return LDAP_COMPARE_TRUE;
        }
@@ -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,
@@ -1236,7 +1263,7 @@ static int parseSubentries (
                ? SLAP_CONTROL_CRITICAL
                : SLAP_CONTROL_NONCRITICAL;
 
-       if ( (void *)(ctrl->ldctl_value.bv_val[2] != 0x00)) {
+       if (ctrl->ldctl_value.bv_val[2]) {
                set_subentries_visibility( op );
        }