summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-05-21 13:29:14 +0200
committerStefan Metzmacher <metze@samba.org>2010-05-22 09:28:35 +0200
commit796904e983151cfa46a89a0be62f8940b9655f4a (patch)
tree4a9442d6eec9146030dc7067156ca5f0fde88bbe /source4/lib
parentd7542b58fcb0d9a67a20bde5bdf3aec6fd633237 (diff)
downloadsamba-796904e983151cfa46a89a0be62f8940b9655f4a.tar.gz
samba-796904e983151cfa46a89a0be62f8940b9655f4a.tar.bz2
samba-796904e983151cfa46a89a0be62f8940b9655f4a.zip
s4:ldb_controls: make it possible to pass arbitrary control via the command line
--controls=local_oid:1.3.6.1.4.1.7165.4.3.7:1 To specify the DSDB_CONTROL_PASSWORD_HASH_VALUES_OID control as critical. metze
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/common/ldb_controls.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c
index ef0e06f6ce..010ed2de03 100644
--- a/source4/lib/ldb/common/ldb_controls.c
+++ b/source4/lib/ldb/common/ldb_controls.c
@@ -802,6 +802,40 @@ struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *me
continue;
}
+ if (strncmp(control_strings[i], "local_oid:", 10) == 0) {
+ const char *p;
+ int crit = 0, ret = 0;
+ char oid[256];
+
+ oid[0] = '\0';
+ p = &(control_strings[i][10]);
+ ret = sscanf(p, "%64[^:]:%d", oid, &crit);
+
+ if ((ret != 2) || strlen(oid) == 0 || (crit < 0) || (crit > 1)) {
+ error_string = talloc_asprintf(mem_ctx, "invalid local_oid control syntax\n");
+ error_string = talloc_asprintf_append(error_string, " syntax: oid(s):crit(b)\n");
+ error_string = talloc_asprintf_append(error_string, " note: b = boolean, s = string");
+ 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 = talloc_strdup(ctrl[i], oid);
+ if (!ctrl[i]->oid) {
+ ldb_oom(ldb);
+ return NULL;
+ }
+ ctrl[i]->critical = crit;
+ ctrl[i]->data = NULL;
+
+ continue;
+ }
+
/* no controls matched, throw an error */
ldb_asprintf_errstring(ldb, "Invalid control name: '%s'", control_strings[i]);
return NULL;