From: Mark Eichin Date: Wed, 13 Mar 1996 21:09:29 +0000 (+0000) Subject: replace KRBTEST.COM with $REALMNAME. Now you can change the realm name the X-Git-Tag: krb5-1.0-beta6~377 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d36679419b9f35eac17b20a6db62fd422c545884;p=krb5.git replace KRBTEST.COM with $REALMNAME. Now you can change the realm name the tests use by "runtest --tool krb --srcdir whatever REALMNAME=WHITEHOUSE.GOV" also added -- to kadmin tests so they work with any getopt git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7625 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/dejagnu/config/default.exp b/src/tests/dejagnu/config/default.exp index 343c90e4c..16f89dffd 100644 --- a/src/tests/dejagnu/config/default.exp +++ b/src/tests/dejagnu/config/default.exp @@ -8,8 +8,8 @@ # Kerberos database. We have to do this such that we don't interfere # with any existing Kerberos database. We will create all the files # in the directory tmpdir, which will have been created by the -# testsuite default script. We will use KRBTEST.COM as our Kerberos -# realm name. +# testsuite default script. We will use $REALMNAME as our Kerberos +# realm name, defaulting to KRBTEST.COM. set timeout 100 @@ -65,6 +65,12 @@ if ![info exists env(USER)] { } } +# set the realm. The user can override this on the runtest line. +if ![info exists REALMNAME] { + set REALMNAME "KRBTEST.COM" +} +verbose "Test realm is $REALMNAME" + # Find some programs we need. We use the binaries from the build tree # if they exist. If they do not, then they must be in PATH. We # expect $objdir to be ...tests/dejagnu. @@ -241,6 +247,7 @@ proc get_hostname { } { # success, 0 on failure. proc setup_kerberos_files { } { + global REALMNAME global hostname global domain global tmppwd @@ -253,17 +260,17 @@ proc setup_kerberos_files { } { if ![file exists tmpdir/krb5.conf] { set conffile [open tmpdir/krb5.conf w] puts $conffile "\[libdefaults\]" - puts $conffile " default_realm = KRBTEST.COM" + puts $conffile " default_realm = $REALMNAME" puts $conffile "" puts $conffile "\[realms\]" - puts $conffile " KRBTEST.COM = \{" + puts $conffile " $REALMNAME = \{" puts $conffile " kdc = $hostname:3088" puts $conffile " admin_server = $hostname:3750" puts $conffile " \}" puts $conffile "" puts $conffile "\[domain_realm\]" - puts $conffile " .$domain = KRBTEST.COM" - puts $conffile " $domain = KRBTEST.COM" + puts $conffile " .$domain = $REALMNAME" + puts $conffile " $domain = $REALMNAME" puts $conffile "" puts $conffile "\[logging\]" puts $conffile " admin_server = STDERR" @@ -281,7 +288,7 @@ proc setup_kerberos_files { } { puts $conffile " kdc_ports = 3085,3086,3087,3088,3089" puts $conffile "" puts $conffile "\[realms\]" - puts $conffile " KRBTEST.COM = \{" + puts $conffile " $REALMNAME = \{" puts $conffile " database_name = $tmppwd/db" puts $conffile " master_key_name = master/key" puts $conffile " master_key_type = des-cbc-md5" @@ -301,7 +308,7 @@ proc setup_kerberos_files { } { # Create ACL file. if ![file exists tmpdir/acl] { set aclfile [open tmpdir/acl w] - puts $aclfile "krbtest/admin@KRBTEST.COM *" + puts $aclfile "krbtest/admin@$REALMNAME *" close $aclfile } @@ -348,6 +355,7 @@ if [info exists env(LD_LIBRARY_PATH)] { # Set the environment variables needed to run Kerberos programs. proc setup_kerberos_env { } { + global REALMNAME global env global tmppwd global hostname @@ -368,8 +376,8 @@ proc setup_kerberos_env { } { set env(KRB5RCACHEDIR) $tmppwd verbose "KRB5RCACHEDIR=$env(KRB5RCACHEDIR)" - # Tell the Kerberos tools how to contact the KRBTEST.COM server. - set env(KERBEROS_SERVER) "KRBTEST.COM:$hostname:3088" + # Tell the Kerberos tools how to contact the $REALMNAME server. + set env(KERBEROS_SERVER) "$REALMNAME:$hostname:3088" verbose "KERBEROS_SERVER=$env(KERBEROS_SERVER)" # Tell the dynamic loader where to get our shared libraries @@ -452,12 +460,13 @@ proc restore_kerberos_env { } { # may successfully communicate. # Returns 1 on success, 0 on failure. proc setup_kadmind_srvtab { } { + global REALMNAME global KDB5_EDIT global KEY global tmppwd catch "exec rm -f tmpdir/cpw_srvtab" - spawn $KDB5_EDIT -r KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { timeout { fail "kdb5_edit cpw_srvtab" @@ -473,8 +482,8 @@ proc setup_kadmind_srvtab { } { } } expect "kdb5_edit:" - send "xst KRBTEST.COM changepw\r" - expect "'changepw/KRBTEST.COM@KRBTEST.COM' added to keytab" + send "xst $REALMNAME changepw\r" + expect "'changepw/$REALMNAME@$REALMNAME' added to keytab" expect "kdb5_edit:" send "quit\r" expect "\r" @@ -485,7 +494,7 @@ proc setup_kadmind_srvtab { } { return 0 } - catch "exec mv -f KRBTEST.COM-new-srvtab tmpdir/cpw_srvtab" exec_output + catch "exec mv -f $REALMNAME-new-srvtab tmpdir/cpw_srvtab" exec_output if ![string match "" $exec_output] { send_log "$exec_output\n" verbose $exec_output @@ -505,6 +514,7 @@ proc setup_kadmind_srvtab { } { # pass at relevant points. Returns 1 on success, 0 on failure. proc setup_kerberos_db { standalone } { + global REALMNAME global KDB5_CREATE global KDB5_STASH global KDB5_EDIT @@ -525,7 +535,7 @@ proc setup_kerberos_db { standalone } { return 0 } - spawn $KDB5_CREATE -r KRBTEST.COM + spawn $KDB5_CREATE -r $REALMNAME expect { "Enter KDC database master key:" { verbose "kdb5_create started" @@ -573,7 +583,7 @@ proc setup_kerberos_db { standalone } { } # Stash the master key in a file. - spawn $KDB5_STASH -r KRBTEST.COM + spawn $KDB5_STASH -r $REALMNAME expect { "Enter KDC database master key:" { verbose "kdb5_stash started" @@ -613,7 +623,7 @@ proc setup_kerberos_db { standalone } { } # Add an admin user. - spawn $KDB5_EDIT -r KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { timeout { catch "expect_after" @@ -633,13 +643,13 @@ proc setup_kerberos_db { standalone } { } } expect "kdb5_edit:" - send "ank krbtest/admin@KRBTEST.COM\r" + send "ank krbtest/admin@$REALMNAME\r" expect "Enter password:" send "adminpass$KEY\r" expect "Re-enter password for verification:" send "adminpass$KEY\r" expect "kdb5_edit:" - send "ark changepw/KRBTEST.COM@KRBTEST.COM\r" + send "ark changepw/$REALMNAME@$REALMNAME\r" expect "kdb5_edit:" send "quit\r" expect "\r" @@ -671,6 +681,7 @@ proc setup_kerberos_db { standalone } { # success, 0 on failure. proc start_kerberos_daemons { standalone } { + global REALMNAME global KRB5KDC global KADMIND global KEY @@ -690,7 +701,7 @@ proc start_kerberos_daemons { standalone } { } # Start up the kerberos daemon - spawn $KRB5KDC -r KRBTEST.COM -n + spawn $KRB5KDC -r $REALMNAME -n set kdc_pid [exp_pid] set kdc_spawn_id $spawn_id @@ -721,7 +732,7 @@ proc start_kerberos_daemons { standalone } { catch "exec sleep 2" # Start up the kadmind daemon - spawn $KADMIND -a $tmppwd/acl -r KRBTEST.COM -n + spawn $KADMIND -a $tmppwd/acl -r $REALMNAME -n set kadmind_pid [exp_pid] set kadmind_spawn_id $spawn_id expect { @@ -790,12 +801,13 @@ proc stop_kerberos_daemons { } { # failure. proc add_kerberos_key { kkey standalone } { + global REALMNAME global KADMIN global KEY global spawn_id # Use kadmin to add an key. - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM + spawn $KADMIN -m -p krbtest/admin@$REALMNAME expect_after { timeout { fail "kadmin $kkey" @@ -809,18 +821,18 @@ proc add_kerberos_key { kkey standalone } { } } expect "kadmin5:" - send "ank $kkey@KRBTEST.COM\r" - expect "Enter password for krbtest/admin@KRBTEST.COM:" + send "ank $kkey@$REALMNAME\r" + expect "Enter password for krbtest/admin@$REALMNAME:" send "adminpass$KEY\r" - expect "Enter new password for $kkey@KRBTEST.COM :" + expect "Enter new password for $kkey@$REALMNAME :" send "$kkey" send "$KEY\r" - expect "Re-enter new password for $kkey@KRBTEST.COM :" + expect "Re-enter new password for $kkey@$REALMNAME :" send "$kkey" send "$KEY\r" expect { - "principal $kkey@KRBTEST.COM added" { } - "Principal $kkey@KRBTEST.COM already exists" { } + "principal $kkey@$REALMNAME added" { } + "Principal $kkey@$REALMNAME already exists" { } } expect "kadmin5:" send "q\r" @@ -844,12 +856,13 @@ proc add_kerberos_key { kkey standalone } { # Returns 1 on success, 0 on failure. proc add_random_key { kkey standalone } { + global REALMNAME global KADMIN global KEY global spawn_id # Use kadmin to add an key. - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM + spawn $KADMIN -m -p krbtest/admin@$REALMNAME expect_after { timeout { fail "kadmin $kkey" @@ -863,12 +876,12 @@ proc add_random_key { kkey standalone } { } } expect "kadmin5:" - send "ark $kkey@KRBTEST.COM\r" - expect "Enter password for krbtest/admin@KRBTEST.COM:" + send "ark $kkey@$REALMNAME\r" + expect "Enter password for krbtest/admin@$REALMNAME:" send "adminpass$KEY\r" expect { - "principal $kkey@KRBTEST.COM added" { } - "Principal $kkey@KRBTEST.COM already exists" { } + "principal $kkey@$REALMNAME added" { } + "Principal $kkey@$REALMNAME already exists" { } } expect "kadmin5:" send "q\r" @@ -892,6 +905,7 @@ proc add_random_key { kkey standalone } { # success, 0 on failure. If the id field is not provided, host is used. proc setup_srvtab { standalone {id host} } { + global REALMNAME global KDB5_EDIT global KEY global tmppwd @@ -911,7 +925,7 @@ proc setup_srvtab { standalone {id host} } { catch "exec rm -f $hostname-new-srvtab" - spawn $KDB5_EDIT -r KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { timeout { fail "kdb5_edit srvtab" @@ -932,7 +946,7 @@ proc setup_srvtab { standalone {id host} } { } expect "kdb5_edit:" send "xst $hostname $id\r" - expect "'$id/$hostname@KRBTEST.COM' added to keytab" + expect "'$id/$hostname@$REALMNAME' added to keytab" expect "kdb5_edit:" send "quit\r" expect "\r" @@ -971,13 +985,14 @@ proc setup_srvtab { standalone {id host} } { # at relevant points. Returns 1 on success, 0 on failure. proc kinit { name pass standalone } { + global REALMNAME global KINIT global spawn_id # Use kinit to get a ticket. - spawn $KINIT $name@KRBTEST.COM + spawn $KINIT $name@$REALMNAME expect { - "Password for $name@KRBTEST.COM:" { + "Password for $name@$REALMNAME:" { verbose "kinit started" } timeout { diff --git a/src/tests/dejagnu/krb-root/rlogin.exp b/src/tests/dejagnu/krb-root/rlogin.exp index e75333aed..49ab15f81 100644 --- a/src/tests/dejagnu/krb-root/rlogin.exp +++ b/src/tests/dejagnu/krb-root/rlogin.exp @@ -42,6 +42,7 @@ if {![get_hostname] \ # A procedure to start up the rlogin daemon. proc start_rlogin_daemon { option } { + global REALMNAME global KRLOGIND global LOGINKRB5 global ROOT_PROMPT @@ -54,7 +55,7 @@ proc start_rlogin_daemon { option } { # don't need to use inetd. The 3543 is the port to listen at. # Note that tmppwd here is a shell variable, which is set in # setup_root_shell, not a TCL variable. - send -i $rlogin_spawn_id "$KRLOGIND -k -c -D 3543 -S \$tmppwd/srvtab -M KRBTEST.COM -L $LOGINKRB5 $option &\r" + send -i $rlogin_spawn_id "$KRLOGIND -k -c -D 3543 -S \$tmppwd/srvtab -M $REALMNAME -L $LOGINKRB5 $option &\r" expect { -i $rlogin_spawn_id -re "$ROOT_PROMPT" { } @@ -115,6 +116,7 @@ proc stop_rlogin_daemon { } { # we get some sort of error. proc rlogin_test { } { + global REALMNAME global RLOGIN global BINSH global SHELL_PROMPT @@ -137,7 +139,7 @@ proc rlogin_test { } { start_rlogin_daemon -k # Make an rlogin connection. - spawn $RLOGIN $hostname -k KRBTEST.COM -D 3543 + spawn $RLOGIN $hostname -k $REALMNAME -D 3543 expect_after { timeout { @@ -201,7 +203,7 @@ proc rlogin_test { } { # Try an encrypted connection. start_rlogin_daemon -e - spawn $RLOGIN $hostname -x -k KRBTEST.COM -D 3543 + spawn $RLOGIN $hostname -x -k $REALMNAME -D 3543 expect_after { timeout { diff --git a/src/tests/dejagnu/krb-root/telnet.exp b/src/tests/dejagnu/krb-root/telnet.exp index ce0acf7fa..29d74a274 100644 --- a/src/tests/dejagnu/krb-root/telnet.exp +++ b/src/tests/dejagnu/krb-root/telnet.exp @@ -42,6 +42,7 @@ if {![get_hostname] \ # A procedure to start up the telnet daemon. proc start_telnet_daemon { } { + global REALMNAME global TELNETD global LOGINKRB5 global ROOT_PROMPT @@ -54,7 +55,7 @@ proc start_telnet_daemon { } { # we don't need to use inetd. The 3023 is the port to listen at. # Note that tmppwd here is a shell variable, which is set in # setup_root_shell, not a TCL variable. - send -i $rlogin_spawn_id "$TELNETD -debug -t \$tmppwd/srvtab -R KRBTEST.COM -L $LOGINKRB5 -X KERBEROS_V4 3023 &\r" + send -i $rlogin_spawn_id "$TELNETD -debug -t \$tmppwd/srvtab -R $REALMNAME -L $LOGINKRB5 -X KERBEROS_V4 3023 &\r" expect { -i $rlogin_spawn_id -re "$ROOT_PROMPT" { } @@ -115,6 +116,7 @@ proc stop_telnet_daemon { } { # we get some sort of error. proc telnet_test { } { + global REALMNAME global TELNET global BINSH global SHELL_PROMPT @@ -208,7 +210,7 @@ proc telnet_test { } { # Try an authenticated connection. start_telnet_daemon - spawn $TELNET -a -k KRBTEST.COM $hostname -3023 + spawn $TELNET -a -k $REALMNAME $hostname -3023 expect_after { timeout { @@ -281,7 +283,7 @@ proc telnet_test { } { # # Try an authenticated encrypted connection. # start_telnet_daemon -# spawn $TELNET -a -x -k KRBTEST.COM $hostname -3023 +# spawn $TELNET -a -x -k $REALMNAME $hostname -3023 # # expect_after { # timeout { diff --git a/src/tests/dejagnu/krb-standalone/gssapi.exp b/src/tests/dejagnu/krb-standalone/gssapi.exp index 182842e47..beef7cf6f 100644 --- a/src/tests/dejagnu/krb-standalone/gssapi.exp +++ b/src/tests/dejagnu/krb-standalone/gssapi.exp @@ -31,13 +31,14 @@ if ![setup_kerberos_db 0] { # Like kinit in default.exp, but allows us to specify a different ccache. # proc our_kinit { name pass ccache } { + global REALMNAME global KINIT global spawn_id # Use kinit to get a ticket. - spawn $KINIT -c $ccache $name@KRBTEST.COM + spawn $KINIT -c $ccache $name@$REALMNAME expect { - "Password for $name@KRBTEST.COM:" { + "Password for $name@$REALMNAME:" { verbose "kinit started" } timeout { @@ -112,6 +113,7 @@ proc gss_restore_env { } { } proc doit { } { + global REALMNAME global env global KLIST global KDESTROY @@ -248,7 +250,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest0@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest0@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest0\"" catch "expect_after" if ![check_exit_status gssclient0] { @@ -287,7 +289,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest1@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest1@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest1\"" catch "expect_after" if ![check_exit_status gssclient1] { @@ -326,7 +328,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest2@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest2@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest2\"" catch "expect_after" if ![check_exit_status gssclient2] { @@ -351,7 +353,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest3@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest3@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest3\"" catch "expect_after" expect_after -i $spawn_id { @@ -413,7 +415,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest0@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest0@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest0\"" catch "expect_after" if ![check_exit_status gssclient0] { @@ -452,7 +454,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest1@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest1@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest1\"" catch "expect_after" if ![check_exit_status gssclient1] { @@ -491,7 +493,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest2@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest2@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest2\"" catch "expect_after" if ![check_exit_status gssclient2] { @@ -516,7 +518,7 @@ proc doit { } { return } } - expect -i $gss_server_spawn_id "Accepted connection: \"gsstest3@KRBTEST.COM\" at" + expect -i $gss_server_spawn_id "Accepted connection: \"gsstest3@$REALMNAME\" at" expect -i $gss_server_spawn_id "Received message: \"message from gsstest3\"" catch "expect_after" expect_after -i $spawn_id { diff --git a/src/tests/dejagnu/krb-standalone/kadmin.exp b/src/tests/dejagnu/krb-standalone/kadmin.exp index b05d381f3..f79fb76ac 100644 --- a/src/tests/dejagnu/krb-standalone/kadmin.exp +++ b/src/tests/dejagnu/krb-standalone/kadmin.exp @@ -26,6 +26,7 @@ if ![info exists KDESTROY] { # Adds principal $pname with password $password. Returns 1 on success. #-- proc kadmin_add { pname password } { + global REALMNAME global KADMIN global KDB5_EDIT global KEY @@ -34,7 +35,7 @@ proc kadmin_add { pname password } { global kadmind_spawn_id set good 0 - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM ank $pname + spawn $KADMIN -m -p krbtest/admin@$REALMNAME ank $pname expect_after { timeout { fail "kadmin add $pname" @@ -47,7 +48,7 @@ proc kadmin_add { pname password } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } expect "Enter new password for $pname :" { send "$password\r" } @@ -63,13 +64,13 @@ proc kadmin_add { pname password } { # and also, on some systems the write to standard error will block if # too many messages back up. # - expect -i $kadmind_spawn_id "Add Principal operation for $pname successfully issued by krbtest/admin@KRBTEST.COM" + expect -i $kadmind_spawn_id "Add Principal operation for $pname successfully issued by krbtest/admin@$REALMNAME" if { $good == 1 } { # # use kdb5_edit to verify that a principal was created and that its # salt types are 0 (normal). # - spawn $KDB5_EDIT -r KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { -i $spawn_id timeout { fail "kadmin add $pname" @@ -84,7 +85,7 @@ proc kadmin_add { pname password } { } set good 0 expect "kdb5_edit:" { send "show $pname\r" } - expect "Name: $pname@KRBTEST.COM" { set good 1 } + expect "Name: $pname@$REALMNAME" { set good 1 } expect "kdb5_edit:" { send "q\r" } expect_after expect eof @@ -112,6 +113,7 @@ proc kadmin_add { pname password } { # Adds principal $pname with random key. Returns 1 on success. #-- proc kadmin_add_rnd { pname } { + global REALMNAME global KADMIN global KDB5_EDIT global KEY @@ -120,7 +122,7 @@ proc kadmin_add_rnd { pname } { global kadmind_spawn_id set good 0 - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM ark $pname + spawn $KADMIN -m -p krbtest/admin@$REALMNAME ark $pname expect_after { timeout { fail "kadmin add_rnd $pname" @@ -133,7 +135,7 @@ proc kadmin_add_rnd { pname } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } expect "principal $pname added" { set good 1 } @@ -142,13 +144,13 @@ proc kadmin_add_rnd { pname } { set k_stat [wait -i $spawn_id] verbose "wait -i $spawn_id returned $k_stat (kadmin add_rnt)" catch "close -i $spawn_id" - expect -i $kadmind_spawn_id "Add Principal operation for $pname successfully issued by krbtest/admin@KRBTEST.COM" + expect -i $kadmind_spawn_id "Add Principal operation for $pname successfully issued by krbtest/admin@$REALMNAME" if { $good == 1 } { # # use kdb5_edit to verify that a principal was created and that its # salt types are 0 (normal). # - spawn $KDB5_EDIT -r KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { -i $spawn_id timeout { fail "kadmin add_rnd $pname" @@ -163,7 +165,7 @@ proc kadmin_add_rnd { pname } { } set good 0 expect "kdb5_edit:" { send "show $pname\r" } - expect "Name: $pname@KRBTEST.COM" { set good 1 } + expect "Name: $pname@$REALMNAME" { set good 1 } expect "kdb5_edit:" { send "q\r" } expect_after expect eof @@ -191,11 +193,12 @@ proc kadmin_add_rnd { pname } { # Retrieves entry for $pname. Returns 1 on success. #-- proc kadmin_show { pname } { + global REALMNAME global KADMIN global KEY global spawn_id - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM show $pname + spawn $KADMIN -m -p krbtest/admin@$REALMNAME show $pname expect_after { timeout { fail "kadmin show $pname" @@ -208,7 +211,7 @@ proc kadmin_show { pname } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" + expect "Enter password for krbtest/admin@$REALMNAME:" send "adminpass$KEY\r" expect -re "\r.*-*Principal: $pname.*Flags: .*Key: .*-*" expect_after @@ -226,12 +229,13 @@ proc kadmin_show { pname } { # Change password of $pname to $password. Returns 1 on success. #-- proc kadmin_cpw { pname password } { + global REALMNAME global KADMIN global KEY global spawn_id global kadmind_spawn_id - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM cpw $pname + spawn $KADMIN -m -p krbtest/admin@$REALMNAME cpw $pname expect_after { timeout { fail "kadmin cpw $pname" @@ -244,7 +248,7 @@ proc kadmin_cpw { pname password } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } expect "Enter new password for $pname:" { send "$password\r" } @@ -257,7 +261,7 @@ proc kadmin_cpw { pname password } { set k_stat [wait -i $spawn_id] verbose "wait -i $spawn_id returned $k_stat (kadmin cpw)" catch "close -i $spawn_id" - expect -i $kadmind_spawn_id "Change Password operation for $pname successfully issued by krbtest/admin@KRBTEST.COM" + expect -i $kadmind_spawn_id "Change Password operation for $pname successfully issued by krbtest/admin@$REALMNAME" pass "kadmin cpw $pname" return 1 } @@ -268,12 +272,13 @@ proc kadmin_cpw { pname password } { # Changes principal $pname's key to a new random key. Returns 1 on success. #-- proc kadmin_cpw_rnd { pname } { + global REALMNAME global KADMIN global KEY global spawn_id global kadmind_spawn_id - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM crk $pname + spawn $KADMIN -m -p krbtest/admin@$REALMNAME crk $pname expect_after { timeout { fail "kadmin cpw_rnd $pname" @@ -286,7 +291,7 @@ proc kadmin_cpw_rnd { pname } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } # When in doubt, jam one of these in there. @@ -297,7 +302,7 @@ proc kadmin_cpw_rnd { pname } { set k_stat [wait -i $spawn_id] verbose "wait -i $spawn_id returned $k_stat (kadmin cpw_rnd)" catch "close -i $spawn_id" - expect -i $kadmind_spawn_id "Change Random Password operation for $pname successfully issued by krbtest/admin@KRBTEST.COM" + expect -i $kadmind_spawn_id "Change Random Password operation for $pname successfully issued by krbtest/admin@$REALMNAME" pass "kadmin cpw_rnd $pname" return 1 } @@ -308,12 +313,13 @@ proc kadmin_cpw_rnd { pname } { # Modifies principal $pname with flags $flags. Returns 1 on success. #-- proc kadmin_modify { pname flags } { + global REALMNAME global KADMIN global KEY global spawn_id global kadmind_spawn_id - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM modent $pname $flags + spawn $KADMIN -m -p krbtest/admin@$REALMNAME -- modent $pname $flags expect_after { timeout { fail "kadmin modify $pname" @@ -326,7 +332,7 @@ proc kadmin_modify { pname flags } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" + expect "Enter password for krbtest/admin@$REALMNAME:" send "adminpass$KEY\r" expect "principal $pname modified" expect_after @@ -334,7 +340,7 @@ proc kadmin_modify { pname flags } { set k_stat [wait -i $spawn_id] verbose "wait -i $spawn_id returned $k_stat (kadmin modify)" catch "close -i $spawn_id" - expect -i $kadmind_spawn_id "Modify Principal operation for $pname successfully issued by krbtest/admin@KRBTEST.COM" + expect -i $kadmind_spawn_id "Modify Principal operation for $pname successfully issued by krbtest/admin@$REALMNAME" pass "kadmin modify $pname" return 1 } @@ -345,6 +351,7 @@ proc kadmin_modify { pname flags } { # Rename principal $pname to $npname. Returns 1 on success. #-- proc kadmin_rename { pname npname } { + global REALMNAME global KADMIN global KDB5_EDIT global KEY @@ -353,7 +360,7 @@ proc kadmin_rename { pname npname } { global kadmind_spawn_id set good 0 - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM renent -force $pname $npname + spawn $KADMIN -m -p krbtest/admin@$REALMNAME -- renent -force $pname $npname expect_after { timeout { fail "kadmin renent $pname $npname" @@ -366,7 +373,7 @@ proc kadmin_rename { pname npname } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } expect "principal $pname renamed to $npname" { set good 1 } @@ -375,13 +382,13 @@ proc kadmin_rename { pname npname } { set k_stat [wait -i $spawn_id] verbose "wait -i $spawn_id returned $k_stat (kadmin rename)" catch "close -i $spawn_id" - expect -i $kadmind_spawn_id "Rename Principal operation from $pname to $npname successfully issued by krbtest/admin@KRBTEST.COM" + expect -i $kadmind_spawn_id "Rename Principal operation from $pname to $npname successfully issued by krbtest/admin@$REALMNAME" 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 KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { -i $spawn_id timeout { fail "kadmin renent $pname $npname" @@ -396,7 +403,7 @@ proc kadmin_rename { pname npname } { } set good 0 expect "kdb5_edit:" { send "show $npname\r" } - expect "Name: $npname@KRBTEST.COM" { set good 1 } + expect "Name: $npname@$REALMNAME" { set good 1 } expect "kdb5_edit:" { send "q\r" } expect_after expect eof @@ -408,7 +415,7 @@ proc kadmin_rename { pname npname } { # # use kdb5_edit to verify that the old principal is not present. # - spawn $KDB5_EDIT -r KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { timeout { fail "kadmin renent $pname $npname" @@ -454,14 +461,15 @@ proc kadmin_rename { pname npname } { # kadmin_list - Test list database function of kadmin. # # Lists the database and verifies that output matches regular expression -# "(.*@KRBTEST.COM)*". Returns 1 on success. +# "(.*@$REALMNAME)*". Returns 1 on success. #-- proc kadmin_list { } { + global REALMNAME global KADMIN global KEY global spawn_id - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM ldb + spawn $KADMIN -m -p krbtest/admin@$REALMNAME ldb expect_after { timeout { fail "kadmin ldb" @@ -474,10 +482,10 @@ proc kadmin_list { } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } - expect -re "\(.*@KRBTEST.COM\r\n\)*" + expect -re "\(.*@$REALMNAME\r\n\)*" expect_after expect eof set k_stat [wait -i $spawn_id] @@ -494,11 +502,12 @@ proc kadmin_list { } { # 1 on success. #-- proc kadmin_extract { instance name } { + global REALMNAME global KADMIN global KEY global spawn_id - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM xst $instance $name + spawn $KADMIN -m -p krbtest/admin@$REALMNAME xst $instance $name expect_after { timeout { fail "kadmin xst $instance $name" @@ -511,7 +520,7 @@ proc kadmin_extract { instance name } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } expect "extracted entry $name to key table $instance-new-srvtab" @@ -533,11 +542,12 @@ proc kadmin_extract { instance name } { # 4 format. Returns 1 on success. #-- proc kadmin_extractv4 { instance name } { + global REALMNAME global KADMIN global KEY global spawn_id - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM xst4 $instance $name + spawn $KADMIN -m -p krbtest/admin@$REALMNAME xst4 $instance $name expect_after { timeout { fail "kadmin xst4 $instance $name" @@ -550,7 +560,7 @@ proc kadmin_extractv4 { instance name } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } expect "extracted entry $name to key table $instance-new-v4-srvtab" @@ -570,6 +580,7 @@ proc kadmin_extractv4 { instance name } { # Deletes principal $pname. Returns 1 on success. #-- proc kadmin_delete { pname } { + global REALMNAME global KADMIN global KDB5_EDIT global KEY @@ -578,7 +589,7 @@ proc kadmin_delete { pname } { global kadmind_spawn_id set good 0 - spawn $KADMIN -m -p krbtest/admin@KRBTEST.COM delent -force $pname + spawn $KADMIN -m -p krbtest/admin@$REALMNAME -- delent -force $pname expect_after { timeout { fail "kadmin delent $pname" @@ -591,7 +602,7 @@ proc kadmin_delete { pname } { return 0 } } - expect "Enter password for krbtest/admin@KRBTEST.COM:" { + expect "Enter password for krbtest/admin@$REALMNAME:" { send "adminpass$KEY\r" } expect "principal $pname deleted" { set good 1 } @@ -600,12 +611,12 @@ proc kadmin_delete { pname } { set k_stat [wait -i $spawn_id] verbose "wait -i $spawn_id returned $k_stat (kadmin delent)" catch "close -i $spawn_id" - expect -i $kadmind_spawn_id "Delete Principal operation for $pname successfully issued by krbtest/admin@KRBTEST.COM" + expect -i $kadmind_spawn_id "Delete Principal operation for $pname successfully issued by krbtest/admin@$REALMNAME" if { $good == 1 } { # # use kdb5_edit to verify that the old principal is not present. # - spawn $KDB5_EDIT -r KRBTEST.COM + spawn $KDB5_EDIT -r $REALMNAME expect_after { -i $spawn_id timeout { fail "kadmin delent $pname" diff --git a/src/tests/dejagnu/krb-standalone/rcp.exp b/src/tests/dejagnu/krb-standalone/rcp.exp index 7c3948219..d4d9f512b 100644 --- a/src/tests/dejagnu/krb-standalone/rcp.exp +++ b/src/tests/dejagnu/krb-standalone/rcp.exp @@ -32,6 +32,7 @@ if {![get_hostname] \ # daemon). proc start_rsh_daemon { } { + global REALMNAME global KRSHD global RCP global tmppwd @@ -40,7 +41,7 @@ proc start_rsh_daemon { } { # The -D argument tells it to accept a single connection, so we # don't need to use inetd. The 3544 is the port to listen at. - spawn $KRSHD -k -c -D 3544 -P [file dirname $RCP] -S $tmppwd/srvtab -M KRBTEST.COM + spawn $KRSHD -k -c -D 3544 -P [file dirname $RCP] -S $tmppwd/srvtab -M $REALMNAME set krshd_spawn_id $spawn_id set krshd_pid [exp_pid] @@ -104,6 +105,7 @@ proc check_file { filename } { # Test copying one file to another. proc rcp_one_test { testname options frompref topref } { + global REALMNAME global RCP global tmppwd @@ -114,9 +116,9 @@ proc rcp_one_test { testname options frompref topref } { set from [format "%s%s" $frompref $tmppwd/rcp-test] set to [format "%s%s" $topref $tmppwd/copy] - send_log "$RCP $options -D 3544 -N -k KRBTEST.COM $from $to\n" - verbose "$RCP $options -D 3544 -N -k KRBTEST.COM $from $to" - catch "exec $RCP $options -D 3544 -N -k KRBTEST.COM $from $to" exec_output + send_log "$RCP $options -D 3544 -N -k $REALMNAME $from $to\n" + verbose "$RCP $options -D 3544 -N -k $REALMNAME $from $to" + catch "exec $RCP $options -D 3544 -N -k $REALMNAME $from $to" exec_output if ![string match "" $exec_output] { send_log "$exec_output\n" diff --git a/src/tests/dejagnu/krb-standalone/rsh.exp b/src/tests/dejagnu/krb-standalone/rsh.exp index c91f8d57f..893d74ede 100644 --- a/src/tests/dejagnu/krb-standalone/rsh.exp +++ b/src/tests/dejagnu/krb-standalone/rsh.exp @@ -31,6 +31,7 @@ if {![get_hostname] \ # A procedure to start up the rsh daemon. proc start_rsh_daemon { option } { + global REALMNAME global KRSHD global tmppwd global krshd_spawn_id @@ -38,7 +39,7 @@ proc start_rsh_daemon { option } { # The -D argument tells it to accept a single connection, so we # don't need to use inetd. The 3544 is the port to listen at. - spawn $KRSHD -k -c -D 3544 -S $tmppwd/srvtab -M KRBTEST.COM -A $option + spawn $KRSHD -k -c -D 3544 -S $tmppwd/srvtab -M $REALMNAME -A $option set krshd_spawn_id $spawn_id set krshd_pid [exp_pid] @@ -64,6 +65,7 @@ proc stop_rsh_daemon { } { # we get some sort of error. proc rsh_test { } { + global REALMNAME global RSH global KEY global BINSH @@ -86,7 +88,7 @@ proc rsh_test { } { # Run rsh date. set testname "date" - spawn $RSH $hostname -k KRBTEST.COM -D 3544 -A date + spawn $RSH $hostname -k $REALMNAME -D 3544 -A date expect { -re "\[A-Za-z0-9 :\]+\[\r\n\]+$" { set result $expect_out(0,string) @@ -119,7 +121,7 @@ proc rsh_test { } { set failed no start_rsh_daemon -ek set testname "encrypted rsh" - spawn $RSH $hostname -x -k KRBTEST.COM -D 3544 -A echo hello + spawn $RSH $hostname -x -k $REALMNAME -D 3544 -A echo hello expect { "hello" { } timeout { @@ -146,7 +148,7 @@ proc rsh_test { } { # Check stderr start_rsh_daemon -k set testname "rsh to stderr" - spawn $RSH $hostname -k KRBTEST.COM -D 3544 -A $BINSH -c "'echo hello 1>&2'" + spawn $RSH $hostname -k $REALMNAME -D 3544 -A $BINSH -c "'echo hello 1>&2'" expect { "hello" { } timeout { @@ -167,7 +169,7 @@ proc rsh_test { } { start_rsh_daemon -e set testname "encrypted rsh to stderr" - spawn $RSH $hostname -x -k KRBTEST.COM -D 3544 -A $BINSH -c "'echo hello 1>&2'" + spawn $RSH $hostname -x -k $REALMNAME -D 3544 -A $BINSH -c "'echo hello 1>&2'" expect { "hello" { } timeout { diff --git a/src/tests/dejagnu/krb-standalone/sample.exp b/src/tests/dejagnu/krb-standalone/sample.exp index 03c5557da..af3c6aad3 100644 --- a/src/tests/dejagnu/krb-standalone/sample.exp +++ b/src/tests/dejagnu/krb-standalone/sample.exp @@ -96,6 +96,7 @@ proc stop_check_sserver_daemon { } { } proc test_sclient { msg } { + global REALMNAME global SCLIENT global hostname global spawn_id @@ -120,7 +121,7 @@ proc test_sclient { msg } { } expect { - "You are krbtest/admin@KRBTEST.COM\r" { + "You are krbtest/admin@$REALMNAME\r" { verbose "received valid sample message"} eof { fail $msg diff --git a/src/tests/dejagnu/krb-standalone/standalone.exp b/src/tests/dejagnu/krb-standalone/standalone.exp index 5cde955cb..0b3a4b0bf 100644 --- a/src/tests/dejagnu/krb-standalone/standalone.exp +++ b/src/tests/dejagnu/krb-standalone/standalone.exp @@ -1,4 +1,4 @@ -# Standalone Kerberos test. + # Standalone Kerberos test. # This is a DejaGnu test script. # This script tests that the Kerberos tools can talk to each other. @@ -28,6 +28,7 @@ if ![setup_kerberos_db 1] { # processes when the procedure ends. proc doit { } { + global REALMNAME global KLIST global KDESTROY global KEY @@ -58,7 +59,7 @@ proc doit { } { # Make sure that klist can see the ticket. spawn $KLIST expect { - -re "Ticket cache:\[ \]*$tmppwd/tkt.*Default principal:\[ \]*krbtest/admin@KRBTEST.COM.*krbtgt/KRBTEST.COM@KRBTEST.COM\r\n" { + -re "Ticket cache:\[ \]*$tmppwd/tkt.*Default principal:\[ \]*krbtest/admin@$REALMNAME.*krbtgt/$REALMNAME@$REALMNAME\r\n" { verbose "klist started" } timeout {