summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-09 16:20:15 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-09 13:49:59 +0200
commit5a37d3217a257b28d94b04d2637585e71e80d33c (patch)
tree8c59ee8f4c132a49a234ced4f417c573f7e1479d /source3/script
parent74eed8f3ed5c333728350df1d23a4318e9104909 (diff)
downloadsamba-5a37d3217a257b28d94b04d2637585e71e80d33c.tar.gz
samba-5a37d3217a257b28d94b04d2637585e71e80d33c.tar.bz2
samba-5a37d3217a257b28d94b04d2637585e71e80d33c.zip
s3-selftest Add test for smbclient --authentication-file
Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Jun 9 13:49:59 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh58
1 files changed, 50 insertions, 8 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 60c3610ee8..8937c97bbe 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -4,22 +4,23 @@
if [ $# -lt 7 ]; then
cat <<EOF
-Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID LOCAL_PATH PREFIX SMBCLIENT
+Usage: test_smbclient_s3.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD USERID LOCAL_PATH PREFIX SMBCLIENT
EOF
exit 1;
fi
SERVER="$1"
SERVER_IP="$2"
-USERNAME="$3"
-PASSWORD="$4"
-USERID="$5"
-LOCAL_PATH="$6"
-PREFIX="$7"
-SMBCLIENT="$8"
+DOMAIN="$3"
+USERNAME="$4"
+PASSWORD="$5"
+USERID="$6"
+LOCAL_PATH="$7"
+PREFIX="$8"
+SMBCLIENT="$9"
SMBCLIENT="$VALGRIND ${SMBCLIENT}"
WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo}"
-shift 8
+shift 9
ADDARGS="$*"
incdir=`dirname $0`/../../../testprogs/blackbox
@@ -433,6 +434,43 @@ test_ccache_access()
$WBINFO --logoff
}
+# Test authenticating using the winbind ccache
+test_auth_file()
+{
+ tmpfile=$PREFIX/smbclient.in.$$
+ cat > $tmpfile <<EOF
+username=${USERNAME}
+password=${PASSWORD}
+domain=${DOMAIN}
+EOF
+ $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile \
+ -c quit 2>&1
+ ret=$?
+ rm $tmpfile
+
+ if [ $ret != 0 ] ; then
+ echo "smbclient failed to use auth file"
+ false
+ return
+ fi
+
+ cat > $tmpfile <<EOF
+username=${USERNAME}
+password=xxxx
+domain=${DOMAIN}
+EOF
+ $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile\
+ -c quit 2>&1
+ ret=$?
+ rm $tmpfile
+
+ if [ $ret -eq 0 ] ; then
+ echo "smbclient succeeded with wrong auth file credentials"
+ false
+ return
+ fi
+}
+
LOGDIR_PREFIX=test_smbclient_s3
# possibly remove old logdirs:
@@ -492,6 +530,10 @@ testit "sending a message to the remote server" \
test_message || \
failed=`expr $failed + 1`
+testit "using an authentication file" \
+ test_auth_file || \
+ failed=`expr $failed + 1`
+
testit "rm -rf $LOGDIR" \
rm -rf $LOGDIR || \
failed=`expr $failed + 1`