summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-09-10 09:30:49 -0700
committerJeremy Allison <jra@samba.org>2012-09-10 21:56:34 +0200
commitcfeac09fc0796ecf77593244e9e72c1521fd251c (patch)
tree448199adb850de3006da6219c7ddc0ac6fb227df /lib
parent56d97d1729589cb8e97cda07a5198a84ee71a147 (diff)
downloadsamba-cfeac09fc0796ecf77593244e9e72c1521fd251c.tar.gz
samba-cfeac09fc0796ecf77593244e9e72c1521fd251c.tar.bz2
samba-cfeac09fc0796ecf77593244e9e72c1521fd251c.zip
Fix bug #9147 - winbind can't fetch user or group info from AD via LDAP
Don't use "isprint" in ldb_binary_encode(). This is locale specific. Restrict to ASCII only, hex encode everything else.
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/common/ldb_parse.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ldb/common/ldb_parse.c b/lib/ldb/common/ldb_parse.c
index cfa2959194..f47ef43376 100644
--- a/lib/ldb/common/ldb_parse.c
+++ b/lib/ldb/common/ldb_parse.c
@@ -124,7 +124,8 @@ char *ldb_binary_encode(TALLOC_CTX *mem_ctx, struct ldb_val val)
unsigned char *buf = val.data;
for (i=0;i<val.length;i++) {
- if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
+ unsigned int cval = buf[i];
+ if (cval < 0x20 || cval > 0x7E || strchr(" *()\\&|!\"", buf[i])) {
len += 2;
}
}
@@ -133,7 +134,8 @@ char *ldb_binary_encode(TALLOC_CTX *mem_ctx, struct ldb_val val)
len = 0;
for (i=0;i<val.length;i++) {
- if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
+ unsigned int cval = buf[i];
+ if (cval < 0x20 || cval > 0x7E || strchr(" *()\\&|!\"", buf[i])) {
snprintf(ret+len, 4, "\\%02X", buf[i]);
len += 3;
} else {