]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/controls.c
Sync with HEAD
[openldap] / servers / slapd / controls.c
index 27fe43f1c6161453fbaa8d452283f29f7b05a917..5699329c6efa64eb0c135f62086310cff94d8831 100644 (file)
@@ -28,6 +28,9 @@ static SLAP_CTRL_PARSE_FN parseAssert;
 static SLAP_CTRL_PARSE_FN parsePreRead;
 static SLAP_CTRL_PARSE_FN parsePostRead;
 static SLAP_CTRL_PARSE_FN parseProxyAuthz;
+#ifdef LDAP_DEVEL
+static SLAP_CTRL_PARSE_FN parseManageDIT;
+#endif
 static SLAP_CTRL_PARSE_FN parseManageDSAit;
 static SLAP_CTRL_PARSE_FN parseModifyIncrement;
 static SLAP_CTRL_PARSE_FN parseNoOp;
@@ -139,8 +142,8 @@ static struct slap_control control_defs[] = {
                SLAP_CTRL_HIDE|SLAP_CTRL_DELETE, NULL,
                parseTreeDelete, LDAP_SLIST_ENTRY_INITIALIZER(next) },
 #endif
-#ifdef LDAP_CONTORL_X_SEARCH_OPTIONS
-       { LDAP_CONTORL_X_SEARCH_OPTIONS,
+#ifdef LDAP_CONTROL_X_SEARCH_OPTIONS
+       { LDAP_CONTROL_X_SEARCH_OPTIONS,
                (int)offsetof(struct slap_control_ids, sc_searchOptions),
                SLAP_CTRL_GLOBAL|SLAP_CTRL_SEARCH, NULL,
                parseSearchOptions, LDAP_SLIST_ENTRY_INITIALIZER(next) },
@@ -160,6 +163,12 @@ static struct slap_control control_defs[] = {
                (int)offsetof(struct slap_control_ids, sc_modifyIncrement),
                SLAP_CTRL_HIDE|SLAP_CTRL_MODIFY, NULL,
                parseModifyIncrement, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif
+#ifdef LDAP_DEVEL
+       { LDAP_CONTROL_MANAGEDIT,
+               (int)offsetof(struct slap_control_ids, sc_manageDIT),
+               SLAP_CTRL_GLOBAL|SLAP_CTRL_UPDATE, NULL,
+               parseManageDIT, LDAP_SLIST_ENTRY_INITIALIZER(next) },
 #endif
        { LDAP_CONTROL_MANAGEDSAIT,
                (int)offsetof(struct slap_control_ids, sc_manageDSAit),
@@ -405,8 +414,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 +719,30 @@ static int parseModifyIncrement (
        return LDAP_SUCCESS;
 }
 
+#ifdef LDAP_DEVEL
+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;
+}
+#endif
+
 static int parseManageDSAit (
        Operation *op,
        SlapReply *rs,
@@ -1236,7 +1269,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 );
        }
 
@@ -1316,7 +1349,7 @@ static int parseTreeDelete (
 }
 #endif
 
-#ifdef LDAP_CONTORL_X_SEARCH_OPTIONS
+#ifdef LDAP_CONTROL_X_SEARCH_OPTIONS
 static int parseSearchOptions (
        Operation *op,
        SlapReply *rs,
@@ -1324,6 +1357,7 @@ static int parseSearchOptions (
 {
        BerElement *ber;
        ber_int_t search_flags;
+       ber_tag_t tag;
 
        if ( ctrl->ldctl_value.bv_len == 0 ) {
                rs->sr_text = "searchOptions control value not empty";