diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-08-02 09:32:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:29 -0500 |
commit | 8e1fec05cbab33fae372794f3dff1cb5fccac809 (patch) | |
tree | 717f96daa88b5428cfe8471b9ff3c33be593c3c1 /source3 | |
parent | 280e3895b609f7b4fd880dabdc446529938a16f6 (diff) | |
download | samba-8e1fec05cbab33fae372794f3dff1cb5fccac809.tar.gz samba-8e1fec05cbab33fae372794f3dff1cb5fccac809.tar.bz2 samba-8e1fec05cbab33fae372794f3dff1cb5fccac809.zip |
r17375: If a field containts only whitespace, we need to do base64 as well.
Volker
(This used to be commit 795d06f427061536c6e3a3eb5b5d60a27f5ec70d)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_rpc_samsync.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index 4f7209cdb5..bbe09a3b35 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -1433,6 +1433,7 @@ static int fprintf_attr(FILE *add_fd, const char *attr_name, 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 @@ static int fprintf_attr(FILE *add_fd, const char *attr_name, 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; |