diff options
Diffstat (limited to 'tests/tap/kerberos.sh')
-rw-r--r-- | tests/tap/kerberos.sh | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/tap/kerberos.sh b/tests/tap/kerberos.sh index da07e66..fbeaaba 100644 --- a/tests/tap/kerberos.sh +++ b/tests/tap/kerberos.sh @@ -1,7 +1,7 @@ -# Shell function library to initialize Kerberos credentials +# Shell function library for Kerberos test support. # # Written by Russ Allbery <rra@stanford.edu> -# Copyright 2009 Board of Trustees, Leland Stanford Jr. University +# Copyright 2009, 2010 Board of Trustees, Leland Stanford Jr. University # # See LICENSE for licensing terms. @@ -46,3 +46,18 @@ kerberos_setup () { kerberos_cleanup () { rm -f "$BUILD/data/test.cache" } + +# List the contents of a keytab with enctypes and keys. This adjusts for the +# difference between MIT Kerberos (which uses klist) and Heimdal (which uses +# ktutil). Be careful to try klist first, since the ktutil on MIT Kerberos +# may just hang. Takes the keytab to list and the file into which to save the +# output, and strips off the header containing the file name. +ktutil_list () { + if klist -keK "$1" > ktutil-tmp 2>/dev/null ; then + : + else + ktutil -k "$1" list --keys > ktutil-tmp < /dev/null 2>/dev/null + fi + sed -e '/Keytab name:/d' -e "/^[^ ]*:/d" ktutil-tmp > "$2" + rm -f ktutil-tmp +} |