krb5 commit: Remove unused kadmin and RPC test scripts
Greg Hudson
ghudson at mit.edu
Fri Dec 20 11:36:40 EST 2019
https://github.com/krb5/krb5/commit/75c4095d7f5bba3158cfe8d60d219ad7525fdc06
commit 75c4095d7f5bba3158cfe8d60d219ad7525fdc06
Author: Greg Hudson <ghudson at mit.edu>
Date: Thu Dec 19 02:29:11 2019 -0500
Remove unused kadmin and RPC test scripts
src/configure.ac | 1 -
src/kadmin/testing/scripts/Makefile.in | 15 +--
src/kadmin/testing/scripts/compare_dump.plin | 242 --------------------
src/kadmin/testing/scripts/find-make.sh | 18 --
src/kadmin/testing/scripts/make-host-keytab.plin | 144 ------------
src/kadmin/testing/scripts/simple_dump.plin | 88 -------
.../testing/scripts/verify_xrunner_report.plin | 38 ---
src/lib/rpc/unit-test/rpc_test_setup.sh | 56 -----
8 files changed, 1 insertions(+), 601 deletions(-)
diff --git a/src/configure.ac b/src/configure.ac
index 79b0bd0..47736f5 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -961,7 +961,6 @@ case "$srcdir" in
*) S_TOP=`pwd`/$srcdir ;;
esac
AC_SUBST(S_TOP)
-AC_PATH_PROG(PERL_PATH,perl)
AC_PATH_PROG(EXPECT,expect)
# For kadmin/testing/util/Makefile.in
if test "$TCL_LIBS" != "" ; then
diff --git a/src/kadmin/testing/scripts/Makefile.in b/src/kadmin/testing/scripts/Makefile.in
index 4b3c75c..fd0fd29 100644
--- a/src/kadmin/testing/scripts/Makefile.in
+++ b/src/kadmin/testing/scripts/Makefile.in
@@ -1,11 +1,5 @@
mydir=kadmin$(S)testing$(S)scripts
BUILDTOP=$(REL)..$(S)..$(S)..
-PERL_PATH=@PERL_PATH@
-
-.SUFFIXES: .plin .pl
-
-GEN_SCRIPTS = compare_dump.pl make-host-keytab.pl \
- simple_dump.pl verify_xrunner_report.pl
all: env-setup.sh $(GEN_SCRIPTS)
@@ -20,12 +14,5 @@ env-setup.stamp: $(srcdir)/env-setup.shin $(BUILDTOP)/config.status \
chmod +x env-setup.sh
touch env-setup.stamp
-.plin.pl:
- -rm -f $@.tmp
- echo "#!$(PERL_PATH)" > $@.tmp
- sed 1d $< >> $@.tmp
- chmod +x $@.tmp
- mv $@.tmp $@
-
clean:
- -rm -f $(GEN_SCRIPTS) *.tmp env-setup.sh env-setup.stamp
+ -rm -f env-setup.sh env-setup.stamp
diff --git a/src/kadmin/testing/scripts/compare_dump.plin b/src/kadmin/testing/scripts/compare_dump.plin
deleted file mode 100755
index df93df4..0000000
--- a/src/kadmin/testing/scripts/compare_dump.plin
+++ /dev/null
@@ -1,242 +0,0 @@
-#!/usr/local/bin/perl
-
-#
-# $Id$
-#
-
-# $debug = 1;
-
-sub usage { die "usage: $0 before after changes\n";}
-
-sub unique {
- local(@list) = @_;
- local(%ary);
-
- print "unique? ",join(" ", at list),"\n" if $debug;
-
- foreach (@list) {
- return(0) if $ary{$_}++;
- }
-
- 1;
-}
-
-$before = shift(@ARGV) || &usage;
-$debug++ if $before =~ /^-d/;
-$before = shift(@ARGV) || &usage if $debug;
-$after = shift(@ARGV) || &usage;
-$changes = shift(@ARGV) || &usage;
- at ARGV && &usage;
-
-%policy =
- (
- "FIRST",2,
- "pw_min_life",2,
- "pw_max_life",3,
- "pw_min_length",4,
- "pw_min_classes",5,
- "pw_history_num",6,
- "policy_refcnt",7,
- "LAST",7,
- );
-
-%princ =
- (
- "FIRST",2,
- "kvno",2,
- "mod_name",3,
- "max_life",4,
- "princ_expire_time",5,
- "expiration",5,
- "pw_expiration",6,
- "attributes",7,
- "policy",8,
- "aux_attributes",9,
- "LAST",9,
- );
-
-%keytab =
- (
- "LAST",-1,
- );
-
-sub re { # @_ = ($cnt, $line)
- local($cnt, $line) = @_;
- local(@fields) = split(' ',$line);
-
- @list = ('\S+') x $cnt;
- for $f (@fields[3..$#fields]) {
- ($f =~ /=/) || die "Bad field: $f in $_";
- if (!defined($this{$`})) { die "Bad parameter $` in $_"; }
-
- if (($list[$this{$`}] = $') eq '\S+') {
- $list[$this{$`}] = '[^\s]+';
- }
- }
-
- join('\s+', at list)."\$";
-}
-
-open(CHANGES, $changes) || die "Couldn't open $changes: $!\n";
-
-while(<CHANGES>) {
- next if s/^\s*\#\#\!\s*\#//;
- next if !s/^\s*\#\#\!\s*//;
-
- split;
-
- if ($_[1] =~ /princ/) {
- %this = %princ;
- $this = "princ";
- } elsif ($_[1] =~ /policy/) {
- %this = %policy;
- $this = "policy";
- } elsif ($_[1] =~ /keytab/) {
- %this = %keytab;
- $this = $_[1];
- } else {
- die "Bad line: $_";
- }
-
- $cnt = $this{"LAST"}+1;
-
- if ($_[0] =~ /add/) {
- $diff{"+$this\t$_[2]"} = &re($cnt,$_);
- } elsif ($_[0] =~ /delete/) {
- $diff{"-$this\t$_[2]"} = &re($cnt,$_);
- } elsif ($_[0] =~ /changefrom/) {
- $diff{"-$this\t$_[2]"} = &re($cnt,$_);
- } elsif ($_[0] =~ /changeto/) {
- $ndiff{"-$this\t$_[2]"} = &re($cnt,$_);
- } else {
- die "Bad line: $_";
- }
-}
-
-close(CHANGES);
-
-if ($debug) {
- for (keys %diff) {
- print " %diff: \"$_\" /$diff{$_}/\n";
- }
-
- for (keys %ndiff) {
- print "%ndiff: \"$_\" /$ndiff{$_}/\n";
- }
-
- print "\n";
-}
-
-open(DIFF,"gdiff -u0 $before $after|") || die "Couldn't diff: $!\n";
-
-$warnings = 0;
-
-while(<DIFF>) {
- next if /^\+{3}/;
- next if /^\-{3}/;
- next if /^@@/;
-
- print "LINE: $_" if $debug;
-
- split;
-
- $key = "$_[0]\t$_[1]";
- $re = $diff{$key};
-
- delete $diff{$key};
-
- print "%diff: \"$key\" /$re/\n" if $debug;
-
- if (!$re) {
- warn "Unexpected: \"$key\"\n";
- $warnings++;
- next;
- }
-
- if (!/$re/) {
- warn "Failed: $key\n";
- $warnings++;
- next;
- }
-
- if ($new = $ndiff{$key}) {
- delete $ndiff{$key};
-
- @new = split(/\\s\+/, $new);
- for ($i=1;$i<@new;$i++) {
- print "NEW: $new[$i]\n" if $debug;
-
- if ($new[$i] ne '\S+') {
- $_[$i] = $new[$i];
- }
- }
- $_[0] =~ s/^\-//;
- $key =~ s/^\-/\+/;
-
- $diff{$key} = join("\t", at _);
- }
-}
-
-close(DIFF);
-
-open(BEFORE, $before) || die "Couldn't open $before: $!\n";
-
-while(<BEFORE>) {
- next if !/^keytab/;
-
- split;
-
- if (!$seen{$key = $_[0]." ".$_[1]}++) {
- $key =~ s/-\d+$//;
- $ktkeys{$key} .= " ".$_[2];
- $kttimes{$key} .= " ".$_[3];
- }
-}
-
-close(BEFORE);
-
-open(AFTER, $after) || die "Couldn't open $after: $!\n";
-
-while(<AFTER>) {
- next if !/^keytab/;
-
- split;
-
- if (!$seen{$key = $_[0]." ".$_[1]}++) {
- $key =~ s/-\d+$//;
- $ktkeys{$key} .= " ".$_[2];
- $kttimes{$key} .= " ".$_[3];
- }
-}
-
-close(AFTER);
-
-for (keys %diff) {
- warn "Unseen: \"$_\" /$diff{$_}/\n";
- $warnings++;
-}
-
-for (keys %ndiff) {
- warn "Unseen changes: \"$_\" /$ndiff{$_}/\n";
- $warnings++;
-}
-
-for (keys %ktkeys) {
- if (!&unique(split(' ',$ktkeys{$_}))) {
- warn "Some keys not unique for $_\n";
- $warnings++;
- }
-}
-
-for (keys %kttimes) {
- if (!&unique(split(' ',$kttimes{$_}))) {
- warn "Some timestamps not unique for $_\n";
- $warnings++;
- }
-}
-
-if ($warnings) {
- warn "$warnings warnings.\n";
-}
-
-exit($warnings);
diff --git a/src/kadmin/testing/scripts/find-make.sh b/src/kadmin/testing/scripts/find-make.sh
deleted file mode 100755
index 904730d..0000000
--- a/src/kadmin/testing/scripts/find-make.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-POSSIBILITIES='
-/usr/local/bin/gmake
-/usr/local/bin/make
-'
-
-for file in $POSSIBILITIES; do
- if [ -f $file ]; then
- echo $file
- exit 0
- fi
-done
-
-echo gmake
-echo '$0 could not find make!' 1>&2
-exit 1
-
diff --git a/src/kadmin/testing/scripts/make-host-keytab.plin b/src/kadmin/testing/scripts/make-host-keytab.plin
deleted file mode 100755
index c77d61c..0000000
--- a/src/kadmin/testing/scripts/make-host-keytab.plin
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/local/bin/perl
-
-$server = undef;
- at princs = ();
-$top = undef;
-
-($whoami = $0) =~ s,.*/,,;
-$usage = "Usage: $whoami [ -server server ] [ -princ principal ]
- [ -top dirname ] [ -verbose ] filename
- Server defaults to the local host.
- Default principals are host/hostname\@SECURE-TEST.OV.COM and
- test/hostname\@SECURE-TEST.OV.COM.
- If any principals are specified, the default principals are
- not added to the keytab.
- The string \"xCANONHOSTx\" in a principal specification will be
- replaced by the canonical host name of the local host.";
-
- at ORIG_ARGV = @ARGV;
-
-while (($_ = $ARGV[0]) && /^-/) {
- shift;
- if (/^-server$/) {
- ($server = shift) || die "Missing argument to $_ option.\n$usage\n";
- }
- elsif (/^-princ$/) {
- ($princ = shift) || die "Missing argument to $_ option.\n$usage\n";
- push(@princs, $princ);
- }
- elsif (/^-top$/) {
- ($top = shift) || die "Missing argument to $_ option.\n$usage\n";
- }
- elsif (/^-verbose$/) {
- $verbose++;
- }
- elsif (/^--$/) {
- last;
- }
- else {
- die "Unknown option $_.\n$usage\n";
- }
-}
-
- at princs = ("host/xCANONHOSTx\@SECURE-TEST.OV.COM",
- "test/xCANONHOSTx\@SECURE-TEST.OV.COM")
- if (! @princs);
-
-$ktfile = shift(@ARGV) || die "need a keytab file\n";
-
-$verbose++ if ($ENV{'VERBOSE_TEST'});
-
-print "In $0 @ORIG_ARGV...\n" if ($verbose);
-
-chop ($canonhost = `hostname`);
-
-($canonhost,$aliases,$addrtype,$length, at addrs) = gethostbyname($canonhost);
-die "couldn't get canonical hostname\n" if !($canonhost && @addrs);
-($canonhost2) = gethostbyaddr($addrs[0],$addrtype);
-if ($canonhost2) { $canonhost = $canonhost2; }
-
-for (@princs) {
- s/xCANONHOSTx/$canonhost/g;
-}
-
-die "Neither \$TOP nor \$TESTDIR is set, and -top not specified.\n"
- if (! ($top || $ENV{'TOP'} || $ENV{'TESTDIR'}));
-
-$top = $ENV{'TOP'} if (! $top);
-$TESTDIR = ($ENV{'TESTDIR'} || "$top/testing");
-$MAKE_KEYTAB = ($ENV{'MAKE_KEYTAB'} || "$TESTDIR/scripts/$whoami");
-$SRVTCL = ($ENV{'SRVTCL'} || "$TESTDIR/util/kadm5_srv_tcl");
-$TCLUTIL = ($ENV{'TCLUTIL'} || "$TESTDIR/tcl/util.t");
-# This'll be wrong sometimes
-$RSH_CMD = ($ENV{'RSH_CMD'} || '/usr/ucb/rsh');
-$KADMIN = ($ENV{'KADMIN'} || "$top/cli/kadmin.local");
-
-if ($server) {
-# XXX Using /usr/ucb/rsh for now.
-
-# Strip command line options because we're adding our own.
-
- $MAKE_KEYTAB =~ s/ .*//;
-
- if ($ENV{'TOP'} && ($top ne $ENV{'TOP'})) {
-# Replace the old TOP with the new one where necessary
- for ('TESTDIR', 'SRVTCL', 'TCLUTIL', 'MAKE_KEYTAB') {
- eval "\$$_ =~ s/^\$ENV{'TOP'}/\$top/;";
- }
-
-# Make the paths as short as possible so our command line isn't too long.
-# for ('SRVTCL', 'TCLUTIL', 'MAKE_KEYTAB') {
-# eval "\$$_ =~ s/^\$TESTDIR/\\\\\\\$TESTDIR/;";
-# }
-# for ('TESTDIR', 'SRVTCL', 'TCLUTIL', 'MAKE_KEYTAB') {
-# eval "\$$_ =~ s/^\$top/\\\\\\\$TOP/;";
-# }
- }
-
- $cmd = "cd $top; \\`testing/scripts/find-make.sh\\` execute TOP=$top ";
- $cmd .= "VERBOSE_TEST=$verbose " if ($verbose);
- $cmd .= "TESTDIR=$TESTDIR ";
- $cmd .= "SRVTCL=$SRVTCL ";
- $cmd .= "TCLUTIL=$TCLUTIL ";
-
- $cmd .= "CMD='$MAKE_KEYTAB ";
- for (@princs) {
- $cmd .= "-princ $_ ";
- }
- $cmd .= " /tmp/make-keytab.$canonhost.$$'";#';
-
- $cmd = "$RSH_CMD $server -l root -n \"$cmd\"";
-
- $cmd2 = "$RSH_CMD $server -l root -n \"cat /tmp/make-keytab.$canonhost.$$\" > $ktfile";
-
- $cmd3 = "$RSH_CMD $server -l root -n \"rm /tmp/make-keytab.$canonhost.$$\"";
-
- for ($cmd, $cmd2, $cmd3) {
- print "$_\n" if ($verbose);
-
- system($_) && die "Couldn't run $_: $!.\n";
- }
-}
-else {
- $redirect = "> /dev/null" if (! $verbose);
-
- # We can ignore errors here, because the ktadd below will fail if
- # this fails for any reason other than "principal exists"
- for (@princs) {
- next if (/^kadmin/);
- $cmd = "$KADMIN -q 'ank -randkey $_' $redirect 2>&1";
- system($cmd);
- }
-
- $cmd = "$KADMIN -q 'ktadd -k $ktfile ";
- $cmd .= " -q " if (! $verbose);
- $cmd .= "@princs' $redirect";
- if (system "$cmd") {
- sleep(1);
- die "Error in system($cmd)\n";
- }
-}
-
-if (! -f $ktfile) {
- die "$ktfile not created.\n";
-}
diff --git a/src/kadmin/testing/scripts/simple_dump.plin b/src/kadmin/testing/scripts/simple_dump.plin
deleted file mode 100755
index ea94ab2..0000000
--- a/src/kadmin/testing/scripts/simple_dump.plin
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/local/bin/perl
-
-#
-# $Id$
-#
-
-## ovsec_adm_export format
-## [0]"policy" [1]name [2]pw_min_life [3]pw_max_life [4]pw_min_length [5]pw_min_classes [6]pw_history_num [7]policy_refcnt
-## [0]"princ" [1]name [2]policy [3]aux_attributes [4]old_key_len [5]admin_history_kvno [6..]old_keys
-$oaevers = "1.0";
-
-open(SORT, "|sort") || die "Couldn't open pipe to sort for output: $!\n";
-
-open(OAE, "$ENV{'TOP'}/install/admin/ovsec_adm_export|") ||
- die "Couldn't get oae: $!\n";
-
-$header = <OAE>;
-
-die "Not ovsec_adm_export output\n"
- if ($header !~ /^OpenV\*Secure V(\d+\.\d+)/);
-
-$stdinvers = $1;
-
-die "Expected oae version $oaevers, got $stdinvers instead.\n"
- if $stdinvers ne $oaevers;
-
-while(<OAE>) {
- if (/^End of Database/) {
- last;
- } elsif (/^policy/) {
- print SORT;
- } elsif (/^princ/) {
- split(/\t/);
-
- $_[2] = "\"\"" if !$_[2];
-
- $_[3] = hex("0x".$_[3]);
-
- $princ{$_[1]} = sprintf("%s\t0x%04x", at _[2,3]);
- }
-}
-
-## kdb_edit ddb format
-## [0]strlen(principal) [1]strlen(mod_name) [2]key.length [3]alt_key.length [4]salt_length [5]alt_salt_length [6]principal [7]key.key_type [8]key.contents [9]kvno [10]max_life [11]max_renewable_life [12]mkvno [13]expiration [14]pw_expiration [15]last_pwd_change [16]last_success [17]last_failed [18]fail_auth_count [19]mod_name [20]mod_date [21]attributes [22]salt_type [23]salt [24]alt_key.contents [25]alt_salt [26..33]expansion*8;
-$ddbvers = "2.0";
-
-open(DDB, "$ENV{'TOP'}/install/admin/kdb5_edit -r SECURE-TEST.OV.COM -R ddb|") ||
- die "Couldn't get ddb: $!\n";
-
-$header = <DDB>;
-
-die "Not a kdb5_edit ddb\n"
- if ($header !~ /^kdb5_edit load_dump version (\d+\.\d+)/);
-
-$stdinvers = $1;
-
-die "Expected ddb version $ddbvers, got $stdinvers instead.\n"
- if $stdinvers ne $ddbvers;
-
-## [6]principal [9]kvno [19]mod_name [10]max_life [13]expiration [14]pw_expiration [21]attributes // [2]policy [3]aux_attributes
-
-while(<DDB>) {
- split;
-
- print SORT join("\t","princ",(@_)[6,9,19,10,13,14],
- sprintf("0x%04x",$_[21]),
- $princ{$_[6]}),"\n";
-}
-
-close(DDB);
-
-for $keytab (@ARGV) {
- open(KLIST, "$ENV{'TOP'}/install/bin/klist -k -t -K FILE:$keytab|") ||
- die "Couldn't list $keytab: $!\n";
-
- $dummy = <KLIST>;
- $dummy = <KLIST>;
- $dummy = <KLIST>;
-
- while(<KLIST>) {
- s/^\s+//;
- split;
- printf(SORT "keytab:FILE:%s\t%s-%s\t%s\t%s,%s\n",$keytab,
- @_[3,0,4,1,2]);
- }
-}
-
-close(SORT);
diff --git a/src/kadmin/testing/scripts/verify_xrunner_report.plin b/src/kadmin/testing/scripts/verify_xrunner_report.plin
deleted file mode 100755
index 9d83c3e..0000000
--- a/src/kadmin/testing/scripts/verify_xrunner_report.plin
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/local/bin/perl
-
-sub usage { die "usage: $0 reportfile\n"; }
-
-$report = shift(@ARGV) || die &usage;
-
-open(REPORT, $report) || die "Couldn't open $report: $!\n";
-
-while(<REPORT>) {
- if (/Process termination:/ && !/\bOK\b/) {
- warn "Process termination not OK\n";
- $warnings++;
- } elsif (/Number of detected mismatches:\s*(\d+)/ && ($1 ne "0")) {
- warn "Number of detected mismatches = $1\n";
- $warnings++;
- } elsif (/Detailed Results Description/) {
- break;
- }
-}
-
-while(<REPORT>) {
- next if !/^\d+\s+/;
-
- split;
-
- if (($_[2] ne "run") &&
- ($_[2] ne "OK") &&
- ($_[2] ne "end-of-test")) {
- warn "Unexpected result code $_[2] from test $_[4]\n";
- $warnings++;
- }
-}
-
-if ($warnings) {
- warn "$warnings warnings.\n";
-}
-
-exit($warnings);
diff --git a/src/lib/rpc/unit-test/rpc_test_setup.sh b/src/lib/rpc/unit-test/rpc_test_setup.sh
deleted file mode 100755
index d7df0eb..0000000
--- a/src/lib/rpc/unit-test/rpc_test_setup.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-#
-# This script performs additional setup for the RPC unit test. It
-# assumes that gmake has put TOP and RPC_TEST_KEYTAB into the
-# environment.
-#
-# $Id$
-# $Source$
-
-DUMMY=${TESTDIR=$TOP/testing}
-DUMMY=${CLNTTCL=$TESTDIR/util/kadm5_clnt_tcl}
-DUMMY=${TCLUTIL=$TESTDIR/tcl/util.t}; export TCLUTIL
-DUMMY=${MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl}
-
-if $VERBOSE; then
- REDIRECT=
-else
- REDIRECT='>/dev/null'
-fi
-
-PATH=$TOP/install/admin:$PATH; export PATH
-
-cat - > /tmp/rpc_test_setup$$ <<\EOF
-source $env(TCLUTIL)
-set h $env(QUALNAME)
-puts stdout [kadm5_init admin admin $KADM5_ADMIN_SERVICE null $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 server_handle]
-if ![info exists server_handle] { exit 1 }
-puts stdout [kadm5_create_principal $server_handle [simple_principal server/$h] {KADM5_PRINCIPAL} admin]
-puts stdout [kadm5_randkey_principal $server_handle server/$h key null]
-puts stdout [kadm5_create_principal $server_handle [simple_principal notserver/$h] {KADM5_PRINCIPAL} admin]
-puts stdout [kadm5_randkey_principal $server_handle notserver/$h key null]
-puts stdout [kadm5_destroy $server_handle]
-EOF
-eval "$CLNTTCL $REDIRECT < /tmp/rpc_test_setup$$"
-if test $? != 0 ; then
- rm /tmp/rpc_test_setup$$
- echo 1>&2 error setting up database for tests
- exit 1
-fi
-rm /tmp/rpc_test_setup$$
-
-rm -f $RPC_TEST_KEYTAB
-
-eval $MAKE_KEYTAB -princ server/$CANON_HOST $RPC_TEST_KEYTAB $REDIRECT
-
-# grep -s "$CANON_HOST SECURE-TEST.OV.COM" /etc/krb.realms
-# if [ $? != 0 ]; then
-# eval echo \"Adding \$CANON_HOST SECURE-TEST.OV.COM to /etc/krb.realms\" $REDIRECT
-# ed /etc/krb.realms <<EOF >/dev/null
-# 1i
-# $CANON_HOST SECURE-TEST.OV.COM
-# .
-# w
-# q
-# EOF
-# fi
More information about the cvs-krb5
mailing list