summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools/cmdline.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-05 10:26:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:23 -0500
commitb4028ca1041fc8e0266de2f5c858dd40e660aafb (patch)
treeeff2d4ed3e318869c7f1c3ca9f17d0fbe944ac26 /source4/lib/ldb/tools/cmdline.c
parent0c739e8cde82c22e7258061b324281d083c41a4e (diff)
downloadsamba-b4028ca1041fc8e0266de2f5c858dd40e660aafb.tar.gz
samba-b4028ca1041fc8e0266de2f5c858dd40e660aafb.tar.bz2
samba-b4028ca1041fc8e0266de2f5c858dd40e660aafb.zip
r17418: add client support for the LDAP_SERVER_SD_FLAGS control
metze (This used to be commit 23759a1e9b05c4fde475a9016cb0b7447656d7e7)
Diffstat (limited to 'source4/lib/ldb/tools/cmdline.c')
-rw-r--r--source4/lib/ldb/tools/cmdline.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index e7e5186b55..d5a52cf370 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -381,6 +381,31 @@ struct ldb_control **parse_controls(void *mem_ctx, char **control_strings)
continue;
}
+ if (strncmp(control_strings[i], "sd_flags:", 9) == 0) {
+ struct ldb_sd_flags_control *control;
+ const char *p;
+ int crit, ret;
+ unsigned secinfo_flags;
+
+ p = &(control_strings[i][9]);
+ ret = sscanf(p, "%d:%u", &crit, &secinfo_flags);
+ if ((ret != 2) || (crit < 0) || (crit > 1) || (secinfo_flags < 0) || (secinfo_flags > 0xF)) {
+ fprintf(stderr, "invalid sd_flags control syntax\n");
+ fprintf(stderr, " syntax: crit(b):secinfo_flags(n)\n");
+ fprintf(stderr, " note: b = boolean, n = number\n");
+ return NULL;
+ }
+
+ ctrl[i] = talloc(ctrl, struct ldb_control);
+ ctrl[i]->oid = LDB_CONTROL_SD_FLAGS_OID;
+ ctrl[i]->critical = crit;
+ control = talloc(ctrl[i], struct ldb_sd_flags_control);
+ control->secinfo_flags = secinfo_flags;
+ ctrl[i]->data = control;
+
+ continue;
+ }
+
if (strncmp(control_strings[i], "paged_results:", 14) == 0) {
struct ldb_paged_control *control;
const char *p;
@@ -464,7 +489,7 @@ struct ldb_control **parse_controls(void *mem_ctx, char **control_strings)
}
/* no controls matched, throw an error */
- fprintf(stderr, "Invalid control name\n");
+ fprintf(stderr, "Invalid control name: '%s'\n", control_strings[i]);
return NULL;
}