s4-ldb: Add new relax controls that allow relaxed x500 constraints checks
authorMatthieu Patou <mat@matws.net>
Wed, 23 Sep 2009 09:34:58 +0000 (13:34 +0400)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Fri, 2 Oct 2009 10:44:59 +0000 (12:44 +0200)
source4/lib/ldb/common/ldb_controls.c
source4/lib/ldb/include/ldb.h

index b38373ec12f38543d6886eefd30959fdbb90efaa..32b2c0f66dfc7fe8a0abd057e99b883a9f4cee42 100644 (file)
@@ -407,6 +407,33 @@ struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *me
                        continue;
                }
 
+               if (strncmp(control_strings[i], "relax:", 6) == 0) {
+                       const char *p;
+                       int crit, ret;
+
+                       p = &(control_strings[i][6]);
+                       ret = sscanf(p, "%d", &crit);
+                       if ((ret != 1) || (crit < 0) || (crit > 1)) {
+                               error_string = talloc_asprintf(mem_ctx, "invalid relax 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_RELAX_OID;
+                       ctrl[i]->critical = crit;
+                       ctrl[i]->data = NULL;
+
+                       continue;
+               }
+
                if (strncmp(control_strings[i], "domain_scope:", 13) == 0) {
                        const char *p;
                        int crit, ret;
index 04f7ccb3f28474f6c3cbed7aa58315ec98364a4b..d4af95b394c7be235cffd90bc78dac66b52ed576 100644 (file)
@@ -456,6 +456,14 @@ const struct ldb_dn_extended_syntax *ldb_dn_extended_syntax_by_name(struct ldb_c
 /* sorting helpers */
 typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
 
+/**
+   OID for the allowing client to request temporary relaxed 
+   enforcement of constraints of the x.500 model.
+
+   \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 the paged results control. This control is included in the
    searchRequest and searchResultDone messages as part of the controls