summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-02-03 12:25:10 -0500
committerGreg Hudson <ghudson@mit.edu>2013-02-07 12:54:55 -0500
commit62d0f78c3b420eba1812d232c03ea25a59d5ce64 (patch)
tree94c9ec8097ccaa73498bbbf7e23b39535735659b /src/tests
parent8d01455ec9ed88bd3ccae939961a6e123bb3d45f (diff)
downloadkrb5-62d0f78c3b420eba1812d232c03ea25a59d5ce64.tar.gz
krb5-62d0f78c3b420eba1812d232c03ea25a59d5ce64.tar.xz
krb5-62d0f78c3b420eba1812d232c03ea25a59d5ce64.zip
Add kprop Python tests
Create a K5Realm.kprop_port method so test scripts can invoke kprop usefully, and create a simple Python test script exercising the same kprop functionality as the dejagnu suite's kprop.exp.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/Makefile.in1
-rw-r--r--src/tests/t_kprop.py44
2 files changed, 45 insertions, 0 deletions
diff --git a/src/tests/Makefile.in b/src/tests/Makefile.in
index f23ac443af..92d8d6889b 100644
--- a/src/tests/Makefile.in
+++ b/src/tests/Makefile.in
@@ -76,6 +76,7 @@ check-pytests:: gcred hist kdbtest
$(RUNPYTEST) $(srcdir)/t_general.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_dump.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_iprop.py $(PYTESTFLAGS)
+ $(RUNPYTEST) $(srcdir)/t_kprop.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_anonpkinit.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_policy.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_kadm5_hook.py $(PYTESTFLAGS)
diff --git a/src/tests/t_kprop.py b/src/tests/t_kprop.py
new file mode 100644
index 0000000000..ff6290236b
--- /dev/null
+++ b/src/tests/t_kprop.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+from k5test import *
+
+conf_slave = {'dbmodules': {'db': {'database_name': '$testdir/db.slave'}}}
+
+# kprop/kpropd are the only users of krb5_auth_con_initivector, so run
+# this test over all enctypes to exercise mkpriv cipher state.
+for realm in multipass_realms(create_user=False):
+ slave = realm.special_env('slave', True, kdc_conf=conf_slave)
+
+ # Set up the kpropd acl file.
+ acl_file = os.path.join(realm.testdir, 'kpropd-acl')
+ acl = open(acl_file, 'w')
+ acl.write(realm.host_princ + '\n')
+ acl.close()
+
+ # Create the slave db.
+ dumpfile = os.path.join(realm.testdir, 'dump')
+ realm.run([kdb5_util, 'dump', dumpfile])
+ realm.run([kdb5_util, 'load', dumpfile], slave)
+ realm.run([kdb5_util, 'stash', '-P', 'master'], slave)
+
+ # Make some changes to the master db.
+ realm.addprinc('wakawaka')
+
+ # Start kpropd.
+ kpropd = realm.start_kpropd(slave, ['-d', '-t'])
+
+ realm.run([kdb5_util, 'dump', dumpfile])
+ realm.run([kprop, '-f', dumpfile, '-P', str(realm.kprop_port()), hostname])
+ output('*** kpropd output follows\n')
+ while True:
+ line = kpropd.stdout.readline()
+ if line == '':
+ break
+ output('kpropd: ' + line)
+ if 'Rejected connection' in line:
+ fail('kpropd rejected connection from kprop')
+
+ out = realm.run_kadminl('listprincs', slave)
+ if 'wakawaka' not in out:
+ fail('Slave does not have all principals from master')
+
+success('kprop tests')