From 8103e5386ca9c47e20ca6409bbaad6c7c0986313 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Dec 11 2016 21:39:29 +0000 Subject: Make proxyuser consistent between ssl and krb Currently, krb would expect a krb principal where ssl expects a username. This makes krb use the username, but also accept the krb_principal for backwards compatibility. Signed-off-by: Patrick Uiterwijk --- diff --git a/koji/auth.py b/koji/auth.py index ef2f338..5e6fd15 100644 --- a/koji/auth.py +++ b/koji/auth.py @@ -578,11 +578,11 @@ class Session(object): #for compatibility return self.host_id - def getUserIdFromKerberos(self, krb_principal): - """Return the user ID associated with a particular Kerberos principal. - If no user with the given princpal if found, return None.""" + def getUserIdFromKerberos(self, username): + """Return the user ID associated with a particular username or Kerberos + principal. If no user with the given princpal if found, return None.""" c = context.cnx.cursor() - q = """SELECT id FROM users WHERE krb_principal = %(krb_principal)s""" + q = """SELECT id FROM users WHERE krb_principal = %(username)s or name = %(username)s""" c.execute(q, locals()) r = c.fetchone() c.close()