krb5 commit: Add more tests for dump and load

Greg Hudson ghudson at MIT.EDU
Mon Feb 4 18:29:58 EST 2013


https://github.com/krb5/krb5/commit/a71ba2c85329f3a0573bf51cad46f0d3facd5d0e
commit a71ba2c85329f3a0573bf51cad46f0d3facd5d0e
Author: Greg Hudson <ghudson at mit.edu>
Date:   Mon Feb 4 18:21:45 2013 -0500

    Add more tests for dump and load
    
    Move the existing dump/load tests from t_general.py to a new script
    t_dump.py.  Add additional tests using pre-created dumpfiles, to
    exercise the -r18, -r13, -b7, and -ov formats.
    
    bigredbutton: whitespace

 src/tests/Makefile.in        |    1 +
 src/tests/dumpfiles/dump     |   10 ++++
 src/tests/dumpfiles/dump.b7  |   10 ++++
 src/tests/dumpfiles/dump.ov  |    8 +++
 src/tests/dumpfiles/dump.r13 |   10 ++++
 src/tests/dumpfiles/dump.r18 |   10 ++++
 src/tests/t_dump.py          |  101 ++++++++++++++++++++++++++++++++++++++++++
 src/tests/t_general.py       |   27 +-----------
 8 files changed, 151 insertions(+), 26 deletions(-)

diff --git a/src/tests/Makefile.in b/src/tests/Makefile.in
index 4de5504..f23ac44 100644
--- a/src/tests/Makefile.in
+++ b/src/tests/Makefile.in
@@ -74,6 +74,7 @@ kdb_check: kdc.conf krb5.conf
 
 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_anonpkinit.py $(PYTESTFLAGS)
 	$(RUNPYTEST) $(srcdir)/t_policy.py $(PYTESTFLAGS)
