Blob Blame Raw
From 88e92b61a4a4eacf5ccd14566ecfa473d6719a8f Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <patrick@puiterwijk.org>
Date: Aug 13 2019 11:35:14 +0000
Subject: [PATCH 1/2] Allow builder to attempt krb if gssapi is available


Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>

---

diff --git a/builder/kojid b/builder/kojid
index 142a440..86af4e5 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -69,6 +69,11 @@ except ImportError:  # pragma: no cover
     krbV = None
 
 try:
+    import requests_kerberos
+except ImportError:  # pragma: no cover
+    requests_kerberos = None
+
+try:
     import librepo
     import io
 except ImportError:
@@ -6264,7 +6269,7 @@ if __name__ == "__main__":
             quit("Error: Unable to log in. Bad credentials?")
         except six.moves.xmlrpc_client.ProtocolError:
             quit("Error: Unable to connect to server %s" % (options.server))
-    elif krbV:
+    elif krbV or requests_kerberos:
         krb_principal = options.krb_principal
         if krb_principal is None:
             krb_principal = options.host_principal_format % socket.getfqdn()

From 8b76e0d1af3b4e6d1faf04cbc9142c277c2cd613 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Aug 13 2019 11:53:16 +0000
Subject: [PATCH 2/2] fix krbV error handling


Fixes: https://pagure.io/koji/issue/1575

---

diff --git a/builder/kojid b/builder/kojid
index 86af4e5..73c2bf7 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -65,11 +65,13 @@ from koji.util import parseStatus, isSuccess, dslice, dslice_ex, to_list
 
 try:
     import krbV
+    Krb5Error = krbV.Krb5Error
 except ImportError:  # pragma: no cover
     krbV = None
 
 try:
     import requests_kerberos
+    Krb5Error = requests_kerberos.exceptions.RequestException
 except ImportError:  # pragma: no cover
     requests_kerberos = None
 
@@ -6277,8 +6279,8 @@ if __name__ == "__main__":
             session.krb_login(principal=krb_principal,
                               keytab=options.keytab,
                               ccache=options.ccache)
-        except krbV.Krb5Error as e:
-            quit("Kerberos authentication failed: '%s' (%s)" % (e.args[1], e.args[0]))
+        except Krb5Error as e:
+            quit("Kerberos authentication failed: %s" % e.args)
         except socket.error as e:
             quit("Could not connect to Kerberos authentication service: '%s'" % e.args[1])
     else: