From f8aea528d7813a1e6ea648510483ca6d371f75ba Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Wed, 25 Nov 2009 23:43:21 -0500 Subject: [PATCH] Until we switch to storing krb5 principals in the database, we need to convert the AFS-style principals in the database to krb5 principals. Hopefully this code can be torn out one of these days in the not-so-distant future. svn path=/trunk/packages/invirt-dev/; revision=2566 --- invirt-build-conf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/invirt-build-conf b/invirt-build-conf index f74b05d..4c5039f 100755 --- a/invirt-build-conf +++ b/invirt-build-conf @@ -14,6 +14,17 @@ from invirt.authz import mech as authz from invirt.config import structs as config +def userToPrinc(user): + """Convert an AFS principal to a Kerberos v5 principal.""" + if '@' in user: + (princ, realm) = user.split('@') + else: + princ = user + realm = config.kerberos.realm + + return princ.replace('.', '/') + '@' + realm + + def main(): # Python could really use a file-like object that gets written to # a temporary path and moved to its final resting place on @@ -25,7 +36,7 @@ def main(): acl = authz.expandAdmin(getattr(config.git.pockets, pocket).acl, None) acl_fd = tempfile.NamedTemporaryFile(delete=False) - print >>acl_fd, '\n'.join(acl) + print >>acl_fd, '\n'.join(user(a) for a in acl) acl_path = os.path.join('/etc/remctl/acl/build-%s' % pocket) -- 1.7.9.5