From a3c3563ef9e9799b2063a97ba4dd6bc677027529 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Sep 2012 13:25:14 -0700 Subject: [PATCH] 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. --- source3/lib/ldb_compat.c | 13 +++++++++---- source4/lib/ldb/common/ldb_parse.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/source3/lib/ldb_compat.c b/source3/lib/ldb_compat.c index 36a29e6..494d381 100644 --- a/source3/lib/ldb_compat.c +++ b/source3/lib/ldb_compat.c @@ -84,8 +84,13 @@ static struct ldb_val ldb_binary_decode(void *mem_ctx, const char *str) return ret; } - - +static bool need_encode(unsigned char cval) +{ + if (cval < 0x20 || cval > 0x7E || strchr(" *()\\&|!\"", cval)) { + return true; + } + return false; +} /* encode a blob as a RFC2254 binary string, escaping any @@ -99,7 +104,7 @@ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) unsigned char *buf = val.data; for (i=0;i 0x7E || strchr(" *()\\&|!\"", cval)) { + return true; + } + return false; +} /* encode a blob as a RFC2254 binary string, escaping any @@ -124,7 +131,7 @@ char *ldb_binary_encode(TALLOC_CTX *mem_ctx, struct ldb_val val) unsigned char *buf = val.data; for (i=0;i