[SCM] Samba Shared Repository - branch v3-6-test updated
Karolin Seeger
kseeger at samba.org
Mon Sep 17 03:34:31 MDT 2012
The branch, v3-6-test has been updated
via f4d2e6b Fix bug #9147 - winbind can't fetch user or group info from AD via LDAP
from 734e177 WHATSNEW: Start release notes for Samba 3.6.9.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit f4d2e6b6c321ecfccadc3b19f4a27991cf93eb8c
Author: Jeremy Allison <jra at samba.org>
Date: Tue Sep 11 13:25:14 2012 -0700
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.
-----------------------------------------------------------------------
Summary of changes:
source3/lib/ldb_compat.c | 13 +++++++++----
source4/lib/ldb/common/ldb_parse.c | 11 +++++++++--
2 files changed, 18 insertions(+), 6 deletions(-)
Changeset truncated at 500 lines:
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<val.length;i++) {
- if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
+ if (need_encode(buf[i])) {
len += 2;
}
}
@@ -108,7 +113,7 @@ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val)
len = 0;
for (i=0;i<val.length;i++) {
- if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
+ if (need_encode(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..1ea425a 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -111,6 +111,13 @@ struct ldb_val ldb_binary_decode(TALLOC_CTX *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
@@ -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<val.length;i++) {
- if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
+ if (need_encode(buf[i])) {
len += 2;
}
}
@@ -133,7 +140,7 @@ 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])) {
+ if (need_encode(buf[i])) {
snprintf(ret+len, 4, "\\%02X", buf[i]);
len += 3;
} else {
--
Samba Shared Repository
More information about the samba-cvs
mailing list