[PATCH 1/2] ldb: Add a new control: ManageDSAIT
Matthieu Patou
mat at matws.net
Sat Jun 5 03:39:43 MDT 2010
This control allow to implement RFC 3296. It can be used to manipulated
value of ref attribute in referrals or attribute that are no more stored
---
source4/lib/ldb/common/ldb_controls.c | 27 +++++++++++++++++++++++++++
source4/lib/ldb/include/ldb.h | 14 ++++++++++++++
source4/lib/ldb/tests/test-controls.sh | 1 +
3 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c
index 010ed2d..a81020d 100644
--- a/source4/lib/ldb/common/ldb_controls.c
+++ b/source4/lib/ldb/common/ldb_controls.c
@@ -486,6 +486,33 @@ struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *me
continue;
}
+ if (strncmp(control_strings[i], "managedsait:", 12) == 0) {
+ const char *p;
+ int crit, ret;
+
+ p = &(control_strings[i][12]);
+ ret = sscanf(p, "%d", &crit);
+ if ((ret != 1) || (crit < 0) || (crit > 1)) {
+ error_string = talloc_asprintf(mem_ctx, "invalid managedsait 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_MANAGEDSAIT_OID;
+ ctrl[i]->critical = crit;
+ ctrl[i]->data = NULL;
+
+ continue;
+ }
+
if (strncmp(control_strings[i], "relax:", 6) == 0) {
const char *p;
int crit, ret;
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index b644b99..9ee403d 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -463,6 +463,20 @@ 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 interpretation. Ie. Instead of returning referrals,
+ you can query and more important modify the object they
+ are pointing.
+
+ It's also used for revealing once stored attribute that are
+ not anymore stored.
+
+ It's explained in RFC 3296.
+*/
+#define LDB_CONTROL_MANAGEDSAIT_OID "2.16.840.1.113730.3.4.2"
+
/**
OID for recalculate SD control. This control force the
dsdb code to recalculate the SD of the object as if the
diff --git a/source4/lib/ldb/tests/test-controls.sh b/source4/lib/ldb/tests/test-controls.sh
index db139bb..ff12177 100755
--- a/source4/lib/ldb/tests/test-controls.sh
+++ b/source4/lib/ldb/tests/test-controls.sh
@@ -42,5 +42,6 @@ replace someThing
someThing: someThingElseBetter
EOF
+$VALGRIND ldbsearch --controls "managedsait:0" >/dev/null 2>&1 || exit 1
set
--
1.7.0.4
--------------070601070507010108060500--
More information about the samba-technical
mailing list