Blame src/tests/t_renprinc.py

Packit fd8b60
# Copyright (C) 2011 by the Massachusetts Institute of Technology.
Packit fd8b60
# All rights reserved.
Packit fd8b60
Packit fd8b60
# Export of this software from the United States of America may
Packit fd8b60
#   require a specific license from the United States Government.
Packit fd8b60
#   It is the responsibility of any person or organization contemplating
Packit fd8b60
#   export to obtain such a license before exporting.
Packit fd8b60
#
Packit fd8b60
# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
Packit fd8b60
# distribute this software and its documentation for any purpose and
Packit fd8b60
# without fee is hereby granted, provided that the above copyright
Packit fd8b60
# notice appear in all copies and that both that copyright notice and
Packit fd8b60
# this permission notice appear in supporting documentation, and that
Packit fd8b60
# the name of M.I.T. not be used in advertising or publicity pertaining
Packit fd8b60
# to distribution of the software without specific, written prior
Packit fd8b60
# permission.  Furthermore if you modify this software you must label
Packit fd8b60
# your software as modified software and not distribute it in such a
Packit fd8b60
# fashion that it might be confused with the original M.I.T. software.
Packit fd8b60
# M.I.T. makes no representations about the suitability of
Packit fd8b60
# this software for any purpose.  It is provided "as is" without express
Packit fd8b60
# or implied warranty.
Packit fd8b60
Packit fd8b60
from k5test import *
Packit fd8b60
Packit fd8b60
enctype = "aes128-cts"
Packit fd8b60
Packit fd8b60
realm = K5Realm(create_host=False, create_user=False)
Packit fd8b60
salttypes = ('normal', 'norealm', 'onlyrealm')
Packit fd8b60
Packit fd8b60
# For a variety of salt types, test that we can rename a principal and
Packit fd8b60
# still get tickets with the same password.
Packit fd8b60
for st in salttypes:
Packit fd8b60
    realm.run([kadminl, 'addprinc', '-e', enctype + ':' + st,
Packit fd8b60
               '-pw', password(st), st])
Packit fd8b60
    realm.kinit(st, password(st))
Packit fd8b60
    newprinc = 'new' + st
Packit fd8b60
    realm.run([kadminl, 'renprinc', st, newprinc])
Packit fd8b60
    realm.kinit(newprinc, password(st))
Packit fd8b60
Packit fd8b60
# Rename the normal salt again to test renaming a principal with
Packit fd8b60
# special salt type (which it will have after the first rename).
Packit fd8b60
realm.run([kadminl, 'renprinc', 'newnormal', 'newnormal2'])
Packit fd8b60
realm.kinit('newnormal2', password('normal'))
Packit fd8b60
Packit fd8b60
success('Principal renaming tests')