svn commit: samba r12983 - in branches/SAMBA_4_0/source/lib/ldb/tools: .

metze at samba.org metze at samba.org
Tue Jan 17 17:23:11 GMT 2006


Author: metze
Date: 2006-01-17 17:23:11 +0000 (Tue, 17 Jan 2006)
New Revision: 12983

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12983

Log:
- fix using a DIRSYNC cookie from the command line
- also w2k doesn't work correct with max_attrs = 0, so we should use 
  a high number, with this I'm getting the same results from w2k and w2k3

metze
Modified:
   branches/SAMBA_4_0/source/lib/ldb/tools/ldbsearch.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/tools/ldbsearch.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/tools/ldbsearch.c	2006-01-17 17:15:07 UTC (rev 12982)
+++ branches/SAMBA_4_0/source/lib/ldb/tools/ldbsearch.c	2006-01-17 17:23:11 UTC (rev 12983)
@@ -82,10 +82,17 @@
 			ret = sscanf(p, "%d:%d:%d:%1023[^$]", &crit, &flags, &max_attrs, cookie);
 
 			if ((ret < 3) || (crit < 0) || (crit > 1) || (flags < 0) || (max_attrs < 0)) {
-				fprintf(stderr, "invalid paged_results control syntax\n");
+				fprintf(stderr, "invalid dirsync control syntax\n");
 				return NULL;
 			}
 
+			/* w2k3 seems to ignore the parameter,
+			 * but w2k sends a wrong cookie when this value is to small
+			 * this would cause looping forever, while getting
+			 * the same data and same cookie forever
+			 */
+			if (max_attrs == 0) max_attrs = 0x0FFFFFFF;
+
 			ctrl[i] = talloc(ctrl, struct ldb_control);
 			ctrl[i]->oid = LDB_CONTROL_DIRSYNC_OID;
 			ctrl[i]->critical = crit;
@@ -93,9 +100,8 @@
 			control->flags = flags;
 			control->max_attributes = max_attrs;
 			if (*cookie) {
-				ldb_base64_decode(cookie);
-				control->cookie = talloc_strdup(control, cookie);
-				control->cookie_len = strlen(cookie);
+				control->cookie_len = ldb_base64_decode(cookie);
+				control->cookie = talloc_memdup(control, cookie, control->cookie_len);
 			} else {
 				control->cookie = NULL;
 				control->cookie_len = 0;
@@ -332,7 +338,7 @@
 			req_control->cookie_len = rep_control->cookie_len;
 
 			cookie = ldb_base64_encode(req_control, rep_control->cookie, rep_control->cookie_len);
-			fprintf(stderr, "Debug: The cookie returned was: %s\n", cookie);
+			printf("# DIRSYNC cookie returned was:\n# %s\n", cookie);
 
 			ret = 1;
 



More information about the samba-cvs mailing list