diff --git a/src/tests/dumpfiles/dump b/src/tests/dumpfiles/dump
new file mode 100644
index 0000000..27378d8
--- /dev/null
+++ b/src/tests/dumpfiles/dump
@@ -0,0 +1,10 @@
+kdb5_util load_dump version 7
+princ	38	15	3	1	0	K/M at KRBTEST.COM	64	86400	0	0	0	0	0	0	8	2	0100	9	8	0100010000000000	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000408c027c250e8cc3b81476414f2214d57c1ce38891e29792e87258247c73547df4d5756266931dd6686b62270e656895a31ec66bfe913b4f15226227	-1;
+princ	38	36	4	4	0	host/equal-rites.mit.edu at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20009b7f9e9edd44559c5ffb2b52beb92e57586f9bdf59ae0be7010ffa8b628928bebc7d6015211977bc34325be853e5f1eb5826ce75575414bc2696bc16	1	1	17	46	10001bfaf4d8ddd6e8767194a190e9dec2617dbc90883db767fa464325b76b97ea98f3b61c4d4234ff9aee6314a4	1	1	16	54	18008291ce8c2ccde958c2739e93ce499b088b1b8c304bce95097bd6c1bd92c3c9f64e92950767f7806d890b386ba586fdb7f8433f1c	1	1	23	46	1000a460520a9e39b1539e703a51793967247999a9a0bb7c59a61ca2b5e64a58c3b9cf8217daeddd71caae9d7fbb	-1;
+princ	38	24	4	4	0	kadmin/admin at KRBTEST.COM	4	10800	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20005ea70b11f3337975c5463baedc68b234cadf72f89828d98e3c16cb8640bba7c5ed48a4bcf7649a73a9a410e96234924bfacd4bb38f08982db02c5c5b	1	1	17	46	10001b678f8b9bb6913397202c259702c1941fd5d2892f42349a92ca908de248cd041465bb3d16d27efce1f63e30	1	1	16	54	18009ed81fe14b19549918acad7b1158b86f5971ab3bd77b2359c29147af35730167210157e510dda65f691c312ac398850d7e228c40	1	1	23	46	10001d15a249bbea104208ae0b3d83337d4c06f6edef6a6ac60ec3df7b52aeeeb388c7233a9b1e3de646949ed540	-1;
+princ	38	27	4	4	0	kadmin/changepw at KRBTEST.COM	8196	300	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200015daf7bc8073eae166b03231330b81b78cfd6021d3dcf3700862dc98725c5bb549a72aa2ae8eef37dc2db5acc59cc62600f72052c6238ef216dd24a5	1	1	17	46	1000c1e176f253d6292fe4e34b2edfbdd5ff81ff3e17b38c2a674bd738d20fc40a4ed38a02351f4a9872123fb865	1	1	16	54	18008bf3418871e7d117af489798fbbcc031c534e095b4e4ed6cb110c7d87a91e5fb6c080c77616618db80ed37589fcc0ca8328406ef	1	1	23	46	10007a522025d2e7126dc48d76218e9efb3ff4326a3b5969be0deac108657a9d23c7827ec39b828fd43e51ea114b	-1;
+princ	38	38	4	4	0	kadmin/equal-rites.mit.edu at KRBTEST.COM	4	10800	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200045a2e5b79c5787bfc68700d3abc0034cc91d48f10636c35e1a571c41c4e6892caceeda8808bfa46aa4050a6d33d99cb64d237f645af6741e90c723ff	1	1	17	46	100073b99fecd81b4fe113b10852065c15e75ed7d256d2d242b3cca57317c28c7fece4bda797f116309ea5bc2eb1	1	1	16	54	1800bd05672170b5d04cb62394498988f3844b744a0793ac435d044e67ed0ee50d20c408b30cec599c169378b0ad2a4967f42aef38e5	1	1	23	46	1000a1a515e0fe322980f319752bf85dd405ca2bdda148009654584b70f50d38c532df1c2d0a3c56f9758775b007	-1;
+princ	38	30	1	4	0	krbtgt/KRBTEST.COM at KRBTEST.COM	0	86400	0	0	0	0	0	0	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000582c9aaf26c4a0abf13600baf37718c91e15dca02385e346cf5d2730d28b2302677f23d02791299548b45e1ced0b05cd30062617bff7532885d7889c	1	1	17	46	1000122eb47263d7837771ebbf7ad82163cc2ea7674a417944c0cbf186522fc0e74a73affd4a42fb9fda287be4f8	1	1	16	54	18008cd8064aea468f13f36ae13ecd4f993d87ef6bafcb2dc5101ad903200ffe3d5c265b2f0c71a6c07ec60d259b6862825cc77a70b2	1	1	23	46	10001699ad0304644456106328fbd733bd5c524f20d4b5d8b8e370eff196803b5990ee7e9eb4b6c2214cf327f59b	-1;
+princ	38	22	4	4	0	user/admin at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20002db4cd2b0824c44a17cdbb2d180a1ec9956db35d74741826ed0d77eaef9abdb20c481d5ab9f511d5a3e6b8def443382f03d247568d81529e5dd17fae	1	1	17	46	100011d7cc3627468d565d398cffd735a3cc9d3705cd9846cede198c7d07f4e8209cd9192bc6c5f127169c00f373	1	1	16	54	18002bd9dc3388c90055844b3b4c5c2a814d73758f226d44d7dc5e35ef3b65e7d80cd604a4ef2a5769106818c3d813956bbad1813cb2	1	1	23	46	1000409681c3ff356fb7d28a9f71957c3465ea42ec4eee5019a662f7d367042527b76ae783cfbd0dccbd7529d090	-1;
+princ	38	16	4	4	0	user at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	32	12345c010000000874657374706f6c0000000800000000000000000200000000	2	27	d73e1051757365722f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	2000aec451aae295389f92d177e61b5154941386c70d75d382393e556dfa61bd77d112a777420a99030b56649d366bba83a5c40aa17fa4522222d2e78e10	1	1	17	46	10009c8ab7b3f89ccf3ca3ad98352a461b7f4f1b0c495605117591d9ad52ba4da0adef7a902126973ed2bdc3ffbf	1	1	16	54	18002b87a46d6c4de954a316b5ce28a99886f2abb6b0307190e577b81171dfb7a067139835be8625bc36b0edaaed357609107d85d335	1	1	23	46	1000c01fcdb3050a2270f82dbafbe4c1adc868377bf7133ee7a1bcaf85817abe541beb8008b91c54b99e93d2e0f5	-1;
+policy	testpol	0	0	1	3	1	0	0	0	0	0	0	0	-	0
diff --git a/src/tests/dumpfiles/dump.b7 b/src/tests/dumpfiles/dump.b7
new file mode 100644
index 0000000..6b810c9
--- /dev/null
+++ b/src/tests/dumpfiles/dump.b7
@@ -0,0 +1,10 @@
+kdb5_util load_dump version 4
+princ	38	15	3	1	0	K/M at KRBTEST.COM	64	86400	0	0	0	0	0	0	8	2	0100	9	8	0100010000000000	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000408c027c250e8cc3b81476414f2214d57c1ce38891e29792e87258247c73547df4d5756266931dd6686b62270e656895a31ec66bfe913b4f15226227	-1;
+princ	38	36	3	4	0	host/equal-rites.mit.edu at KRBTEST.COM	0	86400	0	0	0	0	0	0	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20009b7f9e9edd44559c5ffb2b52beb92e57586f9bdf59ae0be7010ffa8b628928bebc7d6015211977bc34325be853e5f1eb5826ce75575414bc2696bc16	1	1	17	46	10001bfaf4d8ddd6e8767194a190e9dec2617dbc90883db767fa464325b76b97ea98f3b61c4d4234ff9aee6314a4	1	1	16	54	18008291ce8c2ccde958c2739e93ce499b088b1b8c304bce95097bd6c1bd92c3c9f64e92950767f7806d890b386ba586fdb7f8433f1c	1	1	23	46	1000a460520a9e39b1539e703a51793967247999a9a0bb7c59a61ca2b5e64a58c3b9cf8217daeddd71caae9d7fbb	-1;
+princ	38	24	3	4	0	kadmin/admin at KRBTEST.COM	4	10800	0	0	0	0	0	0	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20005ea70b11f3337975c5463baedc68b234cadf72f89828d98e3c16cb8640bba7c5ed48a4bcf7649a73a9a410e96234924bfacd4bb38f08982db02c5c5b	1	1	17	46	10001b678f8b9bb6913397202c259702c1941fd5d2892f42349a92ca908de248cd041465bb3d16d27efce1f63e30	1	1	16	54	18009ed81fe14b19549918acad7b1158b86f5971ab3bd77b2359c29147af35730167210157e510dda65f691c312ac398850d7e228c40	1	1	23	46	10001d15a249bbea104208ae0b3d83337d4c06f6edef6a6ac60ec3df7b52aeeeb388c7233a9b1e3de646949ed540	-1;
+princ	38	27	3	4	0	kadmin/changepw at KRBTEST.COM	8196	300	0	0	0	0	0	0	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200015daf7bc8073eae166b03231330b81b78cfd6021d3dcf3700862dc98725c5bb549a72aa2ae8eef37dc2db5acc59cc62600f72052c6238ef216dd24a5	1	1	17	46	1000c1e176f253d6292fe4e34b2edfbdd5ff81ff3e17b38c2a674bd738d20fc40a4ed38a02351f4a9872123fb865	1	1	16	54	18008bf3418871e7d117af489798fbbcc031c534e095b4e4ed6cb110c7d87a91e5fb6c080c77616618db80ed37589fcc0ca8328406ef	1	1	23	46	10007a522025d2e7126dc48d76218e9efb3ff4326a3b5969be0deac108657a9d23c7827ec39b828fd43e51ea114b	-1;
+princ	38	38	3	4	0	kadmin/equal-rites.mit.edu at KRBTEST.COM	4	10800	0	0	0	0	0	0	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200045a2e5b79c5787bfc68700d3abc0034cc91d48f10636c35e1a571c41c4e6892caceeda8808bfa46aa4050a6d33d99cb64d237f645af6741e90c723ff	1	1	17	46	100073b99fecd81b4fe113b10852065c15e75ed7d256d2d242b3cca57317c28c7fece4bda797f116309ea5bc2eb1	1	1	16	54	1800bd05672170b5d04cb62394498988f3844b744a0793ac435d044e67ed0ee50d20c408b30cec599c169378b0ad2a4967f42aef38e5	1	1	23	46	1000a1a515e0fe322980f319752bf85dd405ca2bdda148009654584b70f50d38c532df1c2d0a3c56f9758775b007	-1;
+princ	38	30	1	4	0	krbtgt/KRBTEST.COM at KRBTEST.COM	0	86400	0	0	0	0	0	0	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000582c9aaf26c4a0abf13600baf37718c91e15dca02385e346cf5d2730d28b2302677f23d02791299548b45e1ced0b05cd30062617bff7532885d7889c	1	1	17	46	1000122eb47263d7837771ebbf7ad82163cc2ea7674a417944c0cbf186522fc0e74a73affd4a42fb9fda287be4f8	1	1	16	54	18008cd8064aea468f13f36ae13ecd4f993d87ef6bafcb2dc5101ad903200ffe3d5c265b2f0c71a6c07ec60d259b6862825cc77a70b2	1	1	23	46	10001699ad0304644456106328fbd733bd5c524f20d4b5d8b8e370eff196803b5990ee7e9eb4b6c2214cf327f59b	-1;
+princ	38	22	3	4	0	user/admin at KRBTEST.COM	0	86400	0	0	0	0	0	0	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20002db4cd2b0824c44a17cdbb2d180a1ec9956db35d74741826ed0d77eaef9abdb20c481d5ab9f511d5a3e6b8def443382f03d247568d81529e5dd17fae	1	1	17	46	100011d7cc3627468d565d398cffd735a3cc9d3705cd9846cede198c7d07f4e8209cd9192bc6c5f127169c00f373	1	1	16	54	18002bd9dc3388c90055844b3b4c5c2a814d73758f226d44d7dc5e35ef3b65e7d80cd604a4ef2a5769106818c3d813956bbad1813cb2	1	1	23	46	1000409681c3ff356fb7d28a9f71957c3465ea42ec4eee5019a662f7d367042527b76ae783cfbd0dccbd7529d090	-1;
+princ	38	16	3	4	0	user at KRBTEST.COM	0	86400	0	0	0	0	0	0	2	27	d73e1051757365722f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	2000aec451aae295389f92d177e61b5154941386c70d75d382393e556dfa61bd77d112a777420a99030b56649d366bba83a5c40aa17fa4522222d2e78e10	1	1	17	46	10009c8ab7b3f89ccf3ca3ad98352a461b7f4f1b0c495605117591d9ad52ba4da0adef7a902126973ed2bdc3ffbf	1	1	16	54	18002b87a46d6c4de954a316b5ce28a99886f2abb6b0307190e577b81171dfb7a067139835be8625bc36b0edaaed357609107d85d335	1	1	23	46	1000c01fcdb3050a2270f82dbafbe4c1adc868377bf7133ee7a1bcaf85817abe541beb8008b91c54b99e93d2e0f5	-1;
+policy	testpol	0	0	1	3	1	0
diff --git a/src/tests/dumpfiles/dump.ov b/src/tests/dumpfiles/dump.ov
new file mode 100644
index 0000000..35d99ba
--- /dev/null
+++ b/src/tests/dumpfiles/dump.ov
@@ -0,0 +1,8 @@
+OpenV*Secure V1.0	
+princ	host/equal-rites.mit.edu at KRBTEST.COM		0	0	0	2
+princ	kadmin/admin at KRBTEST.COM		0	0	0	2
+princ	kadmin/changepw at KRBTEST.COM		0	0	0	2
+princ	kadmin/equal-rites.mit.edu at KRBTEST.COM		0	0	0	2
+princ	user/admin at KRBTEST.COM		0	0	0	2
+princ	user at KRBTEST.COM	testpol	800	0	0	2
+policy	testpol	0	0	1	3	1	0
diff --git a/src/tests/dumpfiles/dump.r13 b/src/tests/dumpfiles/dump.r13
new file mode 100644
index 0000000..8faba2b
--- /dev/null
+++ b/src/tests/dumpfiles/dump.r13
@@ -0,0 +1,10 @@
+kdb5_util load_dump version 5
+princ	38	15	3	1	0	K/M at KRBTEST.COM	64	86400	0	0	0	0	0	0	8	2	0100	9	8	0100010000000000	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000408c027c250e8cc3b81476414f2214d57c1ce38891e29792e87258247c73547df4d5756266931dd6686b62270e656895a31ec66bfe913b4f15226227	-1;
+princ	38	36	4	4	0	host/equal-rites.mit.edu at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20009b7f9e9edd44559c5ffb2b52beb92e57586f9bdf59ae0be7010ffa8b628928bebc7d6015211977bc34325be853e5f1eb5826ce75575414bc2696bc16	1	1	17	46	10001bfaf4d8ddd6e8767194a190e9dec2617dbc90883db767fa464325b76b97ea98f3b61c4d4234ff9aee6314a4	1	1	16	54	18008291ce8c2ccde958c2739e93ce499b088b1b8c304bce95097bd6c1bd92c3c9f64e92950767f7806d890b386ba586fdb7f8433f1c	1	1	23	46	1000a460520a9e39b1539e703a51793967247999a9a0bb7c59a61ca2b5e64a58c3b9cf8217daeddd71caae9d7fbb	-1;
+princ	38	24	4	4	0	kadmin/admin at KRBTEST.COM	4	10800	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20005ea70b11f3337975c5463baedc68b234cadf72f89828d98e3c16cb8640bba7c5ed48a4bcf7649a73a9a410e96234924bfacd4bb38f08982db02c5c5b	1	1	17	46	10001b678f8b9bb6913397202c259702c1941fd5d2892f42349a92ca908de248cd041465bb3d16d27efce1f63e30	1	1	16	54	18009ed81fe14b19549918acad7b1158b86f5971ab3bd77b2359c29147af35730167210157e510dda65f691c312ac398850d7e228c40	1	1	23	46	10001d15a249bbea104208ae0b3d83337d4c06f6edef6a6ac60ec3df7b52aeeeb388c7233a9b1e3de646949ed540	-1;
+princ	38	27	4	4	0	kadmin/changepw at KRBTEST.COM	8196	300	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200015daf7bc8073eae166b03231330b81b78cfd6021d3dcf3700862dc98725c5bb549a72aa2ae8eef37dc2db5acc59cc62600f72052c6238ef216dd24a5	1	1	17	46	1000c1e176f253d6292fe4e34b2edfbdd5ff81ff3e17b38c2a674bd738d20fc40a4ed38a02351f4a9872123fb865	1	1	16	54	18008bf3418871e7d117af489798fbbcc031c534e095b4e4ed6cb110c7d87a91e5fb6c080c77616618db80ed37589fcc0ca8328406ef	1	1	23	46	10007a522025d2e7126dc48d76218e9efb3ff4326a3b5969be0deac108657a9d23c7827ec39b828fd43e51ea114b	-1;
+princ	38	38	4	4	0	kadmin/equal-rites.mit.edu at KRBTEST.COM	4	10800	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200045a2e5b79c5787bfc68700d3abc0034cc91d48f10636c35e1a571c41c4e6892caceeda8808bfa46aa4050a6d33d99cb64d237f645af6741e90c723ff	1	1	17	46	100073b99fecd81b4fe113b10852065c15e75ed7d256d2d242b3cca57317c28c7fece4bda797f116309ea5bc2eb1	1	1	16	54	1800bd05672170b5d04cb62394498988f3844b744a0793ac435d044e67ed0ee50d20c408b30cec599c169378b0ad2a4967f42aef38e5	1	1	23	46	1000a1a515e0fe322980f319752bf85dd405ca2bdda148009654584b70f50d38c532df1c2d0a3c56f9758775b007	-1;
+princ	38	30	1	4	0	krbtgt/KRBTEST.COM at KRBTEST.COM	0	86400	0	0	0	0	0	0	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000582c9aaf26c4a0abf13600baf37718c91e15dca02385e346cf5d2730d28b2302677f23d02791299548b45e1ced0b05cd30062617bff7532885d7889c	1	1	17	46	1000122eb47263d7837771ebbf7ad82163cc2ea7674a417944c0cbf186522fc0e74a73affd4a42fb9fda287be4f8	1	1	16	54	18008cd8064aea468f13f36ae13ecd4f993d87ef6bafcb2dc5101ad903200ffe3d5c265b2f0c71a6c07ec60d259b6862825cc77a70b2	1	1	23	46	10001699ad0304644456106328fbd733bd5c524f20d4b5d8b8e370eff196803b5990ee7e9eb4b6c2214cf327f59b	-1;
+princ	38	22	4	4	0	user/admin at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20002db4cd2b0824c44a17cdbb2d180a1ec9956db35d74741826ed0d77eaef9abdb20c481d5ab9f511d5a3e6b8def443382f03d247568d81529e5dd17fae	1	1	17	46	100011d7cc3627468d565d398cffd735a3cc9d3705cd9846cede198c7d07f4e8209cd9192bc6c5f127169c00f373	1	1	16	54	18002bd9dc3388c90055844b3b4c5c2a814d73758f226d44d7dc5e35ef3b65e7d80cd604a4ef2a5769106818c3d813956bbad1813cb2	1	1	23	46	1000409681c3ff356fb7d28a9f71957c3465ea42ec4eee5019a662f7d367042527b76ae783cfbd0dccbd7529d090	-1;
+princ	38	16	4	4	0	user at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	32	12345c010000000874657374706f6c0000000800000000000000000200000000	2	27	d73e1051757365722f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	2000aec451aae295389f92d177e61b5154941386c70d75d382393e556dfa61bd77d112a777420a99030b56649d366bba83a5c40aa17fa4522222d2e78e10	1	1	17	46	10009c8ab7b3f89ccf3ca3ad98352a461b7f4f1b0c495605117591d9ad52ba4da0adef7a902126973ed2bdc3ffbf	1	1	16	54	18002b87a46d6c4de954a316b5ce28a99886f2abb6b0307190e577b81171dfb7a067139835be8625bc36b0edaaed357609107d85d335	1	1	23	46	1000c01fcdb3050a2270f82dbafbe4c1adc868377bf7133ee7a1bcaf85817abe541beb8008b91c54b99e93d2e0f5	-1;
+policy	testpol	0	0	1	3	1	0
diff --git a/src/tests/dumpfiles/dump.r18 b/src/tests/dumpfiles/dump.r18
new file mode 100644
index 0000000..41ca05e
--- /dev/null
+++ b/src/tests/dumpfiles/dump.r18
@@ -0,0 +1,10 @@
+kdb5_util load_dump version 6
+princ	38	15	3	1	0	K/M at KRBTEST.COM	64	86400	0	0	0	0	0	0	8	2	0100	9	8	0100010000000000	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000408c027c250e8cc3b81476414f2214d57c1ce38891e29792e87258247c73547df4d5756266931dd6686b62270e656895a31ec66bfe913b4f15226227	-1;
+princ	38	36	4	4	0	host/equal-rites.mit.edu at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20009b7f9e9edd44559c5ffb2b52beb92e57586f9bdf59ae0be7010ffa8b628928bebc7d6015211977bc34325be853e5f1eb5826ce75575414bc2696bc16	1	1	17	46	10001bfaf4d8ddd6e8767194a190e9dec2617dbc90883db767fa464325b76b97ea98f3b61c4d4234ff9aee6314a4	1	1	16	54	18008291ce8c2ccde958c2739e93ce499b088b1b8c304bce95097bd6c1bd92c3c9f64e92950767f7806d890b386ba586fdb7f8433f1c	1	1	23	46	1000a460520a9e39b1539e703a51793967247999a9a0bb7c59a61ca2b5e64a58c3b9cf8217daeddd71caae9d7fbb	-1;
+princ	38	24	4	4	0	kadmin/admin at KRBTEST.COM	4	10800	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20005ea70b11f3337975c5463baedc68b234cadf72f89828d98e3c16cb8640bba7c5ed48a4bcf7649a73a9a410e96234924bfacd4bb38f08982db02c5c5b	1	1	17	46	10001b678f8b9bb6913397202c259702c1941fd5d2892f42349a92ca908de248cd041465bb3d16d27efce1f63e30	1	1	16	54	18009ed81fe14b19549918acad7b1158b86f5971ab3bd77b2359c29147af35730167210157e510dda65f691c312ac398850d7e228c40	1	1	23	46	10001d15a249bbea104208ae0b3d83337d4c06f6edef6a6ac60ec3df7b52aeeeb388c7233a9b1e3de646949ed540	-1;
+princ	38	27	4	4	0	kadmin/changepw at KRBTEST.COM	8196	300	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200015daf7bc8073eae166b03231330b81b78cfd6021d3dcf3700862dc98725c5bb549a72aa2ae8eef37dc2db5acc59cc62600f72052c6238ef216dd24a5	1	1	17	46	1000c1e176f253d6292fe4e34b2edfbdd5ff81ff3e17b38c2a674bd738d20fc40a4ed38a02351f4a9872123fb865	1	1	16	54	18008bf3418871e7d117af489798fbbcc031c534e095b4e4ed6cb110c7d87a91e5fb6c080c77616618db80ed37589fcc0ca8328406ef	1	1	23	46	10007a522025d2e7126dc48d76218e9efb3ff4326a3b5969be0deac108657a9d23c7827ec39b828fd43e51ea114b	-1;
+princ	38	38	4	4	0	kadmin/equal-rites.mit.edu at KRBTEST.COM	4	10800	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	26	b93e10516b6462355f7574696c404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	200045a2e5b79c5787bfc68700d3abc0034cc91d48f10636c35e1a571c41c4e6892caceeda8808bfa46aa4050a6d33d99cb64d237f645af6741e90c723ff	1	1	17	46	100073b99fecd81b4fe113b10852065c15e75ed7d256d2d242b3cca57317c28c7fece4bda797f116309ea5bc2eb1	1	1	16	54	1800bd05672170b5d04cb62394498988f3844b744a0793ac435d044e67ed0ee50d20c408b30cec599c169378b0ad2a4967f42aef38e5	1	1	23	46	1000a1a515e0fe322980f319752bf85dd405ca2bdda148009654584b70f50d38c532df1c2d0a3c56f9758775b007	-1;
+princ	38	30	1	4	0	krbtgt/KRBTEST.COM at KRBTEST.COM	0	86400	0	0	0	0	0	0	2	28	b93e105164625f6372656174696f6e404b5242544553542e434f4d00	1	1	18	62	2000582c9aaf26c4a0abf13600baf37718c91e15dca02385e346cf5d2730d28b2302677f23d02791299548b45e1ced0b05cd30062617bff7532885d7889c	1	1	17	46	1000122eb47263d7837771ebbf7ad82163cc2ea7674a417944c0cbf186522fc0e74a73affd4a42fb9fda287be4f8	1	1	16	54	18008cd8064aea468f13f36ae13ecd4f993d87ef6bafcb2dc5101ad903200ffe3d5c265b2f0c71a6c07ec60d259b6862825cc77a70b2	1	1	23	46	10001699ad0304644456106328fbd733bd5c524f20d4b5d8b8e370eff196803b5990ee7e9eb4b6c2214cf327f59b	-1;
+princ	38	22	4	4	0	user/admin at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	24	12345c010000000000000000000000000000000200000000	2	30	b93e105167687564736f6e2f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	20002db4cd2b0824c44a17cdbb2d180a1ec9956db35d74741826ed0d77eaef9abdb20c481d5ab9f511d5a3e6b8def443382f03d247568d81529e5dd17fae	1	1	17	46	100011d7cc3627468d565d398cffd735a3cc9d3705cd9846cede198c7d07f4e8209cd9192bc6c5f127169c00f373	1	1	16	54	18002bd9dc3388c90055844b3b4c5c2a814d73758f226d44d7dc5e35ef3b65e7d80cd604a4ef2a5769106818c3d813956bbad1813cb2	1	1	23	46	1000409681c3ff356fb7d28a9f71957c3465ea42ec4eee5019a662f7d367042527b76ae783cfbd0dccbd7529d090	-1;
+princ	38	16	4	4	0	user at KRBTEST.COM	0	86400	0	0	0	0	0	0	3	32	12345c010000000874657374706f6c0000000800000000000000000200000000	2	27	d73e1051757365722f61646d696e404b5242544553542e434f4d00	8	2	0100	1	4	b93e1051	1	1	18	62	2000aec451aae295389f92d177e61b5154941386c70d75d382393e556dfa61bd77d112a777420a99030b56649d366bba83a5c40aa17fa4522222d2e78e10	1	1	17	46	10009c8ab7b3f89ccf3ca3ad98352a461b7f4f1b0c495605117591d9ad52ba4da0adef7a902126973ed2bdc3ffbf	1	1	16	54	18002b87a46d6c4de954a316b5ce28a99886f2abb6b0307190e577b81171dfb7a067139835be8625bc36b0edaaed357609107d85d335	1	1	23	46	1000c01fcdb3050a2270f82dbafbe4c1adc868377bf7133ee7a1bcaf85817abe541beb8008b91c54b99e93d2e0f5	-1;
+policy	testpol	0	0	1	3	1	0	0	0	0
diff --git a/src/tests/t_dump.py b/src/tests/t_dump.py
new file mode 100644
index 0000000..239bbcc
--- /dev/null
+++ b/src/tests/t_dump.py
@@ -0,0 +1,101 @@
+#!/usr/bin/python
+from k5test import *
+from filecmp import cmp
+
+# Make sure we can dump and load an ordinary database, and that
+# principals and policies survive a dump/load cycle.
+
+realm = K5Realm(start_kdc=False)
+realm.run_kadminl('addpol fred')
+
+# Create a dump file.
+dumpfile = os.path.join(realm.testdir, 'dump')
+realm.run([kdb5_util, 'dump', dumpfile])
+
+# Write an additional policy record to the dump.
+f = open('testdir/dump', 'a')
+f.write('policy	barney	0	0	1	1	1	0	'
+        '0	0	0	0	0	0	-	1	'
+        '2	28	'
+        'fd100f5064625f6372656174696f6e404b5242544553542e434f4d00')
+f.close()
+
+# Destroy and load the database; check that the policies exist.
+# Spot-check principal and policy fields.
+realm.run([kdb5_util, 'destroy', '-f'])
+realm.run([kdb5_util, 'load', dumpfile])
+out = realm.run_kadminl('getprincs')
+if realm.user_princ not in out or realm.host_princ not in out:
+    fail('Missing principal after load')
+out = realm.run_kadminl('getprinc %s' % realm.user_princ)
+if 'Expiration date: [never]' not in out or 'MKey: vno 1' not in out:
+    fail('Principal has wrong value after load')
+out = realm.run_kadminl('getpols')
+if 'fred\n' not in out or 'barney\n' not in out:
+    fail('Missing policy after load')
+out = realm.run_kadminl('getpol barney')
+if 'Number of old keys kept: 1' not in out:
+    fail('Policy has wrong value after load')
+
+# Dump/load again, and make sure everything is still there.
+realm.run([kdb5_util, 'dump', dumpfile])
+realm.run([kdb5_util, 'load', dumpfile])
+out = realm.run_kadminl('getprincs')
+if realm.user_princ not in out or realm.host_princ not in out:
+    fail('Missing principal after load')
+out = realm.run_kadminl('getpols')
+if 'fred\n' not in out or 'barney\n' not in out:
+    fail('Missing policy after second load')
+
+srcdumpdir = os.path.join(srctop, 'tests', 'dumpfiles')
+srcdump = os.path.join(srcdumpdir, 'dump')
+srcdump_r18 = os.path.join(srcdumpdir, 'dump.r18')
+srcdump_r13 = os.path.join(srcdumpdir, 'dump.r13')
+srcdump_b7 = os.path.join(srcdumpdir, 'dump.b7')
+srcdump_ov = os.path.join(srcdumpdir, 'dump.ov')
+
+# Load a dump file from the source directory.
+realm.run([kdb5_util, 'destroy', '-f'])
+realm.run([kdb5_util, 'load', srcdump])
+realm.run([kdb5_util, 'stash', '-P', 'master'])
+
+def dump_compare(realm, opt, srcfile):
+    realm.run([kdb5_util, 'dump'] + opt + [dumpfile])
+    if not cmp(srcfile, dumpfile, False):
+        fail('Dump output does not match %s' % srcfile)
+
+# Dump the resulting DB in each non-iprop format and compare with
+# expected outputs.
+dump_compare(realm, [], srcdump)
+dump_compare(realm, ['-r18'], srcdump_r18)
+dump_compare(realm, ['-r13'], srcdump_r13)
+dump_compare(realm, ['-b7'], srcdump_b7)
+dump_compare(realm, ['-ov'], srcdump_ov)
+
+def load_dump_check_compare(realm, opt, srcfile):
+    realm.run([kdb5_util, 'destroy', '-f'])
+    realm.run([kdb5_util, 'load'] + opt + [srcfile])
+    out = realm.run_kadminl('getprincs')
+    if 'user@' not in out:
+        fail('Loaded dumpfile missing user principal')
+    out = realm.run_kadminl('getpols')
+    if 'testpol' not in out:
+        fail('Loaded dumpfile missing test policy')
+    dump_compare(realm, opt, srcfile)
+
+# Load each format of dump, check it, re-dump it, and compare.
+load_dump_check_compare(realm, ['-r18'], srcdump_r18)
+load_dump_check_compare(realm, ['-r13'], srcdump_r13)
+load_dump_check_compare(realm, ['-b7'], srcdump_b7)
+
+# Loading the last (-b7 format) dump won't have loaded the
+# per-principal kadm data.  Load that incrementally with -ov.
+out = realm.run_kadminl('getprinc user')
+if 'Policy: [none]' not in out:
+    fail('Loaded b7 dump unexpectedly contains user policy reference')
+realm.run([kdb5_util, 'load', '-update', '-ov', srcdump_ov])
+out = realm.run_kadminl('getprinc user')
+if 'Policy: testpol' not in out:
+    fail('Loading ov dump did not add user policy reference')
+
+success('Dump/load tests')
diff --git a/src/tests/t_general.py b/src/tests/t_general.py
index 1ba95dc..bb7a543 100755
--- a/src/tests/t_general.py
+++ b/src/tests/t_general.py
@@ -24,31 +24,6 @@ for realm in multipass_realms(create_host=False):
 
 realm = K5Realm(create_host=False)
 
-# Create a policy and see if it survives a dump/load.
-realm.run_kadminl('addpol fred')
-dumpfile = os.path.join(realm.testdir, 'dump')
-realm.run([kdb5_util, 'dump', dumpfile])
-f = open('testdir/dump', 'a')
-f.write('policy	barney	0	0	1	1	1	0	'
-        '0	0	0	0	0	0	-	1	'
-        '2	28	'
-        'fd100f5064625f6372656174696f6e404b5242544553542e434f4d00')
-f.close()
-realm.run([kdb5_util, 'load', dumpfile])
-output = realm.run_kadminl('getpols')
-if 'fred\n' not in output:
-    fail('Policy not preserved across dump/load.')
-if 'barney\n' not in output:
-    fail('Policy not loaded.')
-
-realm.run([kdb5_util, 'dump', dumpfile])
-realm.run([kdb5_util, 'load', dumpfile])
-output = realm.run_kadminl('getpols')
-if 'fred\n' not in output:
-    fail('Policy not preserved across dump/load.')
-if 'barney\n' not in output:
-    fail('Policy not preserved across dump/load.')
-
 # Spot-check KRB5_TRACE output
 tracefile = os.path.join(realm.testdir, 'trace')
 realm.run(['env', 'KRB5_TRACE=' + tracefile, kinit, realm.user_princ],
@@ -67,4 +42,4 @@ for e in expected:
     if e not in trace:
         fail('Expected output not in kinit trace log')
 
-success('Dump/load, FAST kinit, kdestroy, trace logging')
+success('FAST kinit, trace logging')


More information about the cvs-krb5 mailing list