ldb: add a new control bypassioperationnal
authorMatthieu Patou <mat@matws.net>
Mon, 14 Jun 2010 22:23:11 +0000 (02:23 +0400)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 19 Jun 2010 22:43:08 +0000 (00:43 +0200)
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
source4/lib/ldb/common/ldb_controls.c
source4/lib/ldb/include/ldb.h
source4/lib/ldb/tests/test-controls.sh
source4/setup/schema_samba4.ldif

index 010ed2de03c0430b8ab75ec866d7d6dab9576c61..aff03a00edbde541ccc129038cbd490ec5649d3b 100644 (file)
@@ -486,6 +486,33 @@ struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *me
                        continue;
                }
 
+               if (strncmp(control_strings[i], "bypassoperational:", 18) == 0) {
+                       const char *p;
+                       int crit, ret;
+
+                       p = &(control_strings[i][18]);
+                       ret = sscanf(p, "%d", &crit);
+                       if ((ret != 1) || (crit < 0) || (crit > 1)) {
+                               error_string = talloc_asprintf(mem_ctx, "invalid bypassopreational control syntax\n");
+                               error_string = talloc_asprintf_append(error_string, " syntax: crit(b)\n");
+                               error_string = talloc_asprintf_append(error_string, "   note: b = boolean");
+                               ldb_set_errstring(ldb, error_string);
+                               talloc_free(error_string);
+                               return NULL;
+                       }
+
+                       ctrl[i] = talloc(ctrl, struct ldb_control);
+                       if (!ctrl[i]) {
+                               ldb_oom(ldb);
+                               return NULL;
+                       }
+                       ctrl[i]->oid = LDB_CONTROL_BYPASSOPERATIONAL_OID;
+                       ctrl[i]->critical = crit;
+                       ctrl[i]->data = NULL;
+
+                       continue;
+               }
+
                if (strncmp(control_strings[i], "relax:", 6) == 0) {
                        const char *p;
                        int crit, ret;
index 2eb395c81f77f269b8c07f20e377016304223277..9958325f9014f41fcea6e6e54d2ec73134e75142 100644 (file)
@@ -463,6 +463,15 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
    \sa <a href="http://opends.dev.java.net/public/standards/draft-zeilenga-ldap-managedit.txt">draft managedit</a>.
 */
 #define LDB_CONTROL_RELAX_OID "1.3.6.1.4.1.4203.666.5.12"
+
+/**
+  OID for getting and manipulating attributes from the ldb
+  without interception in the operational module.
+  It can be used to access attribute that used to be stored in the sam 
+  and that are now calculated.
+*/
+#define LDB_CONTROL_BYPASSOPERATIONAL_OID "1.3.6.1.4.1.7165.4.3.13"
+
 /**
   OID for recalculate SD control. This control force the
   dsdb code to recalculate the SD of the object as if the
index db139bbec7b06687bea486c33ea29006e4df8fcf..c78acbf4716d9e92a25fddccdfb1aa930eae4ae8 100755 (executable)
@@ -42,5 +42,6 @@ replace someThing
 someThing: someThingElseBetter
 EOF
 
+$VALGRIND ldbsearch --controls "bypassoperational:0" >/dev/null 2>&1 || exit 1
 
 set
index 112fd22555bfdec7e0ed05b67e731744638fe8c5..b8ef5d6f51ab54600bbe4ffd9a9237cf55122ce1 100644 (file)
 #Allocated: DSDB_CONTROL_PASSWORD_HASH_VALUES_OID 1.3.6.1.4.1.7165.4.3.9
 #Allocated: DSDB_CONTROL_PASSWORD_CHANGE_OLD_PW_CHECKED_OID 1.3.6.1.4.1.7165.4.3.10
 #Allocated: DSDB_CONTROL_APPLY_LINKS 1.3.6.1.4.1.7165.4.3.11
+#Allocated: LDB_CONTROL_BYPASSOPERATIONAL_OID 1.3.6.1.4.1.7165.4.3.13
 
 # Extended 1.3.6.1.4.1.7165.4.4.x
 #Allocated: DSDB_EXTENDED_REPLICATED_OBJECTS_OID 1.3.6.1.4.1.7165.4.4.1