summaryrefslogtreecommitdiff
path: root/lib/ldb/tools
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-01-26 09:36:56 +0100
committerGarming Sam <garming@samba.org>2016-02-17 03:43:23 +0100
commitad2b5fae7f9b1437e6fcf73a0be3ca5d3ba0d5dc (patch)
treeb68fc81eb3122ba7ead30368b149bb763830817b /lib/ldb/tools
parentf721f27da5f9ebb41639b70986ad1acb83206ed6 (diff)
downloadsamba-ad2b5fae7f9b1437e6fcf73a0be3ca5d3ba0d5dc.tar.gz
ldb: add support for LDB_CONTROL_DIRSYNC_EX
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb/tools')
-rw-r--r--lib/ldb/tools/cmdline.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/ldb/tools/cmdline.c b/lib/ldb/tools/cmdline.c
index a06445fc0f4..6d0a40643df 100644
--- a/lib/ldb/tools/cmdline.c
+++ b/lib/ldb/tools/cmdline.c
@@ -459,6 +459,39 @@ int handle_controls_reply(struct ldb_control **reply, struct ldb_control **reque
continue;
}
+ if (strcmp(LDB_CONTROL_DIRSYNC_EX_OID, reply[i]->oid) == 0) {
+ struct ldb_dirsync_control *rep_control, *req_control;
+ char *cookie;
+
+ rep_control = talloc_get_type(reply[i]->data, struct ldb_dirsync_control);
+ if (rep_control->cookie_len == 0) /* we are done */
+ break;
+
+ /* more processing required */
+ /* let's fill in the request control with the new cookie */
+
+ for (j = 0; request[j]; j++) {
+ if (strcmp(LDB_CONTROL_DIRSYNC_EX_OID, request[j]->oid) == 0)
+ break;
+ }
+ /* if there's a reply control we must find a request
+ * control matching it */
+ if (! request[j]) return -1;
+
+ req_control = talloc_get_type(request[j]->data, struct ldb_dirsync_control);
+
+ if (req_control->cookie)
+ talloc_free(req_control->cookie);
+ req_control->cookie = (char *)talloc_memdup(
+ req_control, rep_control->cookie,
+ rep_control->cookie_len);
+ req_control->cookie_len = rep_control->cookie_len;
+
+ cookie = ldb_base64_encode(req_control, rep_control->cookie, rep_control->cookie_len);
+ printf("# DIRSYNC_EX cookie returned was:\n# %s\n", cookie);
+
+ continue;
+ }
/* no controls matched, throw a warning */
fprintf(stderr, "Unknown reply control oid: %s\n", reply[i]->oid);