Changeset 2566


Ignore:
Timestamp:
Nov 25, 2009, 11:43:21 PM (15 years ago)
Author:
broder
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-dev/invirt-build-conf

    r2565 r2566  
    1515
    1616
     17def userToPrinc(user):
     18    """Convert an AFS principal to a Kerberos v5 principal."""
     19    if '@' in user:
     20        (princ, realm) = user.split('@')
     21    else:
     22        princ = user
     23        realm = config.kerberos.realm
     24
     25    return princ.replace('.', '/') + '@' + realm
     26
     27
    1728def main():
    1829    # Python could really use a file-like object that gets written to
     
    2637
    2738        acl_fd = tempfile.NamedTemporaryFile(delete=False)
    28         print >>acl_fd, '\n'.join(acl)
     39        print >>acl_fd, '\n'.join(user(a) for a in acl)
    2940
    3041        acl_path = os.path.join('/etc/remctl/acl/build-%s' % pocket)
Note: See TracChangeset for help on using the changeset viewer.