svn commit: samba r17375 - in branches/SAMBA_3_0/source/utils: .

vlendec at samba.org vlendec at samba.org
Wed Aug 2 09:32:18 GMT 2006


Author: vlendec
Date: 2006-08-02 09:32:18 +0000 (Wed, 02 Aug 2006)
New Revision: 17375

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

Log:
If a field containts only whitespace, we need to do base64 as well.

Volker
Modified:
   branches/SAMBA_3_0/source/utils/net_rpc_samsync.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_rpc_samsync.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc_samsync.c	2006-08-02 08:53:22 UTC (rev 17374)
+++ branches/SAMBA_3_0/source/utils/net_rpc_samsync.c	2006-08-02 09:32:18 UTC (rev 17375)
@@ -1433,6 +1433,7 @@
 	va_list ap;
 	char *value, *p, *base64;
 	DATA_BLOB base64_blob;
+	BOOL do_base64 = False;
 	int res;
 
 	va_start(ap, fmt);
@@ -1443,12 +1444,29 @@
 
 	for (p=value; *p; p++) {
 		if (*p & 0x80) {
+			do_base64 = True;
 			break;
 		}
 	}
 
-	if (*p == 0) {
-		/* Found no high bit set */
+	if (!do_base64) {
+		BOOL only_whitespace = True;
+		for (p=value; *p; p++) {
+			/*
+			 * I know that this not multibyte safe, but we break
+			 * on the first non-whitespace character anyway.
+			 */
+			if (!isspace(*p)) {
+				only_whitespace = False;
+				break;
+			}
+		}
+		if (only_whitespace) {
+			do_base64 = True;
+		}
+	}
+
+	if (!do_base64) {
 		res = fprintf(add_fd, "%s: %s\n", attr_name, value);
 		TALLOC_FREE(value);
 		return res;



More information about the samba-cvs mailing list