summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2016-09-13 08:24:06 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-04-29 23:31:08 +0200
commit31491f8bb407ebe5dd976b6d1cad3d7d31080bd4 (patch)
treeb26ab0902ff7d23589e33ee59e822e27740fc1f6 /testprogs
parentf0e8d98b79bf50a21bbdd2cf3ec5f993495ee9b0 (diff)
downloadsamba-31491f8bb407ebe5dd976b6d1cad3d7d31080bd4.tar.gz
testprogs: Add common kinit function
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/blackbox/common_test_fns.inc16
1 files changed, 16 insertions, 0 deletions
diff --git a/testprogs/blackbox/common_test_fns.inc b/testprogs/blackbox/common_test_fns.inc
index f77879ae39f..77c635bc5d7 100755
--- a/testprogs/blackbox/common_test_fns.inc
+++ b/testprogs/blackbox/common_test_fns.inc
@@ -88,3 +88,19 @@ test_rpcclient_expect_failure_grep() {
fi
return $status
}
+
+kerberos_kinit() {
+ kinit_tool="${1}"
+ principal="${2}"
+ password="${3}"
+ shift 3
+ kbase=$(basename ${kinit_tool})
+ if [ "${kbase}" = "samba4kinit" ]; then
+ kpassfile=$(mktemp)
+ echo $password > ${kpassfile}
+ $kinit_tool --password-file=${kpassfile} $principal $@
+ rm -f ${kpassfile}
+ else
+ echo $password | $kinit_tool $principal $@
+ fi
+}