commit: 1009299d11d10c0610e698fa5b6dd8dad63d5acb Author: Justin Lecher <jlec <AT> gentoo <DOT> org> AuthorDate: Wed Oct 14 14:05:34 2015 +0000 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> CommitDate: Wed Oct 14 14:05:34 2015 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1009299d
dev-python/pyldap: Backport patch for bytes/string conversion problem Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=562854 Package-Manager: portage-2.2.23 Signed-off-by: Justin Lecher <jlec <AT> gentoo.org> .../pyldap-2.4.20-bytes_string-backport.patch | 49 ++++++++++++++++++++++ dev-python/pyldap/metadata.xml | 2 +- dev-python/pyldap/pyldap-2.4.20-r1.ebuild | 2 + ...ap-2.4.20-r1.ebuild => pyldap-2.4.20-r2.ebuild} | 2 + 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/dev-python/pyldap/files/pyldap-2.4.20-bytes_string-backport.patch b/dev-python/pyldap/files/pyldap-2.4.20-bytes_string-backport.patch new file mode 100644 index 0000000..ff4519b --- /dev/null +++ b/dev-python/pyldap/files/pyldap-2.4.20-bytes_string-backport.patch @@ -0,0 +1,49 @@ +From 6e9e1902f33bff8ea179dc32ce4d2aa71b3335de Mon Sep 17 00:00:00 2001 +From: Petr Viktorin <[email protected]> +Date: Fri, 2 Oct 2015 14:06:12 +0200 +Subject: [PATCH] Fix sasl string/bytes mismatch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The SASL mechanism and response are always bytes; encode them if necessary. + +Based on patch by Michael Šimáček: https://github.com/pyldap/pyldap/pull/20 +--- + Lib/ldap/sasl.py | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/Lib/ldap/sasl.py b/Lib/ldap/sasl.py +index 1158671..de38393 100644 +--- a/Lib/ldap/sasl.py ++++ b/Lib/ldap/sasl.py +@@ -46,6 +46,8 @@ def __init__(self,cb_value_dict,mech): + SASL callback id's. The mech argument is a string that specifies + the SASL mechaninsm to be uesd.""" + self.cb_value_dict = cb_value_dict or {} ++ if not isinstance(mech, bytes): ++ mech = mech.encode('utf-8') + self.mech = mech + + def callback(self,cb_id,challenge,prompt,defresult): +@@ -62,7 +64,10 @@ def callback(self,cb_id,challenge,prompt,defresult): + cb_value_dictionary. Note that the current callback interface is not very + useful for writing generic sasl GUIs, which would need to know all + the questions to ask, before the answers are returned to the sasl +- lib (in contrast to one question at a time).""" ++ lib (in contrast to one question at a time). ++ ++ Unicode strings are always converted to bytes. ++ """ + + # The following print command might be useful for debugging + # new sasl mechanisms. So it is left here +@@ -72,6 +77,8 @@ def callback(self,cb_id,challenge,prompt,defresult): + _trace_file.write("*** id=%d, challenge=%s, prompt=%s, defresult=%s\n-> %s\n" % ( + cb_id, challenge, prompt, repr(defresult), repr(self.cb_value_dict.get(cb_result)) + )) ++ if not isinstance(cb_result, bytes): ++ cb_result = cb_result.encode('utf-8') + return cb_result + + diff --git a/dev-python/pyldap/metadata.xml b/dev-python/pyldap/metadata.xml index b491fc4..7a3d4a5 100644 --- a/dev-python/pyldap/metadata.xml +++ b/dev-python/pyldap/metadata.xml @@ -1,4 +1,4 @@ -<?xml version='1.0' encoding='UTF-8'?> +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> <herd>python</herd> diff --git a/dev-python/pyldap/pyldap-2.4.20-r1.ebuild b/dev-python/pyldap/pyldap-2.4.20-r1.ebuild index 55a781d..1ea0d22 100644 --- a/dev-python/pyldap/pyldap-2.4.20-r1.ebuild +++ b/dev-python/pyldap/pyldap-2.4.20-r1.ebuild @@ -31,6 +31,8 @@ DEPEND="${RDEPEND} doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )" RDEPEND+=" !dev-python/python-ldap" +PATCHES=( "${FILESDIR}"/${P}-bytes_string-backport.patch ) + python_prepare_all() { sed -e "s:^library_dirs =.*:library_dirs = /usr/$(get_libdir) /usr/$(get_libdir)/sasl2:" \ -e "s:^include_dirs =.*:include_dirs = ${EPREFIX}/usr/include ${EPREFIX}/usr/include/sasl:" \ diff --git a/dev-python/pyldap/pyldap-2.4.20-r1.ebuild b/dev-python/pyldap/pyldap-2.4.20-r2.ebuild similarity index 97% copy from dev-python/pyldap/pyldap-2.4.20-r1.ebuild copy to dev-python/pyldap/pyldap-2.4.20-r2.ebuild index 55a781d..1ea0d22 100644 --- a/dev-python/pyldap/pyldap-2.4.20-r1.ebuild +++ b/dev-python/pyldap/pyldap-2.4.20-r2.ebuild @@ -31,6 +31,8 @@ DEPEND="${RDEPEND} doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )" RDEPEND+=" !dev-python/python-ldap" +PATCHES=( "${FILESDIR}"/${P}-bytes_string-backport.patch ) + python_prepare_all() { sed -e "s:^library_dirs =.*:library_dirs = /usr/$(get_libdir) /usr/$(get_libdir)/sasl2:" \ -e "s:^include_dirs =.*:include_dirs = ${EPREFIX}/usr/include ${EPREFIX}/usr/include/sasl:" \
