From bd0e65fb6e24cc0ffe62e127c6138642d399f20d Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 7 Nov 2008 21:56:40 +0000 Subject: [PATCH] Test that an iprop update log gets properly created and updated git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21042 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/dejagnu/config/default.exp | 19 ++++ src/tests/dejagnu/krb-standalone/iprop.exp | 112 +++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 src/tests/dejagnu/krb-standalone/iprop.exp diff --git a/src/tests/dejagnu/config/default.exp b/src/tests/dejagnu/config/default.exp index acd7e7747..e2b8533da 100644 --- a/src/tests/dejagnu/config/default.exp +++ b/src/tests/dejagnu/config/default.exp @@ -450,6 +450,7 @@ foreach i { {KDESTROY $objdir/../../clients/kdestroy/kdestroy} {RESOLVE $objdir/../resolve/resolve} {T_INETD $objdir/t_inetd} + {KPROPLOG $objdir/../../slave/kproplog} } { set varname [lindex $i 0] if ![info exists $varname] { @@ -781,12 +782,15 @@ proc modify_principal { name args } { # kpasswd +5 # krb524 +7 # application servers (krlogind, telnetd, krshd, ftpd, etc) +8 +# iprop +9 if [info exists PORTBASE] { set portbase $PORTBASE } else { set portbase 3085 } +set ulog 0 + # setup_kerberos_files # This procedure will create some Kerberos files which must be created # manually before trying to run any Kerberos programs. Returns 1 on @@ -804,6 +808,7 @@ proc setup_kerberos_files { } { global master_key_type global mode global portbase + global ulog if ![get_hostname] { return 0 @@ -851,6 +856,13 @@ proc setup_kerberos_files { } { puts $conffile " default_principal_expiration = 2037.12.31.23.59.59" puts $conffile " default_principal_flags = -postdateable forwardable" puts $conffile " dict_file = $tmppwd/dictfile" + if { $ulog != 0 } { + puts $conffile " iprop_enable = true" + puts $conffile " iprop_port = [expr 9 + $portbase]" + puts $conffile " iprop_logfile = $tmppwd/db.ulog" + } else { + puts $conffile "# no ulog" + } puts $conffile " \}" puts $conffile "" close $conffile @@ -890,6 +902,13 @@ proc setup_kerberos_files { } { return 1 } +proc reset_kerberos_files { } { + global tmppwd + file delete $tmppwd/kdc.conf $tmppwd/krb5.client.conf \ + $tmppwd/krb5.server.conf $tmppwd/krb5.kdc.conf + setup_kerberos_files +} + proc setup_krb5_conf { {type client} } { global tmppwd global hostname diff --git a/src/tests/dejagnu/krb-standalone/iprop.exp b/src/tests/dejagnu/krb-standalone/iprop.exp new file mode 100644 index 000000000..65944afe2 --- /dev/null +++ b/src/tests/dejagnu/krb-standalone/iprop.exp @@ -0,0 +1,112 @@ +# Password-changing Kerberos test. +# This is a DejaGnu test script. + +# Set up the Kerberos files and environment. +if {![get_hostname] || ![setup_kerberos_files] || ![setup_kerberos_env]} { + return +} + +# We are about to start up a couple of daemon processes. We do all +# the rest of the tests inside a proc, so that we can easily kill the +# processes when the procedure ends. + +proc doit { } { + global REALMNAME + global KLIST + global KDESTROY + global KEY + global KADMIN_LOCAL + global KTUTIL + global hostname + global tmppwd + global spawn_id + global supported_enctypes + global KRBIV + global portbase + global mode + global KPROPLOG + global ulog + + # Delete any db, ulog files + file delete $tmppwd/adb $tmppwd/adb.ok $tmppwd/adb.ulog + + # Update config file + set ulog 1 + reset_kerberos_files + + # Initialize the Kerberos database. The argument tells + # setup_kerberos_db that it is being called from here. + if ![setup_kerberos_db 0] { + return + } + if ![start_kerberos_daemons 0] { + return + } + + # Check that ulog file does exist + if [file exists $tmppwd/db.ulog] { + pass "create update log" + } else { + fail "create update log" + } + + # Use kadmin to add a key. + if ![add_kerberos_key wakawaka 0] { + return + } + + # Run kproplog, look at output. + spawn $KPROPLOG + expect_after { + timeout { + fail "kproplog output" + break + } + eof { + fail "kproplog output" + break + } + } + catch { + expect -re "Kerberos update log" + expect -re "Update log dump" + expect -re "First serial \# : 1" + expect -re "Last serial \# : 2" + expect -re "Update Entry" + expect -re "Update serial \# : 1" + expect -re "Attributes changed : 15" + expect -re "Update Entry" + expect -re "Update serial \# : 2" + expect -re "Update operation : Add" + expect -re "Update principal : wakawaka@KRBTEST.COM" + expect_after { + timeout { + fail "kproplog output" + break + } + } + expect -re "Attributes changed : 15" + expect eof + } foo + pass "kproplog output" + catch expect_after + if [check_exit_status kproplog] { + pass "kproplog exit status" + } else { + fail "kproplog exit status" + } +} + +set status [catch doit msg] + +stop_kerberos_daemons + +set ulog 0 +reset_kerberos_files +file delete $tmppwd/adb $tmppwd/adb.ok $tmppwd/db.ulog + +if { $status != 0 } { + send_error "ERROR: error in iprop.exp\n" + send_error "$msg\n" + exit 1 +} -- 2.26.2