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
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)