krb5 commit: Eliminate qualname.plin
Greg Hudson
ghudson at mit.edu
Wed Jul 31 16:13:00 EDT 2019
https://github.com/krb5/krb5/commit/2a852b1f3fb00c7d19f4dbfba76f5ff7ebccd2c7
commit 2a852b1f3fb00c7d19f4dbfba76f5ff7ebccd2c7
Author: Greg Hudson <ghudson at mit.edu>
Date: Tue Jul 30 23:59:27 2019 -0400
Eliminate qualname.plin
Rewriting the qualname Perl script to use getaddrinfo created an
unchecked dependency on Perl 5.14. Instead, remove the script and use
the C program in tests/resolve for the kadmin and gssrpc test suites.
src/kadmin/testing/scripts/Makefile.in | 2 +-
src/kadmin/testing/scripts/env-setup.shin | 4 +++-
src/kadmin/testing/scripts/init_db | 6 ++----
src/kadmin/testing/scripts/qualname.plin | 20 --------------------
src/kadmin/testing/scripts/start_servers | 3 +--
src/kadmin/testing/scripts/start_servers_local | 2 --
src/lib/rpc/unit-test/lib/helpers.exp | 2 +-
src/lib/rpc/unit-test/rpc_test_setup.sh | 5 +----
8 files changed, 9 insertions(+), 35 deletions(-)
diff --git a/src/kadmin/testing/scripts/Makefile.in b/src/kadmin/testing/scripts/Makefile.in
index 8c0d236..4b3c75c 100644
--- a/src/kadmin/testing/scripts/Makefile.in
+++ b/src/kadmin/testing/scripts/Makefile.in
@@ -5,7 +5,7 @@ PERL_PATH=@PERL_PATH@
.SUFFIXES: .plin .pl
GEN_SCRIPTS = compare_dump.pl make-host-keytab.pl \
- simple_dump.pl verify_xrunner_report.pl qualname.pl
+ simple_dump.pl verify_xrunner_report.pl
all: env-setup.sh $(GEN_SCRIPTS)
diff --git a/src/kadmin/testing/scripts/env-setup.shin b/src/kadmin/testing/scripts/env-setup.shin
index 7262983..8c29bb9 100755
--- a/src/kadmin/testing/scripts/env-setup.shin
+++ b/src/kadmin/testing/scripts/env-setup.shin
@@ -69,12 +69,14 @@ MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl; export MAKE_KEYTAB
LOCAL_MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl
export LOCAL_MAKE_KEYTAB
SIMPLE_DUMP=$TESTDIR/scripts/simple_dump.pl; export SIMPLE_DUMP
-QUALNAME=$TESTDIR/scripts/qualname.pl; export QUALNAME
TCLUTIL=$STESTDIR/tcl/util.t; export TCLUTIL
BSDDB_DUMP=$TESTDIR/util/bsddb_dump; export BSDDB_DUMP
CLNTTCL=$TESTDIR/util/kadm5_clnt_tcl; export CLNTTCL
SRVTCL=$TESTDIR/util/kadm5_srv_tcl; export SRVTCL
+QUALNAME=`$BUILDTOP/tests/resolve/resolve -q | tr '[A-Z]' '[a-z]'`
+export QUALNAME
+
KRB5_CONFIG=$K5ROOT/krb5.conf; export KRB5_CONFIG
KRB5_KDC_PROFILE=$K5ROOT/kdc.conf; export KRB5_KDC_PROFILE
KRB5_KTNAME=$K5ROOT/ovsec_adm.keytab; export KRB5_KTNAME
diff --git a/src/kadmin/testing/scripts/init_db b/src/kadmin/testing/scripts/init_db
index bf119f2..2496be2 100755
--- a/src/kadmin/testing/scripts/init_db
+++ b/src/kadmin/testing/scripts/init_db
@@ -77,11 +77,9 @@ fi
# esac
# done
-qualname=`$QUALNAME`
-
sed -e "s/__REALM__/$REALM/g" -e "s#__K5ROOT__#$K5ROOT#g" \
- -e "s/__KDCHOST__/$qualname/g" \
- -e "s/__LOCALHOST__/$qualname/g" \
+ -e "s/__KDCHOST__/$QUALNAME/g" \
+ -e "s/__LOCALHOST__/$QUALNAME/g" \
-e "s#__MODDIR__#$MODDIR#g" \
< $STESTDIR/proto/krb5.conf.proto > $K5ROOT/krb5.conf
sed -e "s/__REALM__/$REALM/g" -e "s#__K5ROOT__#$K5ROOT#g" \
diff --git a/src/kadmin/testing/scripts/qualname.plin b/src/kadmin/testing/scripts/qualname.plin
deleted file mode 100755
index ccc57e3..0000000
--- a/src/kadmin/testing/scripts/qualname.plin
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/perl
-use Socket qw(:addrinfo);
-use strict;
-
-my $hostname;
-if ($#ARGV == -1) {
- chop($hostname = `hostname`);
-} else {
- $hostname = $ARGV[0];
-}
-
-my ($gaerr, @addrs) = getaddrinfo($hostname, "", {flags => AI_CANONNAME});
-die "No such host: $hostname ($gaerr)" if $gaerr;
-my ($canonname, $addr) = ($addrs[0]->{canonname}, $addrs[0]->{addr});
-
-my ($gnerr, $name, $servicename) = getnameinfo($addr, NI_NAMEREQD);
-my $qualname = $gnerr ? $name : $name;
-
-$qualname =~ tr/A-Z/a-z/; # lowercase our name for keytab use.
-print "$qualname\n";
diff --git a/src/kadmin/testing/scripts/start_servers b/src/kadmin/testing/scripts/start_servers
index 87bd52f..f23df06 100755
--- a/src/kadmin/testing/scripts/start_servers
+++ b/src/kadmin/testing/scripts/start_servers
@@ -35,10 +35,9 @@ fi
if [ $local = 0 ]; then
# Fix up the local krb5.conf to point to the remote
- localname=`$QUALNAME`
sed -e "s/__REALM__/$REALM/g" -e "s#__K5ROOT__#$K5ROOT#g" \
-e "s/__KDCHOST__/$hostname/g" \
- -e "s/__LOCALHOST__/$localname/g" \
+ -e "s/__LOCALHOST__/$QUALNAME/g" \
-e "s#__MODDIR__#$TOP/../plugins/kdb#g"\
-e "s#__PLUGIN_DIR__#$TOP/../plugins#g"\
< $STESTDIR/proto/krb5.conf.proto > $K5ROOT/krb5.conf
diff --git a/src/kadmin/testing/scripts/start_servers_local b/src/kadmin/testing/scripts/start_servers_local
index 8098929..e502a6a 100755
--- a/src/kadmin/testing/scripts/start_servers_local
+++ b/src/kadmin/testing/scripts/start_servers_local
@@ -73,8 +73,6 @@ fi
# allow admin to krlogin as root (for cleanup)
DUMMY=${REALM=SECURE-TEST.OV.COM}; export REALM
-hostname=`hostname`
-QUALNAME=`$TOP/testing/scripts/qualname.pl $hostname`; export QUALNAME
cat - > /tmp/start_servers_local$$ <<\EOF
if { [catch {
diff --git a/src/lib/rpc/unit-test/lib/helpers.exp b/src/lib/rpc/unit-test/lib/helpers.exp
index 6ba2b10..f08c732 100644
--- a/src/lib/rpc/unit-test/lib/helpers.exp
+++ b/src/lib/rpc/unit-test/lib/helpers.exp
@@ -119,7 +119,7 @@ proc setup_database {} {
}
if ![info exists CANON_HOST] {
- set CANON_HOST [exec $env(QUALNAME)]
+ set CANON_HOST $env(QUALNAME)
setup_database
file delete $env(RPC_TEST_KEYTAB)
exec $env(MAKE_KEYTAB) -princ "server/$CANON_HOST" $env(RPC_TEST_KEYTAB)
diff --git a/src/lib/rpc/unit-test/rpc_test_setup.sh b/src/lib/rpc/unit-test/rpc_test_setup.sh
index b610f87..d7df0eb 100755
--- a/src/lib/rpc/unit-test/rpc_test_setup.sh
+++ b/src/lib/rpc/unit-test/rpc_test_setup.sh
@@ -20,12 +20,9 @@ fi
PATH=$TOP/install/admin:$PATH; export PATH
-CANON_HOST=`$QUALNAME`
-export CANON_HOST
-
cat - > /tmp/rpc_test_setup$$ <<\EOF
source $env(TCLUTIL)
-set h $env(CANON_HOST)
+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]
More information about the cvs-krb5
mailing list