summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2000-08-08 19:38:44 +0000
committerEzra Peisach <epeisach@mit.edu>2000-08-08 19:38:44 +0000
commit807253d6a6035e25d694314d7cd7bac499a02e3d (patch)
tree511d0feace68e1029c9bae2a667df502e8b8f735 /src/tests
parent5c42752ce98ab2a765d8cedf818fcff61d25c15d (diff)
* default.exp: Create krb.conf and krb.realms files for v4
compatibility. Set KRBTKFILE environment variable. Add v4_compatible_enctype() proc to test if krb4 tests are being run and if the current encryption type being tested is compatible with V4. Added v4kinit() proc. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12614 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/dejagnu/config/ChangeLog8
-rw-r--r--src/tests/dejagnu/config/default.exp84
2 files changed, 91 insertions, 1 deletions
diff --git a/src/tests/dejagnu/config/ChangeLog b/src/tests/dejagnu/config/ChangeLog
index b839380d8..834b0c968 100644
--- a/src/tests/dejagnu/config/ChangeLog
+++ b/src/tests/dejagnu/config/ChangeLog
@@ -1,3 +1,11 @@
+2000-08-08 Ezra Peisach <epeisach@engrailed.mit.edu>
+
+ * default.exp: Create krb.conf and krb.realms files for v4
+ compatibility. Set KRBTKFILE environment variable. Add
+ v4_compatible_enctype() proc to test if krb4 tests are being run
+ and if the current encryption type being tested is compatible with
+ V4. Added v4kinit() proc.
+
2000-08-07 Ezra Peisach <epeisach@mit.edu>
* default.exp: Protect Quote quotation marks in multipass variable
diff --git a/src/tests/dejagnu/config/default.exp b/src/tests/dejagnu/config/default.exp
index 1f15e97c8..946b32aeb 100644
--- a/src/tests/dejagnu/config/default.exp
+++ b/src/tests/dejagnu/config/default.exp
@@ -95,7 +95,7 @@ if ![info exists KEY] {
# Clear away any files left over from a previous run.
# We can't use them now because we don't know the right KEY.
# krb5.conf might change if running tests on another host
-catch "exec rm -f tmpdir/db.ok tmpdir/srvtab tmpdir/krb5.conf tmpdir/kdc.conf tmpdir/cpw_srvtab"
+catch "exec rm -f tmpdir/db.ok tmpdir/srvtab tmpdir/krb5.conf tmpdir/kdc.conf tmpdir/cpw_srvtab tmpdir/krb.realms tmpdir/krb.conf"
# Put the installed kerberos directories on PATH.
# This needs to be fixed for V5.
@@ -380,6 +380,8 @@ proc setup_kerberos_files { } {
if [info exists default_tgt_enctypes] {
puts $conffile "default_tgs_enctypes = $default_tgs_enctypes"
}
+ puts $conffile " krb4_config = $tmppwd/krb.conf"
+ puts $conffile " krb4_realms = $tmppwd/krb.realms"
puts $conffile ""
puts $conffile "\[realms\]"
puts $conffile " $REALMNAME = \{"
@@ -440,6 +442,22 @@ proc setup_kerberos_files { } {
close $aclfile
}
+ # Create krb.conf file
+ if ![file exists tmpdir/krb.conf] {
+ set conffile [open tmpdir/krb.conf w]
+ puts $conffile "$REALMNAME"
+ puts $conffile "$REALMNAME $hostname:3088 admin server"
+ close $conffile
+ }
+
+ # Create krb.realms file
+ if ![file exists tmpdir/krb.realms] {
+ set conffile [open tmpdir/krb.realms w]
+ puts $conffile ".$domain = $REALMNAME"
+ puts $conffile "$domain = $REALMNAME"
+ close $conffile
+ }
+
set last_passname_conf $multipass_name
return 1
}
@@ -491,6 +509,10 @@ proc setup_kerberos_env { } {
set env(KRB5CCNAME) $tmppwd/tkt
verbose "KRB5CCNAME=$env(KRB5CCNAME)"
+ # Direct the Kerberos programs at a local ticket file.
+ set env(KRBTKFILE) $tmppwd/tkt
+ verbose "KRBTKFILE=$env(KRBTKFILE)"
+
# Direct the Kerberos server at a cache file stored in the
# temporary directory.
set env(KRB5RCACHEDIR) $tmppwd
@@ -1298,6 +1320,66 @@ proc kinit { name pass standalone } {
return 1
}
+
+# v4_compatible_enctype
+# Returns 1 if v4 testing is enabled this passes encryption types are compatable with kerberos 4 work
+proc v4_compatible_enctype {} {
+ global supported_enctypes
+ global KRB4
+
+ if ![info exists KRB4] {
+ return 0;
+ }
+
+ if { $KRB4 && [string first des-cbc-crc:v4 "$supported_enctypes"] >= 0} {
+ return 1
+ } else {
+ return 0
+ }
+}
+
+# kinit
+# Use kinit to get a ticket. If the argument is non-zero, call pass
+# at relevant points. Returns 1 on success, 0 on failure.
+
+proc v4kinit { name pass standalone } {
+ global REALMNAME
+ global KINIT
+ global spawn_id
+
+ # Use kinit to get a ticket.
+ #
+ # For now always get forwardable tickets. Later when we need to make
+ # tests that distiguish between forwardable tickets and otherwise
+ # we should but another option to this proc. --proven
+ #
+ spawn $KINIT -4 $name@$REALMNAME
+ expect {
+ "Password for $name@$REALMNAME:" {
+ verbose "v4kinit started"
+ }
+ timeout {
+ fail "v4kinit"
+ return 0
+ }
+ eof {
+ fail "v4kinit"
+ return 0
+ }
+ }
+ send "$pass\r"
+ expect eof
+ if ![check_exit_status kinit] {
+ return 0
+ }
+
+ if {$standalone} {
+ pass "v4kinit"
+ }
+
+ return 1
+}
+
# Set up a root shell using rlogin $hostname -l root. This is used
# when testing the daemons that must be run as root, such as telnetd
# or rlogind. This sets the global variables rlogin_spawn_id and