From ae630ea35b18b30988863de1798d0411256520a4 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 3 Jan 2019 20:32:53 +0000 Subject: [PATCH] Fix tests to work with python3 --- Fix-tests-to-work-with-python3.patch | 46 ++++++++++++++++++++ In-tests-show-the-exception-on-failure.patch | 42 ++++++++++++++++++ mod_auth_gssapi.spec | 7 ++- 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 Fix-tests-to-work-with-python3.patch create mode 100644 In-tests-show-the-exception-on-failure.patch diff --git a/Fix-tests-to-work-with-python3.patch b/Fix-tests-to-work-with-python3.patch new file mode 100644 index 0000000..6aaf7bc --- /dev/null +++ b/Fix-tests-to-work-with-python3.patch @@ -0,0 +1,46 @@ +From d2748e79d31f153505f944b09a4790c6231dcd79 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Fri, 21 Dec 2018 11:50:16 -0500 +Subject: [PATCH] Fix tests to work with python3 + +Signed-off-by: Robbie Harwood +(cherry picked from commit 751eb09e7abf38f49fc525e1616d48a6f951673f) +--- + tests/magtests.py | 3 ++- + tests/t_spnego_proxy.py | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/tests/magtests.py b/tests/magtests.py +index 6414503..f14f47a 100755 +--- a/tests/magtests.py ++++ b/tests/magtests.py +@@ -431,7 +431,7 @@ def kinit_user(testdir, kdcenv): + stdin=subprocess.PIPE, + stdout=logfile, stderr=logfile, + env=testenv, preexec_fn=os.setsid) +- kinit.communicate('%s\n' % USR_PWD) ++ kinit.communicate(('%s\n' % USR_PWD).encode("utf8")) + kinit.wait() + if kinit.returncode != 0: + raise ValueError('kinit failed') +@@ -495,6 +495,7 @@ def test_spnego_auth(testdir, testenv, logfile): + else: + sys.stderr.write('SPNEGO No Auth: SUCCESS\n') + ++ + return error_count + + +diff --git a/tests/t_spnego_proxy.py b/tests/t_spnego_proxy.py +index 6219721..c47558b 100755 +--- a/tests/t_spnego_proxy.py ++++ b/tests/t_spnego_proxy.py +@@ -17,7 +17,7 @@ def getAuthToken(target): + ctx = gssapi.SecurityContext(name=name, mech=spnego_mech) + token = ctx.step() + +- return 'Negotiate %s' % b64encode(token) ++ return 'Negotiate %s' % b64encode(token).decode() + + + if __name__ == '__main__': diff --git a/In-tests-show-the-exception-on-failure.patch b/In-tests-show-the-exception-on-failure.patch new file mode 100644 index 0000000..99fc2ee --- /dev/null +++ b/In-tests-show-the-exception-on-failure.patch @@ -0,0 +1,42 @@ +From 1de81677f1878ea1667b56169fe714d685771b4e Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Fri, 21 Dec 2018 10:50:49 -0500 +Subject: [PATCH] In tests, show the exception on failure + +Otherwise, the user might get nothing at all out, depending on what failed. + +Signed-off-by: Robbie Harwood +(cherry picked from commit 881f98ee08f6d8d7a2352ab2f3e8e38845cf8039) +--- + tests/magtests.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tests/magtests.py b/tests/magtests.py +index 576e88f..6414503 100755 +--- a/tests/magtests.py ++++ b/tests/magtests.py +@@ -8,6 +8,7 @@ import shutil + import signal + import subprocess + import sys ++import traceback + + # check that we can import requests (for use in test scripts) + import requests +@@ -207,7 +208,6 @@ def setup_test_certs(testdir, testenv, logfile): + with open(opensslcnf, 'w+') as f: + f.write(text) + +- print(pkinit_key) + cmd = subprocess.Popen(["openssl", "genrsa", "-out", pkinit_key, + "2048"], stdout=logfile, + stderr=logfile, env=testenv, +@@ -718,6 +718,8 @@ if __name__ == '__main__': + errs += test_basic_auth_krb5(testdir, testenv, logfile) + + errs += test_no_negotiate(testdir, testenv, logfile) ++ except Exception: ++ traceback.print_exc() + finally: + for name in processes: + logfile.write("Killing %s\n" % name) diff --git a/mod_auth_gssapi.spec b/mod_auth_gssapi.spec index 4a39084..d1c6c61 100644 --- a/mod_auth_gssapi.spec +++ b/mod_auth_gssapi.spec @@ -1,6 +1,6 @@ Name: mod_auth_gssapi Version: 1.6.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A GSSAPI Authentication module for Apache Group: System Environment/Daemons @@ -8,6 +8,8 @@ License: MIT URL: https://github.com/modauthgssapi/mod_auth_gssapi Source0: https://github.com/modauthgssapi/%{name}/releases/download/v%{version}/%name-%{version}.tar.gz +Patch0: In-tests-show-the-exception-on-failure.patch +Patch1: Fix-tests-to-work-with-python3.patch BuildRequires: httpd-devel, krb5-devel, openssl-devel, autoconf, automake, libtool BuildRequires: gssntlmssp-devel @@ -45,6 +47,9 @@ install -m 644 10-auth_gssapi.conf %{buildroot}%{_httpd_modconfdir} %{_httpd_moddir}/mod_auth_gssapi.so %changelog +* Thu Jan 03 2019 Robbie Harwood - 1.6.1-3 +- Fix tests to work with python3 + * Fri Jul 13 2018 Fedora Release Engineering - 1.6.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild