summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>1996-08-13 03:01:20 +0000
committerEzra Peisach <epeisach@mit.edu>1996-08-13 03:01:20 +0000
commitbb24f3beb3494b673a0ee187ea5225c21656357e (patch)
treef95348287d7b3abd1a4a3a7fbf6a5d2badd39357 /src/tests
parentd5f64d41e62b86ae8bdbadf504aa8662e4d39c37 (diff)
downloadkrb5-bb24f3beb3494b673a0ee187ea5225c21656357e.tar.gz
krb5-bb24f3beb3494b673a0ee187ea5225c21656357e.tar.xz
krb5-bb24f3beb3494b673a0ee187ea5225c21656357e.zip
Use kadmin.local instead of kdb5_edit
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8934 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/dejagnu/config/ChangeLog4
-rw-r--r--src/tests/dejagnu/config/default.exp81
-rw-r--r--src/tests/dejagnu/krb-standalone/ChangeLog4
-rw-r--r--src/tests/dejagnu/krb-standalone/kadmin.exp187
4 files changed, 90 insertions, 186 deletions
diff --git a/src/tests/dejagnu/config/ChangeLog b/src/tests/dejagnu/config/ChangeLog
index 81f05d571..5d09ca57b 100644
--- a/src/tests/dejagnu/config/ChangeLog
+++ b/src/tests/dejagnu/config/ChangeLog
@@ -1,3 +1,7 @@
+Mon Aug 12 22:58:58 1996 Ezra Peisach <epeisach@kangaroo.mit.edu>
+
+ * default.exp: Rewrite to use kadmin.local instead of kdb5_edit.
+
Thu Aug 8 23:08:13 1996 Sam Hartman <hartmans@mit.edu>
* default.exp: In add_kerberos_key and add_random_key only execute
diff --git a/src/tests/dejagnu/config/default.exp b/src/tests/dejagnu/config/default.exp
index c7d597743..063ff5f74 100644
--- a/src/tests/dejagnu/config/default.exp
+++ b/src/tests/dejagnu/config/default.exp
@@ -80,10 +80,6 @@ if ![info exists KDB5_UTIL] {
set KDB5_UTIL [findfile $objdir/../../kadmin/dbutil/kdb5_util]
}
-if ![info exists KDB5_EDIT] {
- set KDB5_EDIT [findfile $objdir/../../admin/edit/kdb5_edit]
-}
-
if ![info exists KRB5KDC] {
set KRB5KDC [findfile $objdir/../../kdc/krb5kdc]
}
@@ -96,6 +92,11 @@ if ![info exists KADMIN] {
set KADMIN [findfile $objdir/../../kadmin/cli/kadmin]
}
+if ![info exists KADMIN_LOCAL] {
+ set KADMIN_LOCAL [findfile $objdir/../../kadmin/cli/kadmin.local]
+}
+
+
if ![info exists KINIT] {
set KINIT [findfile $objdir/../../clients/kinit/kinit]
}
@@ -498,30 +499,30 @@ proc restore_kerberos_env { } {
# Returns 1 on success, 0 on failure.
proc setup_kadmind_srvtab { } {
global REALMNAME
- global KDB5_EDIT
+ global KADMIN_LOCAL
global KEY
global tmppwd
catch "exec rm -f tmpdir/admin-keytab"
- spawn $KDB5_EDIT -r $REALMNAME
+ spawn $KADMIN_LOCAL -r $REALMNAME
expect_after {
timeout {
- fail "kdb5_edit admin-keytab (timeout)"
+ fail "kadmin.local admin-keytab (timeout)"
catch "exec rm -f tmpdir/admin-keytab"
catch "expect_after"
return 0
}
eof {
- fail "kdb5_edit admin-keytab (eof)"
+ fail "kadmin.local admin-keytab (eof)"
catch "exec rm -f tmpdir/admin-keytab"
catch "expect_after"
return 0
}
}
- expect "kdb5_edit:"
- send "xst admin kadmin\r"
- expect "'kadmin/admin@$REALMNAME' added to keytab"
- expect "kdb5_edit:"
+ expect "kadmin.local: "
+ send "xst -k admin-new-srvtab kadmin/admin\r"
+ expect -re ".*Entry for principal kadmin/admin.* added to keytab WRFILE:admin-new-srvtab."
+ expect "kadmin.local: "
catch "exec mv -f admin-new-srvtab changepw-new-srvtab" exec_output
if ![string match "" $exec_output] {
@@ -531,15 +532,15 @@ proc setup_kadmind_srvtab { } {
return 0
}
- send "xst changepw kadmin\r"
- expect "'kadmin/changepw@$REALMNAME' added to keytab"
- expect "kdb5_edit:"
+ send "xst -k changepw-new-srvtab kadmin/changepw\r"
+ expect -re ".*Entry for principal kadmin/changepw.* added to keytab WRFILE:changepw-new-srvtab."
+ expect "kadmin.local: "
send "quit\r"
expect "\r"
expect_after
- if ![check_exit_status "kdb5_edit admin-keytab"] {
+ if ![check_exit_status "kadmin.local admin-keytab"] {
catch "exec rm -f tmpdir/admin-keytab"
- send_error "ERROR: kdb5_edit admin-keytab exited abnormally\n"
+ send_error "ERROR: kadmin.local admin-keytab exited abnormally\n"
return 0
}
@@ -565,7 +566,7 @@ proc setup_kadmind_srvtab { } {
proc setup_kerberos_db { standalone } {
global REALMNAME
global KDB5_UTIL
- global KDB5_EDIT
+ global KADMIN_LOCAL
global KEY
global tmppwd
global spawn_id
@@ -678,11 +679,11 @@ proc setup_kerberos_db { standalone } {
}
# Add an admin user.
- spawn $KDB5_EDIT -r $REALMNAME
+ spawn $KADMIN_LOCAL -r $REALMNAME
expect_after {
timeout {
catch "expect_after"
- fail "kdb5_edit (timeout)"
+ fail "kadmin.local (timeout)"
if {!$standalone} {
catch "exec rm -f tmpdir/db.ok tmpdir/adb.db"
}
@@ -690,24 +691,30 @@ proc setup_kerberos_db { standalone } {
}
eof {
catch "expect_after"
- fail "kdb5_edit (eof)"
+ fail "kadmin.local (eof)"
if {!$standalone} {
catch "exec rm -f tmpdir/db.ok tmpdir/adb.db"
}
return 0
}
}
- expect "kdb5_edit:"
+ expect "kadmin.local: "
send "ank krbtest/admin@$REALMNAME\r"
- expect "Enter password:"
+ # It echos...
+ expect "ank krbtest/admin@$REALMNAME\r"
+ expect "Enter password for principal \"krbtest/admin@$REALMNAME\":"
send "adminpass$KEY\r"
- expect "Re-enter password for verification:"
+ expect "Re-enter password for principal \"krbtest/admin@$REALMNAME\":"
send "adminpass$KEY\r"
- expect "kdb5_edit:"
+ expect {
+ "Principal \"krbtest/admin@$REALMNAME\" created" { }
+ "Principal or policy already exists while creating*" { expect eof }
+ }
+ expect "kadmin.local: "
send "quit\r"
expect "\r"
expect_after
- if ![check_exit_status kdb5_edit] {
+ if ![check_exit_status kadmin_local] {
if {!$standalone} {
catch "exec rm -f tmpdir/db.ok tmpdir/adb.db"
}
@@ -722,7 +729,7 @@ proc setup_kerberos_db { standalone } {
catch "exec touch tmpdir/adb.lock"
if {$standalone} {
- pass "kdb5_edit"
+ pass "kadmin_local"
}
return 1
@@ -997,7 +1004,7 @@ proc add_random_key { kkey standalone } {
proc setup_srvtab { standalone {id host} } {
global REALMNAME
- global KDB5_EDIT
+ global KADMIN_LOCAL
global KEY
global tmppwd
global hostname
@@ -1016,10 +1023,10 @@ proc setup_srvtab { standalone {id host} } {
catch "exec rm -f $hostname-new-srvtab"
- spawn $KDB5_EDIT -r $REALMNAME
+ spawn $KADMIN_LOCAL -r $REALMNAME
expect_after {
timeout {
- fail "kdb5_edit srvtab"
+ fail "kadmin.local srvtab"
if {!$standalone} {
catch "exec rm -f tmpdir/srvtab"
}
@@ -1027,7 +1034,7 @@ proc setup_srvtab { standalone {id host} } {
return 0
}
eof {
- fail "kdb5_edit srvtab"
+ fail "kadmin.local srvtab"
if {!$standalone} {
catch "exec rm -f tmpdir/srvtab"
}
@@ -1035,14 +1042,14 @@ proc setup_srvtab { standalone {id host} } {
return 0
}
}
- expect "kdb5_edit:"
- send "xst $hostname $id\r"
- expect "'$id/$hostname@$REALMNAME' added to keytab"
- expect "kdb5_edit:"
+ expect "kadmin.local: "
+ send "xst -k $hostname-new-srvtab $id/$hostname\r"
+ expect -re ".*Entry for principal $id/$hostname.* added to keytab WRFILE:$hostname-new-srvtab."
+ expect "kadmin.local: "
send "quit\r"
expect "\r"
expect_after
- if ![check_exit_status "kdb5_edit srvtab"] {
+ if ![check_exit_status "kadmin.local srvtab"] {
if {!$standalone} {
catch "exec rm -f tmpdir/srvtab"
}
@@ -1058,7 +1065,7 @@ proc setup_srvtab { standalone {id host} } {
}
if {$standalone} {
- pass "kdb5_edit srvtab"
+ pass "kadmin.local srvtab"
}
# Make the srvtab file globally readable in case we are using a
diff --git a/src/tests/dejagnu/krb-standalone/ChangeLog b/src/tests/dejagnu/krb-standalone/ChangeLog
index 073048d51..5aec9e300 100644
--- a/src/tests/dejagnu/krb-standalone/ChangeLog
+++ b/src/tests/dejagnu/krb-standalone/ChangeLog
@@ -1,3 +1,7 @@
+Mon Aug 12 22:58:09 1996 Ezra Peisach <epeisach@kangaroo.mit.edu>
+
+ * kadmin.exp: Rewrite using kadmin.local instead of kdb5_edit.
+
Tue Aug 6 11:50:14 1996 Tom Yu <tlyu@voltage-multiplier.mit.edu>
* kadmin.exp: Fix to specify "2500 seconds" explictly to avoid
diff --git a/src/tests/dejagnu/krb-standalone/kadmin.exp b/src/tests/dejagnu/krb-standalone/kadmin.exp
index 29166f81c..894af7cb1 100644
--- a/src/tests/dejagnu/krb-standalone/kadmin.exp
+++ b/src/tests/dejagnu/krb-standalone/kadmin.exp
@@ -1,6 +1,6 @@
# Kerberos kadmin test.
# This is a DejaGnu test script.
-# This script tests Kerberos kadmin5 using kdb5_edit as verification.
+# This script tests Kerberos kadmin5 using kadmin.local as verification.
# Set up the kerberos database.
if {![get_hostname] \
@@ -28,7 +28,7 @@ if ![info exists KDESTROY] {
proc kadmin_add { pname password } {
global REALMNAME
global KADMIN
- global KDB5_EDIT
+ global KADMIN_LOCAL
global KEY
global spawn_id
global tmppwd
@@ -65,10 +65,10 @@ proc kadmin_add { pname password } {
catch "close -i $spawn_id"
if { $good == 1 } {
#
- # use kdb5_edit to verify that a principal was created and that its
+ # use kadmin.local to verify that a principal was created and that its
# salt types are 0 (normal).
#
- spawn $KDB5_EDIT -r $REALMNAME
+ spawn $KADMIN_LOCAL -r $REALMNAME
expect_after {
-i $spawn_id
timeout {
@@ -83,23 +83,30 @@ proc kadmin_add { pname password } {
}
}
set good 0
- expect "kdb5_edit:" { send "show $pname\r" }
- expect "Name: $pname@$REALMNAME" { set good 1 }
-
- expect "Maximum life:" { verbose "got max life" }
+ expect "kadmin.local: " { send "getprinc $pname\r" }
+ expect "Principal: $pname@$REALMNAME" { set good 1 }
+ expect "Expiration date:" { verbose "got expiration date" }
+ expect "Last password change:" { verbose "got last pwchange" }
+ expect "Password expiration date:" { verbose "got pwexpire date" }
+ expect "Maximum ticket life:" { verbose "got max life" }
expect "Maximum renewable life:" { verbose "got max rlife" }
- expect "Expiration:" { verbose "got expiration" }
- expect "Password expiration:" { verbose "got pw expiration" }
- expect "Last successful password:" { verbose "last succ pw" }
- expect "Last failed password attempt:" { verbose "last pw attempt" }
+ expect "Last modified:" { verbose "got last modified" }
+ expect "Last successful authentication:" { verbose "last succ auth" }
+ expect "Last failed authentication:" { verbose "last pw failed" }
expect "Failed password attempts:" { verbose "num failed attempts" }
- expect "Attributes:" { verbose "attributes" }
expect "Number of keys:" { verbose "num keys"}
- expect "kdb5_edit:" { send "q\r" }
+ expect {
+ "Key: " { verbose "Key listed"
+ exp_continue
+ }
+ "Attributes:" { verbose "attributes" }
+ }
+ expect "kadmin.local: " { send "q\r" }
+
expect_after
expect eof
set k_stat [wait -i $spawn_id]
- verbose "wait -i $spawn_id returned $k_stat (kdb5_edit show)"
+ verbose "wait -i $spawn_id returned $k_stat (kadmin.local show)"
catch "close -i $spawn_id"
if { $good == 1 } {
pass "kadmin add $pname"
@@ -124,7 +131,7 @@ proc kadmin_add { pname password } {
proc kadmin_add_rnd { pname } {
global REALMNAME
global KADMIN
- global KDB5_EDIT
+ global KADMIN_LOCAL
global KEY
global spawn_id
global tmppwd
@@ -159,10 +166,10 @@ proc kadmin_add_rnd { pname } {
catch "close -i $spawn_id"
if { $good == 1 } {
#
- # use kdb5_edit to verify that a principal was created and that its
+ # use kadmin.local to verify that a principal was created and that its
# salt types are 0 (normal).
#
- spawn $KDB5_EDIT -r $REALMNAME
+ spawn $KADMIN_LOCAL -r $REALMNAME
expect_after {
-i $spawn_id
timeout {
@@ -177,13 +184,13 @@ proc kadmin_add_rnd { pname } {
}
}
set good 0
- expect "kdb5_edit:" { send "show $pname\r" }
- expect "Name: $pname@$REALMNAME" { set good 1 }
- expect "kdb5_edit:" { send "q\r" }
+ expect "kadmin.local:" { send "getprinc $pname\r" }
+ expect "Principal: $pname@$REALMNAME" { set good 1 }
+ expect "kadmin.local:" { send "q\r" }
expect_after
expect eof
set k_stat [wait -i $spawn_id]
- verbose "wait -i $spawn_id returned $k_stat (kdb5_edit show)"
+ verbose "wait -i $spawn_id returned $k_stat (kadmin.local show)"
catch "close -i $spawn_id"
if { $good == 1 } {
pass "kadmin add_rnd $pname"
@@ -363,6 +370,8 @@ proc kadmin_modify { pname flags } {
}
expect "Enter password:"
send "adminpass$KEY\r"
+ # When in doubt, jam one of these in there.
+ expect "\r"
expect "Principal \"$pname@$REALMNAME\" modified."
expect_after
expect eof
@@ -373,121 +382,6 @@ proc kadmin_modify { pname flags } {
return 1
}
-#++
-# kadmin_rename - Test rename function of kadmin.
-#
-# Rename principal $pname to $npname. Returns 1 on success.
-#--
-proc kadmin_rename { pname npname } {
- global REALMNAME
- global KADMIN
- global KDB5_EDIT
- global KEY
- global spawn_id
- global tmppwd
-
- set good 0
- spawn $KADMIN -p krbtest/admin@$REALMNAME -q "renprinc -force $pname $npname"
- expect_after {
- "Cannot contact any KDC" {
- fail "kadmin rename $pname $npname lost KDC"
- catch "expect_after"
- return 0
- }
- timeout {
- fail "kadmin renent $pname $npname"
- catch "expect_after"
- return 0
- }
- eof {
- fail "kadmin renent $pname $npname"
- catch "expect_after"
- return 0
- }
- }
- expect "Enter password:" {
- send "adminpass$KEY\r"
- }
- expect "principal $pname renamed to $npname" { set good 1 }
- expect_after
- expect eof
- set k_stat [wait -i $spawn_id]
- verbose "wait -i $spawn_id returned $k_stat (kadmin rename)"
- catch "close -i $spawn_id"
- if { $good == 1 } {
- #
- # use kdb5_edit to verify that the new principal was created and that its
- # salt types are 0 (normal).
- #
- spawn $KDB5_EDIT -r $REALMNAME
- expect_after {
- -i $spawn_id
- timeout {
- fail "kadmin renent $pname $npname"
- catch "expect_after"
- return 0
- }
- eof {
- fail "kadmin renent $pname $npname"
- catch "expect_after"
- return 0
- }
- }
- set good 0
- expect "kdb5_edit:" { send "show $npname\r" }
- expect "Name: $npname@$REALMNAME" { set good 1 }
- expect "kdb5_edit:" { send "q\r" }
- expect_after
- expect eof
- set k_stat [wait -i $spawn_id]
- verbose "wait -i $spawn_id returned $k_stat (kdb5_edit show)"
- catch "close -i $spawn_id"
-
- if { $good == 1 } {
- #
- # use kdb5_edit to verify that the old principal is not present.
- #
- spawn $KDB5_EDIT -r $REALMNAME
- expect_after {
- timeout {
- fail "kadmin renent $pname $npname"
- catch "expect_after"
- return 0
- }
- eof {
- fail "kadmin renent $pname $npname"
- catch "expect_after"
- return 0
- }
- }
- set good 0
- expect "kdb5_edit:" { send "show $pname\r" }
- expect "Principal $pname not found" { set good 1 }
- expect "kdb5_edit:" { send "q\r" }
- expect_after
- expect eof
- set k_stat [wait -i $spawn_id]
- verbose "wait -i $spawn_id returned $k_stat (kdb5_edit show)"
- catch "close -i $spawn_id"
- if { $good == 1 } {
- pass "kadmin renent $pname $npname"
- return 1
- }
- else {
- fail "kadmin renent $pname $npname"
- return 0
- }
- }
- else {
- fail "kadmin renent $pname $npname"
- return 0
- }
- }
- else {
- fail "kadmin renent $pname $npname"
- return 0
- }
-}
#++
# kadmin_list - Test list database function of kadmin.
@@ -631,7 +525,7 @@ proc kadmin_extract { instance name } {
proc kadmin_delete { pname } {
global REALMNAME
global KADMIN
- global KDB5_EDIT
+ global KADMIN_LOCAL
global KEY
global spawn_id
global tmppwd
@@ -666,9 +560,9 @@ proc kadmin_delete { pname } {
catch "close -i $spawn_id"
if { $good == 1 } {
#
- # use kdb5_edit to verify that the old principal is not present.
+ # use kadmin.local to verify that the old principal is not present.
#
- spawn $KDB5_EDIT -r $REALMNAME
+ spawn $KADMIN_LOCAL -r $REALMNAME
expect_after {
-i $spawn_id
timeout {
@@ -683,13 +577,13 @@ proc kadmin_delete { pname } {
}
}
set good 0
- expect "kdb5_edit:" { send "show $pname\r" }
- expect "Principal $pname not found" { set good 1 }
- expect "kdb5_edit:" { send "q\r" }
+ expect "kadmin.local: " { send "getprinc $pname\r" }
+ expect "Principal does not exist while retrieving \"$pname@$REALMNAME\"." { set good 1 }
+ expect "kadmin.local: " { send "quit\r" }
expect_after
expect eof
set k_stat [wait -i $spawn_id]
- verbose "wait -i $spawn_id returned $k_stat (kdb5_edit show)"
+ verbose "wait -i $spawn_id returned $k_stat (kadmin.local show)"
catch "close -i $spawn_id"
if { $good == 1 } {
pass "kadmin delprinc $pname"
@@ -788,11 +682,6 @@ proc kadmin_test { } {
return
}
-# These tests were removed as you currently cannot rename a random key
-# This is a bug....
-# || ![kadmin_rename v5random randomkey] \
-# || ![kadmin_show randomkey] \
-# || ![kadmin_delete randomkey] \
# You cannot extract a v4 key...
# || ![kadmin_extractv4 instance2 v4principal] \