summaryrefslogtreecommitdiff
path: root/source3/script
diff options
context:
space:
mode:
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/tests/selftest.sh10
-rwxr-xr-xsource3/script/tests/test_posix_s3.sh4
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh44
3 files changed, 56 insertions, 2 deletions
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index ae856ca31e..43e7bf1731 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -57,7 +57,15 @@ export TORTURE_MAXTIME
WORKGROUP=SAMBA-TEST
SERVER=localhost2
SERVER_IP=127.0.0.2
-USERNAME=`PATH=/usr/ucb:$PATH whoami`
+if [ ! "x$USER" = "x" ]; then
+ USERNAME=$USER
+else
+ if [ ! "x$LOGNAME" = "x" ]; then
+ USERNAME=$LOGNAME
+ else
+ USERNAME=`PATH=/usr/ucb:$PATH whoami || id -un`
+ fi
+fi
USERID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f1 | sed -e 's/uid=\([0-9]*\).*/\1/g'`
GROUPID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f2 | sed -e 's/gid=\([0-9]*\).*/\1/g'`
PASSWORD=test
diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index 48ea2f66cc..cfa6d5ad02 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -48,12 +48,14 @@ rpc="$rpc RPC-NETLOGON-S3 RPC-SCHANNEL RPC-SCHANNEL2 RPC-BENCH-SCHANNEL1 RPC-JOI
local="LOCAL-NSS-WRAPPER"
+winbind="WINBIND-WBCLIENT"
+
# NOTE: to enable the UNIX-WHOAMI test, we need to change the default share
# config to allow guest access. I'm not sure whether this would break other
# tests, so leaving it alone for now -- jpeach
unix="UNIX-INFO2"
-tests="$base $raw $rpc $unix $local"
+tests="$base $raw $rpc $unix $local $winbind"
if test "x$POSIX_SUBTESTS" != "x" ; then
tests="$POSIX_SUBTESTS"
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index f60c7d7c0b..f10bfeac39 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -86,6 +86,46 @@ EOF
fi
}
+# Test creating a bad symlink and deleting it.
+test_bad_symlink()
+{
+ prompt="posix_unlink deleted file /newname"
+ tmpfile=/tmp/smbclient.in.$$
+
+ cat > $tmpfile <<EOF
+posix
+posix_unlink newname
+symlink badname newname
+posix_unlink newname
+quit
+EOF
+
+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+ rm -f $tmpfile
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed create then delete bad symlink"
+ false
+ return
+ fi
+
+ echo "$out" | grep $prompt >/dev/null 2>&1
+
+ if [ $? = 0 ] ; then
+ # got the correct prompt .. succeed
+ true
+ else
+ echo "$out"
+ echo failed create then delete bad symlink
+ false
+ fi
+}
+
+
testit "smbclient -L $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
@@ -105,4 +145,8 @@ testit "interactive smbclient -l prompts on stdout" \
test_interactive_prompt_stdout -l /tmp || \
failed=`expr $failed + 1`
+testit "creating a bad symlink and deleting it" \
+ test_bad_symlink || \
+ failed=`expr $failed + 1`
+
testok $0 $failed