+++ /dev/null
-#!/bin/sh
-
-REALM=SECURE-TEST.OV.COM; export REALM
-DUMMY=${TESTDIR=$TOP/testing}; export TESTDIR
-DUMMY=${SRVTCL=$TESTDIR/util/ovsec_kadm_srv_tcl}; export SRVTCL
-DUMMY=${TCLUTIL=$TESTDIR/tcl/util.t}; export TCLUTIL
-
-$SRVTCL <<'EOF'
-global r
-
-source $env(TCLUTIL)
-set r $env(REALM)
-
-proc newpol { pname } {
- puts stdout [ovsec_kadm_create_policy $server_handle [simple_policy "$pname"] {OVSEC_KADM_POLICY}]
-}
-
-proc newprinc { name } {
- global r
- puts stdout [ovsec_kadm_create_principal $server_handle [simple_principal "$name@$r"] {OVSEC_KADM_PRINCIPAL} $name]
-}
-
-proc chpass { princ pass } {
- global server_handle
- puts stdout [ovsec_kadm_chpass_principal $server_handle "$princ" "$pass"]
-}
-
-puts stdout [ovsec_kadm_init $env(SRVTCL) mrroot null $r $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 server_handle]
-
-puts stdout [ovsec_kadm_create_policy $server_handle "export_pwhist 0 0 0 0 10 0" {OVSEC_KADM_POLICY OVSEC_KADM_PW_HISTORY_NUM}]
-
-### Commented out since this isn't going to work for the december beta
-#newprinc "export_with space"
-#newprinc "export_with\"dquote"
-#newprinc "export_with\nnewline"
-
-puts stdout [ovsec_kadm_create_principal $server_handle [princ_w_pol export_hist1@$r export_pwhist] {OVSEC_KADM_PRINCIPAL OVSEC_KADM_POLICY} hist1]
-
-chpass export_hist1@$r hist1_a
-
-puts stdout [ovsec_kadm_create_principal $server_handle [princ_w_pol export_hist10@$r export_pwhist] {OVSEC_KADM_PRINCIPAL OVSEC_KADM_POLICY} hist10]
-
-chpass export_hist10@$r hist10_a
-chpass export_hist10@$r hist10_b
-chpass export_hist10@$r hist10_c
-chpass export_hist10@$r hist10_d
-chpass export_hist10@$r hist10_e
-chpass export_hist10@$r hist10_f
-chpass export_hist10@$r hist10_g
-chpass export_hist10@$r hist10_h
-chpass export_hist10@$r hist10_i
-
-puts stdout [ovsec_kadm_destroy $server_handle]
-
-EOF
+++ /dev/null
-#!/bin/sh
-
-DUMMY=${TESTDIR=$TOP/testing}
-DUMMY=${BSDDB_DUMP=$TESTDIR/util/bsddb_dump}
-DUMMY=${KDB5_EDIT=$TOP/../admin/edit/kdb5_edit}
-
-DPRINC=/tmp/dbdump.princ
-DPOL=/tmp/dbdump.policy
-
-DPRINC1=$DPRINC.1
-DPRINC2=$DPRINC.2
-
-DPOL1=$DPOL.1
-DPOL2=$DPOL.2
-
-DEXPORT=/tmp/dbexport
-
-./add-to-db.sh
-
-rm -f $DEXPORT
-../kadm5_export > $DEXPORT
-
-if $KDB5_EDIT -R ddb | sort > $DPRINC1; then
- :
-else
- echo "error dumping princ.1"
-fi
-if $BSDDB_DUMP /krb5/kadb5 | sort > $DPOL1; then
- :
-else
- echo "error dumping policy.1"
-fi
-
-rm -f /krb5/kadb5*
-touch /krb5/ovsec_adm.lock
-
-../../import/kadm5_import < $DEXPORT
-
-if $KDB5_EDIT -R ddb | sort > $DPRINC2; then
- :
-else
- echo "error dumping princ.2"
-fi
-if $BSDDB_DUMP /krb5/kadb5 | sort > $DPOL2; then
- :
-else
- echo "error dumping policy.2"
-fi
-
-
-status=0
-
-if test -s $DPRINC1 && \
- test -s $DPRINC2 && \
- cmp -s $DPRINC1 $DPRINC2; then
- echo "export/import principal db succeeded"
-else
- echo "export/import principal db failed"
- status=1
-fi
-
-if test -s $DPOL1 && \
- test -s $DPOL2 && \
- cmp -s $DPOL1 $DPOL2; then
- echo "export/import policy db succeeded"
-else
- echo "export/import policy db failed"
- status=1
-fi
-
-if [ $status -eq 0 ]; then
- rm -f $DPRINC* $DPOL* $DEXPORT
-fi
-
-exit $status
+++ /dev/null
-#
-# $Id$
-#
-
-if {[info commands exp_version] != {}} {
- set exp_version_4 [regexp {^4} [exp_version]]
-} else {
- set exp_version_4 [regexp {^4} [expect_version]]
-}
-
-# Backward compatibility until we're using expect 5 everywhere
-if {$exp_version_4} {
- global wait_error_index wait_errno_index wait_status_index
- set wait_error_index 0
- set wait_errno_index 1
- set wait_status_index 1
-} else {
- set wait_error_index 2
- set wait_errno_index 3
- set wait_status_index 3
-}
-
-proc myfail { comment } {
- global mytest_name
- global mytest_status
- wait
- fail "$mytest_name: $comment"
- set mytest_status 1
-}
-
-proc mypass {} {
-}
-
-##
-## When you expect on an id, and eof is detected, the spawn_id is closed.
-## It may be waited for, but calling expect or close on this id is an ERROR!
-##
-
-proc mytest { name kpargs status args } {
- global spawn_id
- global timeout
- global mytest_name
- global mytest_status
- global wait_error_index wait_errno_index wait_status_index
-
- verbose "starting test: $name"
-
- set mytest_name "$name"
-
- eval export_start $kpargs
-
- # at the end, eof is success
-
- lappend args { eof { if {[regexp "\[\r\n\]$" $expect_out(buffer)] == 0} { myfail "final status message not newline-terminated" } } }
-
- # for each test argument....
- # rep invariant: when this foreach ends, the id is close'd, but
- # not wait'ed.
-
- foreach test $args {
- set mytest_status 0
-
- # treat the arg as an expect parameter
- # if failure, the process will be closed and waited.
-
- uplevel 1 "expect {
- $test
- timeout { close; myfail \"timeout\"}
- eof { myfail \"eof read before expected message string\" }
- }"
-
- if {$mytest_status == 1} { return }
- }
-
- # at this point, the id is closed and we can wait on it.
-
- set ret [wait]
- verbose "% Exit $ret" 1
- if {[lindex $ret $wait_error_index] == -1} {
- fail "$name: wait returned error [lindex $ret $wait_errno_index]"
- } else {
- if { ((![string compare $status zero]) &&
- ([lindex $ret $wait_status_index] == 0)) ||
- ((![string compare $status nonzero]) &&
- ([lindex $ret $wait_status_index] != 0)) } {
- pass "$name"
- } else {
- fail "$name: unexpected return status [lindex $ret $wait_status_index], should be $status"
- }
- }
-}
-
-proc export_win { name args } {
- mytest "$name" "$args" zero {
- -re "Database export complete, \[0-9\]+ records processed."
- { mypass }
- eof
- { myfail "error: $expect_out(buffer)" }
- }
-}
-
-proc export_lose { name args error } {
- mytest "$name" "$args" nonzero {
- -re "Database export complete, \[0-9\]+ records processed."
- { close; myfail "unexpected success" }
- -re "ovsec_adm_export: .*$error"
- { mypass }
- eof
- { myfail "error: $expect_out(buffer)" }
- }
-}
-
-proc check_mode { test file mode } {
- if {[catch "file stat $file stats" output]} {
- unresolved "$test: can't stat $file: $output"
- } else {
- set stats(mode) [format "%o" [expr $stats(mode) & 07777]]
- set mode [format "%o" [expr $mode]]
- if {$stats(mode) != $mode} {
- fail "$test: wrong mode ($stats(mode) should be $mode)"
- } else {
- verbose "$test: file $file has mode $mode"
- pass $test
- }
- }
-}