From: Ezra Peisach Date: Tue, 15 Oct 1996 10:43:25 +0000 (+0000) Subject: * Makefile.in: Added standard rules for .plin -> .pl X-Git-Tag: krb5-1.0-freeze1~252 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=846dc8827cbcc6aa38ea5a06e3782b3e7a37b5bb;p=krb5.git * Makefile.in: Added standard rules for .plin -> .pl * *.plin: Renamed from *.pl.in All files copied in source tree to preserve history - cvs update will create properly. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9170 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/testing/scripts/ChangeLog b/src/kadmin/testing/scripts/ChangeLog index 85b040777..a0f7038cf 100644 --- a/src/kadmin/testing/scripts/ChangeLog +++ b/src/kadmin/testing/scripts/ChangeLog @@ -1,3 +1,9 @@ +Tue Oct 15 06:39:58 1996 Ezra Peisach + + * Makefile.in: Added standard rules for .plin -> .pl + + * *.plin: Renamed from *.pl.in + Thu Oct 10 17:32:22 1996 Ezra Peisach * env-setup.shin (EXPECT): Subsititute path for expect from diff --git a/src/kadmin/testing/scripts/Makefile.in b/src/kadmin/testing/scripts/Makefile.in index b354c401e..76159e940 100644 --- a/src/kadmin/testing/scripts/Makefile.in +++ b/src/kadmin/testing/scripts/Makefile.in @@ -1,5 +1,7 @@ PERL=@PERL@ +.SUFFIXES: .plin .pl + GEN_SCRIPTS = compare_dump.pl fixup-conf-files.pl make-host-keytab.pl \ simple_dump.pl verify_xrunner_report.pl qualname.pl @@ -17,7 +19,7 @@ restore_files.sh: rm -f restore_files.sh ln -s $(srcdir)/save_files.sh restore_files.sh -%.pl: %.pl.in +.plin.pl: -rm -f $@.tmp echo "#!$(PERL)" > $@.tmp sed 1d $< >> $@.tmp diff --git a/src/kadmin/testing/scripts/compare_dump.pl.in b/src/kadmin/testing/scripts/compare_dump.pl.in deleted file mode 100644 index df93df4a0..000000000 --- a/src/kadmin/testing/scripts/compare_dump.pl.in +++ /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(" ",@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; -@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+',@list)."\$"; -} - -open(CHANGES, $changes) || die "Couldn't open $changes: $!\n"; - -while() { - 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() { - 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",@_); - } -} - -close(DIFF); - -open(BEFORE, $before) || die "Couldn't open $before: $!\n"; - -while() { - 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() { - 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/fixup-conf-files.pl.in b/src/kadmin/testing/scripts/fixup-conf-files.pl.in deleted file mode 100644 index d7834d1c7..000000000 --- a/src/kadmin/testing/scripts/fixup-conf-files.pl.in +++ /dev/null @@ -1,344 +0,0 @@ -#!/usr/local/bin/perl -# -# Usage: fixup-conf-files.pl [-server hostname] - -$verbose = $ENV{'VERBOSE_TEST'}; -$archos = $ENV{'ARCH_OS'}; - -$REALM = "SECURE-TEST.OV.COM"; - -sub replace { - local($old, $new, $backup) = @_; - local($dev, $ino, $mode); - - $new = $old.".new" if !$new; - $backup = $old.".bak" if !$backup; - - chmod($mode,$new) if (($dev, $ino, $mode) = stat($old)); - - unlink($backup); - link($old, $backup) || die "couldn't make backup link: $backup: $!\n" - if -e $old; - rename($new, $old) || die "couldn't rename $old to $new: $!\n"; -} - -if (@ARGV == 2 && $ARGV[0] eq "-server") { - $servername = $ARGV[1]; -} elsif (@ARGV != 0) { - print STDERR "Usage: $0 fixup-conf-files.pl [-server hostname]\n"; -} - -sub canonicalize_name { - local($hostname) = @_; - local($d, $addr, $addrtype); - - ($host,$d,$addrtype,$d,$addr) = gethostbyname($hostname); - die "couldn't get hostname $hostname\n" if !$host; - ($host) = gethostbyaddr($addr,$addrtype); - die "couldn't reverse-resolve $hostname\n" if !$host; - return $host; -} - -## Get server's canonical hostname. -if ($servername) { - $serverhost = $servername; -} else { - chop ($serverhost = `hostname`); -} -$serverhost = &canonicalize_name($serverhost); - -## Get local canonical hostname -chop($localhost=`hostname`); -$localhost = &canonicalize_name($localhost); - -## parse krb.conf - -if (open(KCONF, "/etc/athena/krb.conf")) { - chop($hrealm = ); - - $confok = 0; - - while() { - $confs .= $_ if !/^$REALM\s+/o; - $confok = 1 if /^$REALM\s+$serverhost\s+admin\s+server$/oi; - } - - close(KCONF); -} - -## rewrite krb.conf if necessary. - -if (($hrealm ne $REALM) || !$confok) { - print "Rewriting /etc/athena/krb.conf...\n" if $verbose; - - open(KCONF, ">/etc/athena/krb.conf.new") || - die "couldn't open /etc/athena/krb.conf.new: $!\n"; - - print KCONF "$REALM\n"; - print KCONF "$REALM $serverhost admin server\n"; - print KCONF $confs; - - close(KCONF); - - &replace("/etc/athena/krb.conf"); -} - -## parse krb.realms - -if (open(KREALMS, "/etc/athena/krb.realms")) { - $serverrealmok = 0; - $localrealmok = 0; - - while() { - $realms .= $_ - if !/^$serverhost\s+$REALM$/oi && !/^$localhost\s+$REALM$/oi; - $serverrealmok = 1 if /^$serverhost\s+$REALM$/oi; - $localrealmok = 1 if /^$localhost\s+$REALM$/oi; - } - - close(KREALMS); -} - -## rewrite krb.realms if necessary. - -if (!$serverrealmok || !$localrealmok) { - print "Rewriting /etc/athean/krb.realms...\n" if $verbose; - - open(KREALMS, ">/etc/athena/krb.realms.new") || - die "couldn't open /etc/athena/krb.realms.new: $!\n"; - - print KREALMS "$serverhost $REALM\n"; - print KREALMS "$localhost $REALM\n" if ($localhost ne $serverhost); - print KREALMS $realms; - - close(KREALMS); - - &replace("/etc/athena/krb.realms"); -} - -# ## read /etc/passwd -# -# open(PASSWD, "/etc/passwd") || die "couldn't open /etc/passwd: $!\n"; -# -# $passok = 0; -# -# if ($archos ne "solaris2.3") { -# %mypass = -# ( -# "root", crypt("testroot","St"), -# "testenc", crypt("notath","HJ"), -# "testuser", "KERBEROS5", -# "pol1", "KERBEROS5", -# "pol2", "KERBEROS5", -# "pol3", "KERBEROS5", -# ); -# } else { -# %mypass = -# ( -# "root", "x", -# "testenc", "x", -# "testuser", "x", -# "pol1", "x", -# "pol2", "x", -# "pol3", "x", -# ); -# %myshadow = -# ( -# "root", crypt("testroot","St"), -# "testenc", crypt("notath","HJ"), -# "testuser", "KERBEROS5", -# "pol1", "KERBEROS5", -# "pol2", "KERBEROS5", -# "pol3", "KERBEROS5", -# ); -# } -# -# $chpw = 0; -# -# while() { -# if (/^([^:]+):([^:]+):/ && $mypass{$1}) { -# $users{$1}++; -# if ($2 ne $mypass{$1}) { -# s/^([^:]+):([^:]+):/$1:$mypass{$1}:/; -# $chpw++; -# } -# } -# $pass .= $_; -# } -# -# $passok = 1; -# -# for (keys %mypass) { -# if (!$users{$_}) { -# $pass .= "$_:$mypass{$_}:32765:101::/tmp:/bin/csh\n"; -# $passok = 0; -# } -# } -# close(PASSWD); -# -# ## rewrite passwd if necessary. -# -# if ($chpw || !$passok) { -# print "Rewriting /etc/passwd...\n" if $verbose; -# -# open(PASSWD, ">/etc/passwd.new") || -# die "couldn't open /etc/passwd.new: $!\n"; -# -# print PASSWD $pass; -# -# close(PASSWD); -# -# &replace("/etc/passwd"); -# } -# -# if ($archos eq "solaris2.3") { -# -# ## read /etc/shadow -# -# open(SHADOW, "/etc/shadow") || die "couldn't open /etc/shadow: $!\n"; -# -# $shadowok = 0; -# $chpw = 0; -# %users = (); -# -# while() { -# if (/^([^:]+):([^:]+):/ && $myshadow{$1}) { -# $users{$1}++; -# if ($2 ne $myshadow{$1}) { -# s/^([^:]+):([^:]+):/$1:$myshadow{$1}:/; -# $chpw++; -# } -# } -# $shadow .= $_; -# } -# -# $shadowok = 1; -# -# for (keys %myshadow) { -# if (!$users{$_}) { -# $shadow .= "$_:$myshadow{$_}:6445::::::\n"; -# $shadowok = 0; -# } -# } -# close(SHADOW); -# -# ## rewrite shadow if necessary. -# -# if ($chpw || !$shadowok) { -# print "Rewriting /etc/shadow...\n" if $verbose; -# -# open(SHADOW, ">/etc/shadow.new") || -# die "couldn't open /etc/shadow.new: $!\n"; -# -# print SHADOW $shadow; -# -# close(SHADOW); -# -# &replace("/etc/shadow"); -# } -# } -# -# if ($archos eq "aix3.2") { -# -# ## read /etc/security/passwd -# -# open(SHADOW, "/etc/security/passwd") || die "couldn't open /etc/security/passwd: $!\n"; -# -# $shadowok = 0; -# %users = (); -# -# while() { -# if (/^([^:]+):\s*$/ && $mypass{$1}) { -# $user = $1; -# $users{$user}++; -# # arrange for the user to have a password entry and none other -# while () { -# last if (!/=/); -# } -# $shadow .= "$user:\n\tpassword = KERBEROS5\n\n"; -# } else { -# $shadow .= $_; -# } -# } -# -# $shadowok = 1; -# -# for (keys %mypass) { -# if (!$users{$_}) { -# $shadow .= "$_:\n\tpassword = KERBEROS5\n\n"; -# $shadowok = 0; -# } -# } -# close(SHADOW); -# -# ## rewrite shadow if necessary. -# -# if (!$shadowok) { -# print "Rewriting /etc/security/passwd...\n" if $verbose; -# -# open(SHADOW, ">/etc/security/passwd.new") || -# die "couldn't open /etc/security/passwd.new: $!\n"; -# -# print SHADOW $shadow; -# -# close(SHADOW); -# -# &replace("/etc/security/passwd"); -# } -# } -# -# open(SERVICES, "/etc/services") || die "couldn't open /etc/services: $!\n"; -# open(NEW_SERVICES, ">/etc/services.new") || -# die "couldn't open /etc/services.new: $!\n"; -# -# print "Rewriting /etc/services...\n" if $verbose; -# -# @needed_services = ('klogin', 'kshell', 'kerberos', 'kerberos-sec', -# 'kerberos5', 'kerberos4', 'kerberos_master', -# 'passwd_server', 'eklogin', 'krb5_prop', -# 'kerberos_adm', 'kerberos-adm'); -# for (@needed_services) { -# $needed_services{$_}++; -# } -# -# while () { -# m/^\s*([^\#\s][^\s]+)/; -# if ($needed_services{$1}) { -# print "+ Commenting out old entry: $1\n" if $verbose; -# print NEW_SERVICES "# $_"; -# } else { -# print NEW_SERVICES $_; -# } -# } -# -# close(SERVICES); -# -# print NEW_SERVICES < $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/qualname.pl.in b/src/kadmin/testing/scripts/qualname.pl.in deleted file mode 100644 index 3d047c550..000000000 --- a/src/kadmin/testing/scripts/qualname.pl.in +++ /dev/null @@ -1,18 +0,0 @@ -#!/afs/athena/contrib/perl/p - -if ($#ARGV == -1) { - chop($hostname = `hostname`); -} else { - $hostname = $ARGV[0]; -} - -if (! (($type,$addr) = (gethostbyname($hostname))[2,4])) { - print STDERR "No such host: $hostname\n"; - exit(1); -} -if (! ($qualname = (gethostbyaddr($addr,$type))[0])) { - print STDERR "No address information for host $hostname\n"; - exit(1); -} -print "$qualname\n"; - diff --git a/src/kadmin/testing/scripts/simple_dump.pl.in b/src/kadmin/testing/scripts/simple_dump.pl.in deleted file mode 100644 index ea94ab2d1..000000000 --- a/src/kadmin/testing/scripts/simple_dump.pl.in +++ /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 = ; - -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() { - 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",@_[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 = ; - -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() { - 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 = ; - $dummy = ; - $dummy = ; - - while() { - 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.pl.in b/src/kadmin/testing/scripts/verify_xrunner_report.pl.in deleted file mode 100644 index 9d83c3ea2..000000000 --- a/src/kadmin/testing/scripts/verify_xrunner_report.pl.in +++ /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() { - 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() { - 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);