From 77089242638d937ca4a9b431708a12bdbc36467e 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/lib/ldb_compat.c | 6 ++++-- source4/lib/ldb/common/ldb_parse.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source3/lib/ldb_compat.c b/source3/lib/ldb_compat.c index 36a29e6..34e37e7 100644 --- a/source3/lib/ldb_compat.c +++ b/source3/lib/ldb_compat.c @@ -99,7 +99,8 @@ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) unsigned char *buf = val.data; for (i=0;i 0x7E || strchr(" *()\\&|!\"", buf[i])) { len += 2; } } @@ -108,7 +109,8 @@ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val) len = 0; for (i=0;i 0x7E || strchr(" *()\\&|!\"", buf[i])) { snprintf(ret+len, 4, "\\%02X", buf[i]); len += 3; } else { diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c index b4eabf8..2a48d99 100644 --- a/source4/lib/ldb/common/ldb_parse.c +++ b/source4/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 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 0x7E || strchr(" *()\\&|!\"", buf[i])) { snprintf(ret+len, 4, "\\%02X", buf[i]); len += 3; } else { -- 1.7.7.3