From 57fd87f07541f6e8f1dcb24a946c4802c947a75c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 10 Sep 2012 15:17: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/configure-for-test | 4 ++++ source3/lib/ldb_compat.c | 13 +++++++++---- source4/lib/ldb/common/ldb_parse.c | 11 +++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100755 source3/configure-for-test diff --git a/source3/configure-for-test b/source3/configure-for-test new file mode 100755 index 0000000..b35f4fe --- /dev/null +++ b/source3/configure-for-test @@ -0,0 +1,4 @@ +export SOCKET_WRAPPER_DIR=./sw +export RUN_FROM_BUILD_FARM=yes +./configure.developer --with-acl-support --with-aio-support --disable-pie --enable-socket-wrapper --enable-nss-wrapper --enable-pthreadpool "$@" +#./configure.developer --with-acl-support --disable-pie --with-pam-support --with-dnsupdate-support --enable-socket-wrapper --enable-nss-wrapper --with-smbtorture4-path=/usr/local/samba4/bin/smbtorture --with-samba4srcdir=../../SAMBA_4_0/source 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