From 61192a0fe33cd33c6df085df9cd76c6c3079faad Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Mar 05 2018 21:38:36 +0000 Subject: Apply patch to port from python2-kerberos to python2-gssapi Resolves: #1546882 --- diff --git a/Port-to-python-gssapi-from-pykerberos.patch b/Port-to-python-gssapi-from-pykerberos.patch new file mode 100644 index 0000000..2f91ac4 --- /dev/null +++ b/Port-to-python-gssapi-from-pykerberos.patch @@ -0,0 +1,124 @@ +From f402492eb0028cc626b100a7352adc5d8736c7c0 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Mon, 19 Feb 2018 16:16:32 -0500 +Subject: [PATCH] Port to python-gssapi from pykerberos + +--- + python-nitrate.spec | 7 +++++-- + setup.py | 2 +- + source/xmlrpc.py | 31 ++++++++++++++----------------- + 3 files changed, 20 insertions(+), 20 deletions(-) + +diff --git a/python-nitrate.spec b/python-nitrate.spec +index 776f974..da8ad74 100644 +--- a/python-nitrate.spec ++++ b/python-nitrate.spec +@@ -1,6 +1,6 @@ + Name: python-nitrate + Version: 1.3 +-Release: 2%{?dist} ++Release: 3%{?dist} + + Summary: Python API for the Nitrate test case management system + Group: Development/Languages +@@ -11,7 +11,7 @@ Source0: http://psss.fedorapeople.org/python-nitrate/%{name}-%{version}.tar.bz2 + + BuildArch: noarch + BuildRequires: python-devel +-Requires: python-kerberos python-psycopg2 ++Requires: python-gssapi python-psycopg2 + + %description + python-nitrate is a Python interface to the Nitrate test case +@@ -40,6 +40,9 @@ install -pm 644 docs/*.1.gz %{buildroot}%{_mandir}/man1 + %doc COPYING README examples + + %changelog ++* Mon Feb 19 2018 Robbie Harwood 1.3-3 ++- Port to python-gssapi ++ + * Tue May 10 2016 Martin Frodl 1.3-2 + - Removed obsolete project page links + +diff --git a/source/xmlrpc.py b/source/xmlrpc.py +index ca4e122..9585214 100644 +--- a/source/xmlrpc.py ++++ b/source/xmlrpc.py +@@ -6,6 +6,7 @@ This code is based on http://landfill.bugzilla.org/testopia2/testopia/contrib/dr + and https://fedorahosted.org/python-bugzilla/browser/bugzilla/base.py + + History: ++2018-02-19 Port to python-gssapi from pykerberos + 2011-12-31 bugfix https://bugzilla.redhat.com/show_bug.cgi?id=735937 + + Example on how to access this library, +@@ -32,9 +33,10 @@ n = NitrateXmlrpc( + n.testplan_get(10) + """ + +-import xmlrpclib, urllib2, httplib, kerberos ++import xmlrpclib, urllib2, httplib, gssapi + from types import * + from datetime import datetime, time ++from base64 import b64encode, b64decode + + from cookielib import CookieJar + +@@ -197,8 +199,9 @@ class SafeCookieTransport(xmlrpclib.SafeTransport,CookieTransport): + request = CookieTransport.request_with_cookies + + # Stolen from FreeIPA source freeipa-1.2.1/ipa-python/krbtransport.py +-class KerbTransport(SafeCookieTransport): +- """Handles Kerberos Negotiation authentication to an XML-RPC server.""" ++# Ported to use python-gssapi ++class GSSAPITransport(SafeCookieTransport): ++ """Handles GSSAPI Negotiation (SPNEGO) authentication to an XML-RPC server.""" + + def get_host_info(self, host): + host, extra_headers, x509 = xmlrpclib.Transport.get_host_info(self, host) +@@ -207,19 +210,13 @@ class KerbTransport(SafeCookieTransport): + h = host + hostinfo = h.split(':') + service = "HTTP@" + hostinfo[0] +- +- try: +- rc, vc = kerberos.authGSSClientInit(service); +- except kerberos.GSSError, e: +- raise kerberos.GSSError(e) +- +- try: +- kerberos.authGSSClientStep(vc, ""); +- except kerberos.GSSError, e: +- raise kerberos.GSSError(e) ++ ++ service_name = gssapi.Name(service, gssapi.NameType.hostbased_service) ++ vc = gssapi.SecurityContext(usage="initiate", name=service_name) ++ response = vc.step() + + extra_headers = [ +- ("Authorization", "negotiate %s" % kerberos.authGSSClientResponse(vc) ) ++ ("Authorization", "negotiate %s" % b64encode(response).decode() ) + ] + + return host, extra_headers, x509 +@@ -487,14 +484,14 @@ class NitrateXmlrpc(object): + class NitrateKerbXmlrpc(NitrateXmlrpc): + """ + NitrateXmlrpc - Nitrate XML-RPC client +- for server deployed with mod_auth_kerb ++ for server deployed with mod_auth_gssapi + """ + def __init__(self, url): + if url.startswith('https://'): +- self._transport = KerbTransport() ++ self._transport = GSSAPITransport() + elif url.startswith('http://'): + raise NitrateError("Encrypted https communication required for " +- "Kerberos authentication.\nURL provided: {0}".format(url)) ++ "GSSAPI authentication.\nURL provided: {0}".format(url)) + else: + raise NitrateError("Unrecognized URL scheme: {0}".format(url)) + +-- +2.16.1 + diff --git a/python-nitrate.spec b/python-nitrate.spec index 9c4262e..7098e9a 100644 --- a/python-nitrate.spec +++ b/python-nitrate.spec @@ -1,6 +1,6 @@ Name: python-nitrate Version: 1.3 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Python API for the Nitrate test case management system Group: Development/Languages @@ -9,6 +9,8 @@ License: LGPLv2 URL: http://psss.fedorapeople.org/python-nitrate/ Source0: http://psss.fedorapeople.org/python-nitrate/%{name}-%{version}.tar.bz2 +Patch0: Port-to-python-gssapi-from-pykerberos.patch + BuildArch: noarch BuildRequires: python2-devel @@ -23,13 +25,14 @@ line interpreter (useful for fast debugging and experimenting). %package -n python2-nitrate Summary: %summary -Requires: python2-kerberos python2-psycopg2 +Requires: python2-psycopg2 +Requires: python2-gssapi %{?python_provide:%python_provide python2-nitrate} %description -n python2-nitrate %_description %prep -%setup -q +%autosetup -S git %build @@ -48,6 +51,10 @@ install -pm 644 docs/*.1.gz %{buildroot}%{_mandir}/man1 %doc COPYING README examples %changelog +* Mon Mar 05 2018 Robbie Harwood - 1.3-9 +- Apply patch to port from python2-kerberos to python2-gssapi +- Resolves: #1546882 + * Fri Feb 09 2018 Fedora Release Engineering - 1.3-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild