Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/source3/script
Files:
44 added
32 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/script/tests/test_failure.sh

    r740 r988  
    55# Copyright (C) 2011 Michael Adam <obnox@samba.org>
    66
    7 # include the blackbox subunit infrastructure
    8 # if not run from classical s3 test script:
    9 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    10         incdir=`dirname $0`/../../../testprogs/blackbox
    11         . $incdir/subunit.sh
    12 }
     7incdir=`dirname $0`/../../../testprogs/blackbox
     8. $incdir/subunit.sh
    139
    1410failed=0
  • vendor/current/source3/script/tests/test_local_s3.sh

    r740 r988  
    1010fi
    1111
    12 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    1312incdir=`dirname $0`/../../../testprogs/blackbox
    1413. $incdir/subunit.sh
    15 }
    1614
    1715failed=0
  • vendor/current/source3/script/tests/test_net_misc.sh

    r740 r988  
    55if [ $# -lt 3 ]; then
    66cat <<EOF
    7 Usage: test_net_misc.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION
     7Usage: test_net_misc.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION
    88EOF
    99exit 1;
     
    1212SCRIPTDIR="$1"
    1313SERVERCONFFILE="$2"
    14 CONFIGURATION="$3"
     14NET="$3"
     15CONFIGURATION="$4"
    1516
    1617NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
     
    1920NETLOOKUP="${NET} lookup"
    2021
    21 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    2222incdir=`dirname $0`/../../../testprogs/blackbox
    2323. $incdir/subunit.sh
    24 }
    2524
    2625failed=0
  • vendor/current/source3/script/tests/test_net_registry.sh

    r740 r988  
    1010if [ $# -lt 3 ]; then
    1111cat <<EOF
    12 Usage: test_net_registry.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION RPC
     12Usage: test_net_registry.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION RPC
    1313EOF
    1414exit 1;
     
    1717SCRIPTDIR="$1"
    1818SERVERCONFFILE="$2"
    19 CONFIGURATION="$3"
    20 RPC="$4"
     19NET="$3"
     20CONFIGURATION="$4"
     21RPC="$5"
    2122
    2223NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
     
    2829fi
    2930
    30 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    3131incdir=`dirname $0`/../../../testprogs/blackbox
    3232. $incdir/subunit.sh
    33 }
    3433
    3534failed=0
  • vendor/current/source3/script/tests/test_net_registry_roundtrip.sh

    r740 r988  
    88if [ $# -lt 3 ]; then
    99cat <<EOF
    10 Usage: test_net_registry_roundtrip.sh SCRIPTDIR SERVERCONFFILE CONFIGURATION
     10Usage: test_net_registry_roundtrip.sh SCRIPTDIR SERVERCONFFILE NET CONFIGURATION RPC
    1111EOF
    1212exit 1;
     
    1515SCRIPTDIR="$1"
    1616SERVERCONFFILE="$2"
    17 CONFIGURATION="$3"
     17NET="$3"
     18CONFIGURATION="$4"
     19RPC="$5"
    1820
    19 NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
     21NET="$VALGRIND ${NET} $CONFIGURATION"
     22
     23if test "x${RPC}" = "xrpc" ; then
     24        NETCMD="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc"
     25else
     26        NETCMD="${NET}"
     27fi
    2028
    2129
    22 if test "x${RPC}" = "xrpc" ; then
    23         NETREG="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc registry"
    24 else
    25         NETREG="${NET} registry"
    26 fi
    27 
    28 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    2930incdir=`dirname $0`/../../../testprogs/blackbox
    3031. $incdir/subunit.sh
    31 }
    3232
    3333failed=0
    3434
     35#
     36# List of parameters to skip when importing configuration files:
     37# They are forbidden in the registry and would lead import to fail.
     38#
    3539SED_INVALID_PARAMS="{
     40s/state directory/;&/g
    3641s/lock directory/;&/g
    3742s/lock dir/;&/g
    38 s/modules dir/;&/g
    39 s/logging/;&/g
    40 s/status/;&/g
    41 s/logdir/;&/g
    42 s/read prediction/;&/g
    43 s/mkprofile/;&/g
    44 s/valid chars/;&/g
    45 s/timesync/;&/g
    46 s/sambaconf/;&/g
    47 s/logtype/;&/g
    48 s/servername/;&/g
    49 s/postscript/;&/g
     43s/config backend/;&/g
     44s/include/;&/g
    5045}"
    5146
     
    6762
    6863conf_roundtrip()
    69 {
    70     local DIR=$(mktemp -d ${PREFIX}/${LOGDIR_PREFIX}_XXXXXX)
    71     local LOG=$DIR/log
     64(
     65    DIR=$(mktemp -d ${PREFIX}/${LOGDIR_PREFIX}_XXXXXX)
     66    LOG=$DIR/log
    7267
    7368    echo conf_roundtrip $1 > $LOG
     
    7570    sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in
    7671
    77     conf_roundtrip_step $NET conf drop
     72    conf_roundtrip_step $NETCMD conf drop
    7873    test "x$?" = "x0" || {
    7974        return 1
    8075    }
    8176
    82     test -z "$($NET conf list)" 2>>$LOG
     77    test -z "$($NETCMD conf list)" 2>>$LOG
    8378    if [ "$?" = "1" ]; then
    8479        echo "ERROR: conf drop failed" | tee -a $LOG
     
    8681    fi
    8782
    88     conf_roundtrip_step $NET conf import $DIR/conf_in
     83    conf_roundtrip_step $NETCMD conf import $DIR/conf_in
    8984    test "x$?" = "x0" || {
    9085        return 1
    9186    }
    9287
    93     conf_roundtrip_step $NET conf list > $DIR/conf_exp
     88    conf_roundtrip_step $NETCMD conf list > $DIR/conf_exp
    9489    test "x$?" = "x0" || {
    9590        return 1
     
    10297    fi
    10398
    104     conf_roundtrip_step $NET -d10 registry export $REGPATH $DIR/conf_exp.reg
     99    conf_roundtrip_step $NETCMD -d10 registry export $REGPATH $DIR/conf_exp.reg
    105100    test "x$?" = "x0" || {
    106101        return 1
    107102    }
    108103
    109     conf_roundtrip_step $NET conf drop
     104    conf_roundtrip_step $NETCMD conf drop
    110105    test "x$?" = "x0" || {
    111106        return 1
    112107    }
    113108
    114     test -z "$($NET conf list)" 2>>$LOG
     109    test -z "$($NETCMD conf list)" 2>>$LOG
    115110    if [ "$?" = "1" ]; then
    116111        echo "ERROR: conf drop failed" | tee -a $LOG
     
    118113    fi
    119114
    120     conf_roundtrip_step $NET registry import $DIR/conf_exp.reg
     115    conf_roundtrip_step $NETCMD registry import $DIR/conf_exp.reg
    121116    test "x$?" = "x0" || {
    122117        return 1
    123118    }
    124119
    125     conf_roundtrip_step $NET conf list >$DIR/conf_out
     120    conf_roundtrip_step $NETCMD conf list >$DIR/conf_out
    126121    test "x$?" = "x0"  || {
    127122        return 1
     
    134129    fi
    135130
    136     conf_roundtrip_step $NET registry export $REGPATH $DIR/conf_out.reg
     131    conf_roundtrip_step $NETCMD registry export $REGPATH $DIR/conf_out.reg
    137132    test "x$?" = "x0" || {
    138133        return 1
     
    145140    fi
    146141    rm -r $DIR
    147 }
     142)
    148143
    149 CONF_FILES=${CONF_FILES:-$(find $SRCDIR/ -name '*.conf' | grep -v examples/logon | xargs grep -l "\[global\]")}
     144CONF_FILES=$SERVERCONFFILE
    150145
    151146# remove old logs:
  • vendor/current/source3/script/tests/test_ntlm_auth_s3.sh

    r740 r988  
    33if [ $# -lt 2 ]; then
    44cat <<EOF
    5 Usage: test_ntlm_auth_s3.sh PYTHON SRC3DIR
     5Usage: test_ntlm_auth_s3.sh PYTHON SRC3DIR NTLM_AUTH
    66EOF
    77exit 1;
     
    1010PYTHON=$1
    1111SRC3DIR=$2
    12 shift 2
     12NTLM_AUTH=$3
     13DOMAIN=$4
     14USERNAME=$5
     15PASSWORD=$6
     16shift 6
    1317ADDARGS="$*"
    1418
    15 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    1619incdir=`dirname $0`/../../../testprogs/blackbox
    1720. $incdir/subunit.sh
    18 }
     21
     22SID=`eval $BINDIR/wbinfo -n $USERNAME | cut -d ' ' -f1`
     23BADSID=`eval $BINDIR/wbinfo -n $USERNAME | cut -d ' ' -f1 | sed 's/..$//'`
    1924
    2025failed=0
    2126
    22 testit "ntlm_auth" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth $ADDARGS || failed=`expr $failed + 1`
     27test_plaintext_check_output_stdout()
     28{
     29        tmpfile=$PREFIX/ntlm_commands
     30
     31        cat > $tmpfile <<EOF
     32$DOMAIN/$USERNAME $PASSWORD
     33EOF
     34        cmd='$NTLM_AUTH "$@" --require-membership-of=$SID --helper-protocol=squid-2.5-basic < $tmpfile 2>&1'
     35        eval echo "$cmd"
     36        out=`eval $cmd`
     37        ret=$?
     38        rm -f $tmpfile
     39
     40        if [ $ret != 0 ] ; then
     41                echo "$out"
     42                echo "command failed"
     43                false
     44                return
     45        fi
     46
     47        echo "$out" | grep "OK" >/dev/null 2>&1
     48
     49        if [ $? = 0 ] ; then
     50                # authenticated .. succeed
     51                true
     52        else
     53                echo failed to get successful authentication
     54                false
     55        fi
     56}
     57
     58test_plaintext_check_output_fail()
     59{
     60        tmpfile=$PREFIX/ntlm_commands
     61
     62        cat > $tmpfile <<EOF
     63$DOMAIN\\$USERNAME $PASSWORD
     64EOF
     65        cmd='$NTLM_AUTH "$@" --require-membership-of=$BADSID --helper-protocol=squid-2.5-basic < $tmpfile 2>&1'
     66        eval echo "$cmd"
     67        out=`eval $cmd`
     68        ret=$?
     69        rm -f $tmpfile
     70
     71        if [ $ret != 0 ] ; then
     72                echo "$out"
     73                echo "command failed"
     74                false
     75                return
     76        fi
     77
     78        echo "$out" | grep "ERR" >/dev/null 2>&1
     79
     80        if [ $? = 0 ] ; then
     81                # failed to authenticate .. success
     82                true
     83        else
     84                echo "incorrectly gave a successful authentication"
     85                false
     86        fi
     87}
     88
     89test_ntlm_server_1_check_output()
     90{
     91        tmpfile=$PREFIX/ntlm_commands
     92
     93        cat > $tmpfile <<EOF
     94LANMAN-Challenge: 0123456789abcdef
     95NT-Response: 25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6
     96NT-Domain: TEST
     97Username: testuser
     98Request-User-Session-Key: Yes
     99.
     100EOF
     101        cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1  --password=SecREt01< $tmpfile 2>&1'
     102        eval echo "$cmd"
     103        out=`eval $cmd`
     104        ret=$?
     105        rm -f $tmpfile
     106
     107        if [ $ret != 0 ] ; then
     108                echo "$out"
     109                echo "command failed"
     110                false
     111                return
     112        fi
     113
     114        echo "$out" | grep "User-Session-Key: 3F373EA8E4AF954F14FAA506F8EEBDC4" >/dev/null 2>&1
     115
     116        if [ $? = 0 ] ; then
     117                # authenticated .. succeed
     118                true
     119        else
     120                echo failed to get successful authentication
     121                false
     122        fi
     123}
     124
     125test_ntlm_server_1_check_output_fail()
     126{
     127        tmpfile=$PREFIX/ntlm_commands
     128
     129        # Break the password with a leading A on the challenge
     130        cat > $tmpfile <<EOF
     131LANMAN-Challenge: A123456789abcdef
     132NT-Response: 25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6
     133NT-Domain: TEST
     134Username: testuser
     135Request-User-Session-Key: Yes
     136.
     137EOF
     138        cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 --password=SecREt01 < $tmpfile 2>&1'
     139        eval echo "$cmd"
     140        out=`eval $cmd`
     141        ret=$?
     142        rm -f $tmpfile
     143
     144        if [ $ret != 0 ] ; then
     145                echo "$out"
     146                echo "command failed"
     147                false
     148                return
     149        fi
     150
     151        echo "$out" | grep "Authenticated: No" >/dev/null 2>&1
     152
     153        if [ $? = 0 ] ; then
     154                # failed to authenticate .. success
     155                true
     156        else
     157                echo "incorrectly gave a successful authentication"
     158                false
     159        fi
     160}
     161
     162test_ntlm_server_1_check_winbind_output()
     163{
     164        tmpfile=$PREFIX/ntlm_commands
     165
     166        # This isn't the correct password
     167        cat > $tmpfile <<EOF
     168Password: $PASSWORD
     169NT-Domain: $DOMAIN
     170Username: $USERNAME
     171Request-User-Session-Key: Yes
     172.
     173EOF
     174        cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 --require-membership-of=$SID < $tmpfile 2>&1'
     175        eval echo "$cmd"
     176        out=`eval $cmd`
     177        ret=$?
     178        rm -f $tmpfile
     179
     180        if [ $ret != 0 ] ; then
     181                echo "$out"
     182                echo "command failed"
     183                false
     184                return
     185        fi
     186
     187        echo "$out" | grep "Authenticated: Yes" >/dev/null 2>&1
     188
     189        if [ $? = 0 ] ; then
     190                # authenticated .. success
     191                true
     192        else
     193                echo "Failed to authenticate the user or match with SID $SID"
     194                false
     195        fi
     196}
     197
     198test_ntlm_server_1_check_winbind_output_wrong_sid()
     199{
     200        tmpfile=$PREFIX/ntlm_commands
     201
     202        # This isn't the correct password
     203        cat > $tmpfile <<EOF
     204Password: $PASSWORD
     205NT-Domain: $DOMAIN
     206Username: $USERNAME
     207Request-User-Session-Key: Yes
     208.
     209EOF
     210        cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 --require-membership-of=$BADSID < $tmpfile 2>&1'
     211        eval echo "$cmd"
     212        out=`eval $cmd`
     213        ret=$?
     214        rm -f $tmpfile
     215
     216        if [ $ret != 0 ] ; then
     217                echo "$out"
     218                echo "command failed"
     219                false
     220                return
     221        fi
     222
     223        echo "$out" | grep "Authenticated: No" >/dev/null 2>&1
     224
     225        if [ $? = 0 ] ; then
     226                # failed to authenticate .. success
     227                true
     228        else
     229                echo "incorrectly gave a successful authentication"
     230                false
     231        fi
     232}
     233
     234test_ntlm_server_1_check_winbind_output_fail()
     235{
     236        tmpfile=$PREFIX/ntlm_commands
     237
     238        # This isn't the correct password
     239        cat > $tmpfile <<EOF
     240LANMAN-Challenge: 0123456789abcdef
     241NT-Response: 25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6
     242NT-Domain: $DOMAIN
     243Username: $USERNAME
     244Request-User-Session-Key: Yes
     245.
     246EOF
     247        cmd='$NTLM_AUTH "$@" --helper-protocol=ntlm-server-1 < $tmpfile 2>&1'
     248        eval echo "$cmd"
     249        out=`eval $cmd`
     250        ret=$?
     251        rm -f $tmpfile
     252
     253        if [ $ret != 0 ] ; then
     254                echo "$out"
     255                echo "command failed"
     256                false
     257                return
     258        fi
     259
     260        echo "$out" | grep "Authenticated: No" >/dev/null 2>&1
     261
     262        if [ $? = 0 ] ; then
     263                # failed to authenticate .. success
     264                true
     265        else
     266                echo "incorrectly gave a successful authentication"
     267                false
     268        fi
     269}
     270
     271testit "ntlm_auth" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS || failed=`expr $failed + 1`
    23272# This should work even with NTLMv2
    24 testit "ntlm_auth" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth $ADDARGS --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1`
    25 
     273testit "ntlm_auth with specified domain" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1`
     274testit "ntlm_auth against winbindd" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS || failed=`expr $failed + 1`
     275testit "ntlm_auth with NTLMSSP client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=ntlmssp-client-1 --server-helper=gss-spnego || failed=`expr $failed + 1`
     276testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=gss-spnego-client --server-helper=gss-spnego || failed=`expr $failed + 1`
     277testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS || failed=`expr $failed + 1`
     278
     279testit "wbinfo store cached credentials" $BINDIR/wbinfo --ccache-save=$DOMAIN/$USERNAME%$PASSWORD || failed=`expr $failed + 1`
     280testit "ntlm_auth ccached credentials with NTLMSSP client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-username=$USERNAME --client-domain=$DOMAIN --client-use-cached-creds --client-helper=ntlmssp-client-1 --server-helper=gss-spnego --server-use-winbindd || failed=`expr $failed + 1`
     281
     282testit "ntlm_auth against winbindd with require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS --require-membership-of=$SID || failed=`expr $failed + 1`
     283testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind with require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS --require-membership-of=$SID || failed=`expr $failed + 1`
     284
     285testit_expect_failure "ntlm_auth against winbindd with failed require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS --require-membership-of=$BADSID && failed=`expr $failed + 1`
     286testit_expect_failure "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind with failed require-membership-of" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS --require-membership-of=$BADSID && failed=`expr $failed + 1`
     287
     288testit "ntlm_auth plaintext authentication with require-membership-of" test_plaintext_check_output_stdout || failed=`expr $failed + 1`
     289testit "ntlm_auth plaintext authentication with failed require-membership-of" test_plaintext_check_output_fail || failed=`expr $failed + 1`
     290
     291testit "ntlm_auth ntlm-server-1 with fixed password" test_ntlm_server_1_check_output || failed=`expr $failed + 1`
     292testit "ntlm_auth ntlm-server-1 with incorrect fixed password" test_ntlm_server_1_check_output_fail || failed=`expr $failed + 1`
     293testit "ntlm_auth ntlm-server-1 with plaintext password against winbind" test_ntlm_server_1_check_winbind_output || failed=`expr $failed + 1`
     294testit "ntlm_auth ntlm-server-1 with plaintext password against winbind but wrong sid" test_ntlm_server_1_check_winbind_output_wrong_sid || failed=`expr $failed + 1`
     295testit "ntlm_auth ntlm-server-1 with incorrect fixed password against winbind" test_ntlm_server_1_check_winbind_output_fail || failed=`expr $failed + 1`
    26296
    27297testok $0 $failed
  • vendor/current/source3/script/tests/test_pthreadpool.sh

    r740 r988  
    44. $incdir/subunit.sh
    55
    6 TESTPROG=$BINDIR/pthreadpooltest
    7 
    86if [ ! -x $BINDIR/pthreadpooltest ] ; then
    9     TESTPROG=/bin/true
     7    # Some machines don't have /bin/true, simulate it
     8    cat >$BINDIR/pthreadpooltest <<EOF
     9#!/bin/sh
     10exit 0
     11EOF
     12    chmod +x $BINDIR/pthreadpooltest
    1013fi
    1114
    1215failed=0
    1316
    14 testit "pthreadpool" $VALGRIND $TESTPROG ||
     17testit "pthreadpool" $VALGRIND $BINDIR/pthreadpooltest ||
    1518        failed=`expr $failed + 1`
    1619
  • vendor/current/source3/script/tests/test_smbclient_auth.sh

    r740 r988  
    33# this runs the file serving tests that are expected to pass with samba3 against shares with various options
    44
    5 if [ $# -lt 4 ]; then
     5if [ $# -lt 5 ]; then
    66cat <<EOF
    7 Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD <smbclient arguments>
     7Usage: test_smbclient_auth.sh SERVER SERVER_IP USERNAME PASSWORD SMBCLIENT <smbclient arguments>
    88EOF
    99exit 1;
     
    1414USERNAME="$3"
    1515PASSWORD="$4"
    16 SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient}"
    17 shift 4
     16SMBCLIENT="$5"
     17SMBCLIENT="$VALGRIND ${SMBCLIENT}"
     18shift 5
    1819ADDARGS="$*"
    1920
    20 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    2121incdir=`dirname $0`/../../../testprogs/blackbox
    2222. $incdir/subunit.sh
     23
     24echo "${SERVER_IP}" | grep -q ':.*:' && {
     25        # If we have an ipv6 address e.g.
     26        # fd00:0000:0000:0000:0000:0000:5357:5f03
     27        # we also try
     28        # fd00-0000-0000-0000-0000-0000-5357-5f03.ipv6-literal.net
     29        IPV6LITERAL=$(echo "${SERVER_IP}.ipv6-literal.net" | sed -e 's!:!-!g' -e 's!%!s!')
     30        testit "smbclient //${IPV6LITERAL}/tmpguest" $SMBCLIENT //${IPV6LITERAL}/tmpguest $CONFIGURATION -U$USERNAME%$PASSWORD -c quit $ADDARGS
     31        testit "smbclient //${IPV6LITERAL}./tmpguest" $SMBCLIENT //${IPV6LITERAL}./tmpguest $CONFIGURATION -U$USERNAME%$PASSWORD -c quit $ADDARGS
    2332}
     33testit "smbclient //${SERVER_IP}/tmpguest" $SMBCLIENT //${SERVER_IP}/tmpguest $CONFIGURATION -U$USERNAME%$PASSWORD -p 139 -c quit $ADDARGS
    2434
    2535testit "smbclient //$SERVER/guestonly" $SMBCLIENT //$SERVER/guestonly $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS
     
    2939testit "smbclient //$SERVER/forceuser" $SMBCLIENT //$SERVER/forceuser $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS
    3040testit "smbclient //$SERVER/forceuser as anon" $SMBCLIENT //$SERVER/forceuser $CONFIGURATION -U% -I $SERVER_IP -p 139 -c quit $ADDARGS
     41testit "smbclient //$SERVER/forceuser_unixonly" $SMBCLIENT //$SERVER/forceuser_unixonly $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS
     42testit "smbclient //$SERVER/forceuser_wkngroup" $SMBCLIENT //$SERVER/forceuser_wkngroup $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS
    3143testit "smbclient //$SERVER/forcegroup" $SMBCLIENT //$SERVER/forcegroup $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 -c quit $ADDARGS
    3244testit "smbclient //$SERVER/forcegroup as anon" $SMBCLIENT //$SERVER/forcegroup $CONFIGURATION -U% -I $SERVER_IP -p 139 -c quit $ADDARGS
  • vendor/current/source3/script/tests/test_smbclient_s3.sh

    r740 r988  
    33# this runs the file serving tests that are expected to pass with samba3
    44
    5 if [ $# -lt 7 ]; then
     5if [ $# -lt 11 ]; then
    66cat <<EOF
    7 Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD USERID LOCAL_PATH PREFIX
     7Usage: test_smbclient_s3.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD USERID LOCAL_PATH PREFIX SMBCLIENT WBINFO NET
    88EOF
    99exit 1;
    1010fi
    1111
    12 SERVER="$1"
    13 SERVER_IP="$2"
    14 USERNAME="$3"
    15 PASSWORD="$4"
    16 USERID="$5"
    17 LOCAL_PATH="$6"
    18 PREFIX="$7"
    19 SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient}"
    20 WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo}"
    21 shift 7
     12SERVER="${1}"
     13SERVER_IP="${2}"
     14DOMAIN="${3}"
     15USERNAME="${4}"
     16PASSWORD="${5}"
     17USERID="${6}"
     18LOCAL_PATH="${7}"
     19PREFIX="${8}"
     20SMBCLIENT="${9}"
     21WBINFO="${10}"
     22NET="${11}"
     23SMBCLIENT="$VALGRIND ${SMBCLIENT}"
     24WBINFO="$VALGRIND ${WBINFO}"
     25shift 11
    2226ADDARGS="$*"
    2327
    24 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    2528incdir=`dirname $0`/../../../testprogs/blackbox
    2629. $incdir/subunit.sh
    27 }
    2830
    2931failed=0
     
    134136test_good_symlink()
    135137{
    136     tmpfile=/tmp/smbclient.in.$$
     138    tmpfile=$PREFIX/smbclient.in.$$
    137139    slink_name="$LOCAL_PATH/slink"
    138140    slink_target="$LOCAL_PATH/slink_target"
     
    184186{
    185187    prompt="NT_STATUS_ACCESS_DENIED making remote directory"
    186     tmpfile=/tmp/smbclient.in.$$
     188    tmpfile=$PREFIX/smbclient.in.$$
    187189
    188190##
     
    211213EOF
    212214
    213     cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U% //$SERVER/ro-tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     215    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -U% "//$SERVER/$1" -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
    214216    eval echo "$cmd"
    215217    out=`eval $cmd`
     
    220222        echo "$out"
    221223        echo "failed writing into read-only directory with error $ret"
     224
    222225        false
    223226        return
     
    237240}
    238241
     242
     243# Test sending a message
     244test_message()
     245{
     246    tmpfile=$PREFIX/message_in.$$
     247
     248    cat > $tmpfile <<EOF
     249Test message from pid $$
     250EOF
     251
     252    cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD -M $SERVER -p 139 $ADDARGS -n msgtest < $tmpfile 2>&1'
     253    eval echo "$cmd"
     254    out=`eval $cmd`
     255    ret=$?
     256
     257    if [ $ret != 0 ] ; then
     258        echo "$out"
     259        echo "failed sending message to $SERVER with error $ret"
     260        false
     261        rm -f $tmpfile
     262        return
     263    fi
     264
     265    # The server writes this into a file message.msgtest, via message.%m to test the % sub code
     266    cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmpguest -p 139 $ADDARGS -c "get message.msgtest $PREFIX/message_out.$$" 2>&1'
     267    eval echo "$cmd"
     268    out=`eval $cmd`
     269    ret=$?
     270
     271    if [ $ret != 0 ] ; then
     272        echo "$out"
     273        echo "failed getting sent message from $SERVER with error $ret"
     274        false
     275        return
     276    fi
     277
     278    if [ cmp $PREFIX/message_out.$$ $tmpfile != 0 ] ; then
     279        echo "failed comparison of message from $SERVER"
     280        false
     281        return
     282    fi
     283    true
     284}
     285
    239286# Test reading an owner-only file (logon as guest) fails.
    240287test_owner_only_file()
    241288{
    242289    prompt="NT_STATUS_ACCESS_DENIED opening remote file"
    243     tmpfile=/tmp/smbclient.in.$$
     290    tmpfile=$PREFIX/smbclient.in.$$
    244291
    245292##
     
    297344test_msdfs_link()
    298345{
    299     tmpfile=/tmp/smbclient.in.$$
     346    tmpfile=$PREFIX/smbclient.in.$$
    300347    prompt="  msdfs-target  "
    301348
     
    363410}
    364411
     412# Archive bits are correctly set on file/dir creation and rename.
     413test_rename_archive_bit()
     414{
     415    prompt_file="attributes: A (20)"
     416    prompt_dir="attributes: D (10)"
     417    tmpfile="$PREFIX/smbclient.in.$$"
     418    filename="foo.$$"
     419    filename_ren="bar.$$"
     420    dirname="foodir.$$"
     421    dirname_ren="bardir.$$"
     422    filename_path="$PREFIX/$filename"
     423    local_name1="$LOCAL_PATH/$filename"
     424    local_name2="$LOCAL_PATH/$filename_ren"
     425    local_dir_name1="$LOCAL_PATH/$dirname"
     426    local_dir_name2="$LOCAL_PATH/$dirname_ren"
     427
     428    rm -f $filename_path
     429    rm -f $local_name1
     430    rm -f $local_name2
     431
     432# Create a new file, ensure it has 'A' attributes.
     433    touch $filename_path
     434
     435    cat > $tmpfile <<EOF
     436lcd $PREFIX
     437put $filename
     438allinfo $filename
     439quit
     440EOF
     441
     442    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     443    eval echo "$cmd"
     444    out=`eval $cmd`
     445    ret=$?
     446    rm -f $tmpfile
     447
     448    if [ $ret != 0 ] ; then
     449        echo "$out"
     450        echo "failed creating file $filename with error $ret"
     451        false
     452        return
     453    fi
     454
     455    echo "$out" | grep "$prompt_file" >/dev/null 2>&1
     456
     457    ret=$?
     458
     459    rm -f $filename_path
     460    rm -f $local_name1
     461    rm -f $local_name2
     462
     463    if [ $ret = 0 ] ; then
     464        # got the correct prompt .. succeed
     465        true
     466    else
     467        echo "$out"
     468        echo "Attributes incorrect on new file $ret"
     469        false
     470    fi
     471
     472# Now check if we remove 'A' and rename, the A comes back.
     473    touch $filename_path
     474
     475    cat > $tmpfile <<EOF
     476lcd $PREFIX
     477put $filename
     478setmode $filename -a
     479ren $filename $filename_ren
     480allinfo $filename_ren
     481quit
     482EOF
     483
     484    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     485    eval echo "$cmd"
     486    out=`eval $cmd`
     487    ret=$?
     488    rm -f $tmpfile
     489
     490    if [ $ret != 0 ] ; then
     491        echo "$out"
     492        echo "failed creating file and renaming $filename with error $ret"
     493        false
     494        return
     495    fi
     496
     497    echo "$out" | grep "$prompt_file" >/dev/null 2>&1
     498
     499    ret=$?
     500
     501    rm -f $filename_path
     502    rm -f $local_name1
     503    rm -f $local_name2
     504
     505    if [ $ret = 0 ] ; then
     506        # got the correct prompt .. succeed
     507        true
     508    else
     509        echo "$out"
     510        echo "Attributes incorrect on renamed file $ret"
     511        false
     512    fi
     513
     514    rm -rf $local_dir_name1
     515    rm -rf $local_dir_name2
     516
     517# Create a new directory, ensure it has 'D' but not 'A' attributes.
     518
     519    cat > $tmpfile <<EOF
     520mkdir $dirname
     521allinfo $dirname
     522quit
     523EOF
     524
     525    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     526    eval echo "$cmd"
     527    out=`eval $cmd`
     528    ret=$?
     529    rm -f $tmpfile
     530
     531    if [ $ret != 0 ] ; then
     532        echo "$out"
     533        echo "failed creating directory $dirname with error $ret"
     534        false
     535        return
     536    fi
     537
     538    echo "$out" | grep "$prompt_dir" >/dev/null 2>&1
     539
     540    ret=$?
     541
     542    rm -rf $local_dir_name1
     543    rm -rf $local_dir_name2
     544
     545    if [ $ret = 0 ] ; then
     546        # got the correct prompt .. succeed
     547        true
     548    else
     549        echo "$out"
     550        echo "Attributes incorrect on new directory $ret"
     551        false
     552    fi
     553
     554# Now check if we rename, we still only have 'D' attributes
     555
     556    cat > $tmpfile <<EOF
     557mkdir $dirname
     558ren $dirname $dirname_ren
     559allinfo $dirname_ren
     560quit
     561EOF
     562
     563    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     564    eval echo "$cmd"
     565    out=`eval $cmd`
     566    ret=$?
     567    rm -f $tmpfile
     568
     569    if [ $ret != 0 ] ; then
     570        echo "$out"
     571        echo "failed creating directory $dirname and renaming with error $ret"
     572        false
     573        return
     574    fi
     575
     576    echo "$out" | grep "$prompt_dir" >/dev/null 2>&1
     577
     578    ret=$?
     579
     580    rm -f $local_name1
     581    rm -f $local_name2
     582
     583    if [ $ret = 0 ] ; then
     584        # got the correct prompt .. succeed
     585        true
     586    else
     587        echo "$out"
     588        echo "Attributes incorrect on renamed directory $ret"
     589        false
     590    fi
     591}
     592
    365593# Test authenticating using the winbind ccache
    366594test_ccache_access()
    367595{
    368596    $WBINFO --ccache-save="${USERNAME}%${PASSWORD}"
    369     $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}%" \
     597    ret=$?
     598
     599    if [ $ret != 0 ] ; then
     600        echo "wbinfo failed to store creds in cache (user='${USERNAME}', pass='${PASSWORD}')"
     601        false
     602        return
     603    fi
     604
     605    $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}" \
    370606        -c quit 2>&1
    371607    ret=$?
     
    378614
    379615    $WBINFO --ccache-save="${USERNAME}%GarBage"
    380     $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}%" \
     616    ret=$?
     617
     618    if [ $ret != 0 ] ; then
     619        echo "wbinfo failed to store creds in cache (user='${USERNAME}', pass='GarBage')"
     620        false
     621        return
     622    fi
     623
     624    $SMBCLIENT //$SERVER_IP/tmp -C -U "${USERNAME}" \
    381625        -c quit 2>&1
    382626    ret=$?
     
    389633
    390634    $WBINFO --logoff
     635}
     636
     637# Test authenticating using the winbind ccache
     638test_auth_file()
     639{
     640    tmpfile=$PREFIX/smbclient.in.$$
     641    cat > $tmpfile <<EOF
     642username=${USERNAME}
     643password=${PASSWORD}
     644domain=${DOMAIN}
     645EOF
     646    $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile \
     647        -c quit 2>&1
     648    ret=$?
     649    rm $tmpfile
     650
     651    if [ $ret != 0 ] ; then
     652        echo "smbclient failed to use auth file"
     653        false
     654        return
     655    fi
     656
     657    cat > $tmpfile <<EOF
     658username=${USERNAME}
     659password=xxxx
     660domain=${DOMAIN}
     661EOF
     662    $SMBCLIENT //$SERVER_IP/tmp --authentication-file=$tmpfile\
     663        -c quit 2>&1
     664    ret=$?
     665    rm $tmpfile
     666
     667    if [ $ret -eq 0 ] ; then
     668        echo "smbclient succeeded with wrong auth file credentials"
     669        false
     670        return
     671    fi
     672}
     673
     674# Test doing a directory listing with backup privilege.
     675test_backup_privilege_list()
     676{
     677    tmpfile=$PREFIX/smbclient_backup_privilege_list
     678
     679    # If we don't have a DOMAIN component to the username, add it.
     680    echo "$USERNAME" | grep '\\' 2>&1
     681    ret=$?
     682    if [ $ret != 0 ] ; then
     683        priv_username="$DOMAIN\\$USERNAME"
     684    else
     685        priv_username=$USERNAME
     686    fi
     687
     688    $NET sam rights grant $priv_username SeBackupPrivilege 2>&1
     689    ret=$?
     690    if [ $ret != 0 ] ; then
     691        echo "Failed to add SeBackupPrivilege to user $priv_username - $ret"
     692        false
     693        return
     694    fi
     695
     696    cat > $tmpfile <<EOF
     697backup
     698ls
     699quit
     700EOF
     701
     702    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     703    eval echo "$cmd"
     704    out=`eval $cmd`
     705    ret=$?
     706    rm -f $tmpfile
     707
     708    if [ $ret != 0 ] ; then
     709        echo "$out"
     710        echo "failed backup privilege list $ret"
     711        false
     712        return
     713    fi
     714
     715# Now remove all privileges from this SID.
     716    $NET sam rights revoke $priv_username SeBackupPrivilege 2>&1
     717    ret=$?
     718    if [ $ret != 0 ] ; then
     719        echo "failed to remove SeBackupPrivilege from user $priv_username - $ret"
     720        false
     721        return
     722    fi
     723}
     724
     725# Test accessing an share with bad names (won't convert).
     726test_bad_names()
     727{
     728    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP $ADDARGS -c ls 2>&1'
     729    eval echo "$cmd"
     730    out=`eval $cmd`
     731    ret=$?
     732
     733    if [ $ret != 0 ] ; then
     734        echo "$out"
     735        echo "failed accessing badname-tmp (SMB1) with error $ret"
     736        false
     737        return
     738    fi
     739
     740    echo "$out" | wc -l 2>&1 | grep 6
     741    ret=$?
     742    if [ $ret != 0 ] ; then
     743        echo "$out"
     744        echo "failed listing \\badname-tmp - grep of number of lines (1) failed with $ret"
     745        false
     746    fi
     747
     748    echo "$out" | grep 'Domain=.*OS=.*Server='
     749    ret=$?
     750    if [ $ret != 0 ] ; then
     751        echo "$out"
     752        echo "failed listing \\badname-tmp - grep (1) failed with $ret"
     753        false
     754    fi
     755
     756    echo "$out" | grep '^  \. *D'
     757    ret=$?
     758    if [ $ret != 0 ] ; then
     759        echo "$out"
     760        echo "failed listing \\badname-tmp - grep (2) failed with $ret"
     761        false
     762    fi
     763
     764    echo "$out" | grep '^  \.\. *D'
     765    ret=$?
     766    if [ $ret != 0 ] ; then
     767        echo "$out"
     768        echo "failed listing \\badname-tmp - grep (3) failed with $ret"
     769        false
     770    fi
     771
     772    echo "$out" | grep '^  blank.txt *N'
     773    ret=$?
     774    if [ $ret != 0 ] ; then
     775        echo "$out"
     776        echo "failed listing \\badname-tmp - grep (4) failed with $ret"
     777        false
     778    fi
     779
     780    echo "$out" | grep '^ *$'
     781    ret=$?
     782    if [ $ret != 0 ] ; then
     783        echo "$out"
     784        echo "failed listing \\badname-tmp - grep (5) failed with $ret"
     785        false
     786    fi
     787
     788    echo "$out" | grep 'blocks of size.*blocks available'
     789    ret=$?
     790    if [ $ret != 0 ] ; then
     791        echo "$out"
     792        echo "failed listing \\badname-tmp - grep (6) failed with $ret"
     793        false
     794    fi
     795
     796    # Now check again with -mSMB3
     797    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP -mSMB3 $ADDARGS -c ls 2>&1'
     798    eval echo "$cmd"
     799    out=`eval $cmd`
     800    ret=$?
     801
     802    if [ $ret != 0 ] ; then
     803        echo "$out"
     804        echo "failed accessing badname-tmp (SMB3) with error $ret"
     805        false
     806        return
     807    fi
     808
     809    echo "$out" | wc -l 2>&1 | grep 6
     810    ret=$?
     811    if [ $ret != 0 ] ; then
     812        echo "$out"
     813        echo "failed listing \\badname-tmp - SMB3 grep of number of lines (1) failed with $ret"
     814        false
     815    fi
     816
     817    echo "$out" | grep 'Domain=.*OS=.*Server='
     818    ret=$?
     819    if [ $ret != 0 ] ; then
     820        echo "$out"
     821        echo "failed listing \\badname-tmp - SMB3 grep (1) failed with $ret"
     822        false
     823    fi
     824
     825    echo "$out" | grep '^  \. *D'
     826    ret=$?
     827    if [ $ret != 0 ] ; then
     828        echo "$out"
     829        echo "failed listing \\badname-tmp - SMB3 grep (2) failed with $ret"
     830        false
     831    fi
     832
     833    echo "$out" | grep '^  \.\. *D'
     834    ret=$?
     835    if [ $ret != 0 ] ; then
     836        echo "$out"
     837        echo "failed listing \\badname-tmp - SMB3 grep (3) failed with $ret"
     838        false
     839    fi
     840
     841    echo "$out" | grep '^  blank.txt *N'
     842    ret=$?
     843    if [ $ret != 0 ] ; then
     844        echo "$out"
     845        echo "failed listing \\badname-tmp - SMB3 grep (4) failed with $ret"
     846        false
     847    fi
     848
     849    echo "$out" | grep '^ *$'
     850    ret=$?
     851    if [ $ret != 0 ] ; then
     852        echo "$out"
     853        echo "failed listing \\badname-tmp - SMB3 grep (5) failed with $ret"
     854        false
     855    fi
     856
     857    echo "$out" | grep 'blocks of size.*blocks available'
     858    ret=$?
     859    if [ $ret != 0 ] ; then
     860        echo "$out"
     861        echo "failed listing \\badname-tmp - SMB3 grep (6) failed with $ret"
     862        false
     863    fi
     864}
     865
     866# Test accessing an share with a name that must be mangled - with acl_xattrs.
     867# We know foo:bar gets mangled to FF4GBY~Q with the default name-mangling algorithm (hash2).
     868test_mangled_names()
     869{
     870    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
     871    cat > $tmpfile <<EOF
     872ls
     873cd FF4GBY~Q
     874ls
     875quit
     876EOF
     877    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/manglenames_share -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     878    eval echo "$cmd"
     879    out=`eval $cmd`
     880    ret=$?
     881    rm -f $tmpfile
     882
     883    if [ $ret != 0 ] ; then
     884        echo "$out"
     885        echo "failed accessing manglenames_share with error $ret"
     886        false
     887        return
     888    fi
     889
     890    echo "$out" | grep 'NT_STATUS'
     891    ret=$?
     892    if [ $ret == 0 ] ; then
     893        echo "$out"
     894        echo "failed - NT_STATUS_XXXX listing \\manglenames_share\\FF4GBY~Q"
     895        false
     896    fi
     897}
     898
     899# Test using scopy to copy a file on the server.
     900test_scopy()
     901{
     902    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
     903    scopy_file=$PREFIX/scopy_file
     904
     905    rm -f $scopy_file
     906    cat > $tmpfile <<EOF
     907put ${SMBCLIENT}
     908scopy smbclient scopy_file
     909lcd ${PREFIX}
     910get scopy_file
     911del smbclient
     912del scopy_file
     913quit
     914EOF
     915    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -mSMB3 -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     916    eval echo "$cmd"
     917    out=`eval $cmd`
     918    ret=$?
     919    out1=`md5sum ${SMBCLIENT} | sed -e 's/ .*//'`
     920    out2=`md5sum ${scopy_file} | sed -e 's/ .*//'`
     921    rm -f $tmpfile
     922    rm -f $scopy_file
     923
     924    if [ $ret != 0 ] ; then
     925        echo "$out"
     926        echo "failed scopy test (1) with output $ret"
     927        false
     928        return
     929    fi
     930
     931    if [ $out1 != $out2 ] ; then
     932        echo "$out1 $out2"
     933        echo "failed md5sum (1)"
     934        false
     935    fi
     936
     937#
     938# Now do again using SMB1
     939# to force client-side fallback.
     940#
     941
     942    cat > $tmpfile <<EOF
     943put ${SMBCLIENT}
     944scopy smbclient scopy_file
     945lcd ${PREFIX}
     946get scopy_file
     947del smbclient
     948del scopy_file
     949quit
     950EOF
     951    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -mNT1 -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     952    eval echo "$cmd"
     953    out=`eval $cmd`
     954    ret=$?
     955    out1=`md5sum ${SMBCLIENT} | sed -e 's/ .*//'`
     956    out2=`md5sum ${scopy_file} | sed -e 's/ .*//'`
     957    rm -f $tmpfile
     958    rm -f $scopy_file
     959
     960    if [ $ret != 0 ] ; then
     961        echo "$out"
     962        echo "failed scopy test (2) with output $ret"
     963        false
     964        return
     965    fi
     966
     967    if [ $out1 != $out2 ] ; then
     968        echo "$out1 $out2"
     969        echo "failed md5sum (2)"
     970        false
     971    fi
     972}
     973
     974# Test creating a stream on the root of the share directory filname - :foobar
     975test_toplevel_stream()
     976{
     977    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
     978    cat > $tmpfile <<EOF
     979put ${PREFIX}/smbclient_interactive_prompt_commands :foobar
     980allinfo \\
     981setmode \\ -a
     982quit
     983EOF
     984    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP -mSMB3 $ADDARGS < $tmpfile 2>&1'
     985    eval echo "$cmd"
     986    out=`eval $cmd`
     987    ret=$?
     988    rm -f $tmpfile
     989
     990    if [ $ret != 0 ] ; then
     991        echo "$out"
     992        echo "failed creating toplevel stream :foobar with error $ret"
     993        false
     994        return
     995    fi
     996
     997    echo "$out" | grep '^stream:.*:foobar'
     998    ret=$?
     999    if [ $ret != 0 ] ; then
     1000        echo "$out"
     1001        echo "failed creating toplevel stream :foobar"
     1002        false
     1003    fi
     1004}
     1005
     1006# Test wide links are restricted.
     1007test_widelinks()
     1008{
     1009    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
     1010    cat > $tmpfile <<EOF
     1011cd dot
     1012ls
     1013quit
     1014EOF
     1015    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/widelinks_share -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     1016    eval echo "$cmd"
     1017    out=`eval $cmd`
     1018    ret=$?
     1019    rm -f $tmpfile
     1020
     1021    if [ $ret != 0 ] ; then
     1022        echo "$out"
     1023        echo "failed accessing widelinks_share with error $ret"
     1024        false
     1025        return
     1026    fi
     1027
     1028    echo "$out" | grep 'NT_STATUS'
     1029    ret=$?
     1030    if [ $ret == 0 ] ; then
     1031        echo "$out"
     1032        echo "failed - NT_STATUS_XXXX listing \\widelinks_share\\dot"
     1033        false
     1034    fi
     1035
     1036    cat > $tmpfile <<EOF
     1037allinfo source
     1038quit
     1039EOF
     1040    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/widelinks_share -I $SERVER_IP $ADDARGS < $tmpfile 2>&1'
     1041    eval echo "$cmd"
     1042    out=`eval $cmd`
     1043    ret=$?
     1044    rm -f $tmpfile
     1045
     1046    if [ $ret != 0 ] ; then
     1047        echo "$out"
     1048        echo "failed accessing widelinks_share with error $ret"
     1049        false
     1050        return
     1051    fi
     1052
     1053# This should fail with NT_STATUS_ACCESS_DENIED
     1054    echo "$out" | grep 'NT_STATUS_ACCESS_DENIED'
     1055    ret=$?
     1056    if [ $ret != 0 ] ; then
     1057        echo "$out"
     1058        echo "failed - should get NT_STATUS_ACCESS_DENIED listing \\widelinks_share\\source"
     1059        false
     1060    fi
    3911061}
    3921062
     
    4311101
    4321102testit "writing into a read-only directory fails" \
    433    test_read_only_dir || \
     1103   test_read_only_dir ro-tmp || \
     1104   failed=`expr $failed + 1`
     1105
     1106testit "writing into a read-only share fails" \
     1107   test_read_only_dir valid-users-tmp || \
    4341108   failed=`expr $failed + 1`
    4351109
     
    4421116   failed=`expr $failed + 1`
    4431117
     1118testit "Ensure archive bit is set correctly on file/dir rename" \
     1119    test_rename_archive_bit || \
     1120    failed=`expr $failed + 1`
     1121
    4441122testit "ccache access works for smbclient" \
    4451123    test_ccache_access || \
    4461124    failed=`expr $failed + 1`
    4471125
     1126testit "sending a message to the remote server" \
     1127    test_message || \
     1128    failed=`expr $failed + 1`
     1129
     1130testit "using an authentication file" \
     1131    test_auth_file || \
     1132    failed=`expr $failed + 1`
     1133
     1134testit "list with backup privilege" \
     1135    test_backup_privilege_list || \
     1136    failed=`expr $failed + 1`
     1137
     1138testit "list a share with bad names (won't convert)" \
     1139    test_bad_names || \
     1140    failed=`expr $failed + 1`
     1141
     1142testit "list a share with a mangled name + acl_xattr object" \
     1143    test_mangled_names || \
     1144    failed=`expr $failed + 1`
     1145
     1146testit "server-side file copy" \
     1147    test_scopy || \
     1148    failed=`expr $failed + 1`
     1149
     1150testit "creating a :stream at root of share" \
     1151    test_toplevel_stream || \
     1152    failed=`expr $failed + 1`
     1153
     1154testit "Ensure widelinks are restricted" \
     1155    test_widelinks || \
     1156    failed=`expr $failed + 1`
     1157
    4481158testit "rm -rf $LOGDIR" \
    4491159    rm -rf $LOGDIR || \
  • vendor/current/source3/script/tests/test_smbtorture_s3.sh

    r740 r988  
    55if [ $# -lt 4 ]; then
    66cat <<EOF
    7 Usage: test_smbtorture_s3.sh TEST UNC USERNAME PASSWORD <smbtorture args>
     7Usage: test_smbtorture_s3.sh TEST UNC USERNAME PASSWORD SMBTORTURE <smbtorture args>
    88EOF
    99exit 1;
     
    1414username="$3"
    1515password="$4"
    16 shift 4
     16SMBTORTURE="$5"
     17shift 5
    1718ADDARGS="$*"
    1819
    19 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    2020incdir=`dirname $0`/../../../testprogs/blackbox
    2121. $incdir/subunit.sh
    22 }
    2322
    2423
    2524
    2625failed=0
    27 testit "smbtorture" $VALGRIND $BINDIR/smbtorture $unc -U"$username"%"$password" $ADDARGS $t || failed=`expr $failed + 1`
     26testit "smbtorture" $VALGRIND $SMBTORTURE $unc -U"$username"%"$password" $ADDARGS $t || failed=`expr $failed + 1`
    2827
    2928testok $0 $failed
  • vendor/current/source3/script/tests/test_success.sh

    r740 r988  
    55# Copyright (C) 2011 Michael Adam <obnox@samba.org>
    66
    7 # include the blackbox subunit infrastructure
    8 # if not run from classical s3 test script:
    9 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    10         incdir=`dirname $0`/../../../testprogs/blackbox
    11         . $incdir/subunit.sh
    12 }
     7incdir=`dirname $0`/../../../testprogs/blackbox
     8. $incdir/subunit.sh
    139
    1410failed=0
  • vendor/current/source3/script/tests/test_testparm_s3.sh

    r740 r988  
    1818TESTPARM="$VALGRIND ${TESTPARM:-$BINDIR/testparm} --suppress-prompt --skip-logic-checks"
    1919
    20 test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && {
    2120incdir=`dirname $0`/../../../testprogs/blackbox
    2221. $incdir/subunit.sh
    23 }
    2422
    2523failed=0
  • vendor/current/source3/script/tests/test_wbinfo_sids2xids.sh

    r740 r988  
    11#!/bin/sh
    22
    3 WBINFO="$VALGRIND ${NET:-$BINDIR/wbinfo} $CONFIGURATION"
     3WBINFO="$VALGRIND ${WBINFO:-$BINDIR/wbinfo} $CONFIGURATION"
     4NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
    45TEST_INT=`dirname $0`/test_wbinfo_sids2xids_int.py
    56
     
    78. $incdir/subunit.sh
    89
    9 testit "sids2xids" ${TEST_INT} ${WBINFO} || failed=`expr $failed + 1`
     10testit "sids2xids" ${TEST_INT} ${WBINFO} ${NET} || failed=`expr $failed + 1`
    1011
    1112testok $0 $failed
  • vendor/current/source3/script/tests/test_wbinfo_sids2xids_int.py

    r740 r988  
    33import sys,os,subprocess
    44
    5 if len(sys.argv) != 2:
    6     print "Usage: test_wbinfo_sids2xids_int.py wbinfo"
     5
     6if len(sys.argv) != 3:
     7    print "Usage: test_wbinfo_sids2xids_int.py wbinfo net"
    78    sys.exit(1)
    89
    910wbinfo = sys.argv[1]
     11netcmd = sys.argv[2]
     12
     13def flush_cache():
     14    os.system(netcmd + " cache flush")
     15
     16def fill_cache(inids, idtype='gid'):
     17    for inid in inids:
     18        if inid is None:
     19            continue
     20        subprocess.Popen([wbinfo, '--%s-to-sid=%s' % (idtype, inid)],
     21                         stdout=subprocess.PIPE).communicate()
     22
    1023domain = subprocess.Popen([wbinfo, "--own-domain"],
    1124                          stdout=subprocess.PIPE).communicate()[0].strip()
    12 domsid = subprocess.Popen([wbinfo, "-n", domain + "\\"],
     25domsid = subprocess.Popen([wbinfo, "-n", domain + "/"],
    1326                          stdout=subprocess.PIPE).communicate()[0]
    1427domsid = domsid.split(' ')[0]
     
    1932sids=[ domsid + '-512', 'S-1-5-32-545', domsid + '-513' ]
    2033
     34flush_cache()
     35
    2136sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' +  ','.join(sids)],
    2237                             stdout=subprocess.PIPE).communicate()[0].strip()
    2338
    2439gids=[]
     40uids=[]
     41idtypes = []
    2542
    2643for line in sids2xids.split('\n'):
    2744    result = line.split(' ')[2:]
     45    idtypes.append(result[0])
    2846
     47    gid = None
     48    uid = None
    2949    if result[0] == 'gid':
    3050        gid = result[1]
    31     else:
    32         gid = ''
     51    elif result[0] == 'uid':
     52        uid = result[1]
     53    elif result[0] == 'uid/gid':
     54        gid = result[1]
     55        uid = result[1]
     56
    3357    if gid == '-1':
    3458        gid = ''
    3559    gids.append(gid)
    3660
    37 i=0
     61    if uid == '-1':
     62        uid = ''
     63    uids.append(uid)
    3864
    39 for sid in sids:
    40     gid = subprocess.Popen([wbinfo, '--sid-to-gid', sid],
    41                            stdout=subprocess.PIPE).communicate()[0].strip()
    42     if gid != gids[i]:
    43         print "Expected %s, got %s\n", gid, gids[i]
    44         sys.exit(1)
    45     i+=1
     65# Check the list produced by the sids-to-xids call with the
     66# singular variant (sid-to-xid) for each sid in turn.
     67def check_singular(sids, ids, idtype='gid'):
     68    i = 0
     69    for sid in sids:
     70        if ids[i] is None:
     71            continue
     72
     73        outid = subprocess.Popen([wbinfo, '--sid-to-%s' % idtype, sid],
     74                                 stdout=subprocess.PIPE).communicate()[0].strip()
     75        if outid != ids[i]:
     76            print "Expected %s, got %s\n" % (outid, ids[i])
     77            flush_cache()
     78            sys.exit(1)
     79        i += 1
     80
     81# Check the list produced by the sids-to-xids call with the
     82# multiple variant (sid-to-xid) for each sid in turn.
     83def check_multiple(sids, idtypes):
     84    sids2xids = subprocess.Popen([wbinfo, '--sids-to-unix-ids=' +  ','.join(sids)],
     85                                 stdout=subprocess.PIPE).communicate()[0].strip()
     86    # print sids2xids
     87    i = 0
     88    for line in sids2xids.split('\n'):
     89        result = line.split(' ')[2:]
     90
     91        if result[0] != idtypes[i]:
     92            print "Expected %s, got %s\n" % (idtypes[i], result[0])
     93            flush_cache()
     94            sys.exit(1)
     95        i += 1
     96
     97# first round: with filled cache via sid-to-id
     98check_singular(sids, gids, 'gid')
     99check_singular(sids, uids, 'uid')
     100
     101# second round: with empty cache
     102flush_cache()
     103check_singular(sids, gids, 'gid')
     104flush_cache()
     105check_singular(sids, uids, 'uid')
     106
     107# third round: with filled cache via uid-to-sid
     108flush_cache()
     109fill_cache(uids, 'uid')
     110check_multiple(sids, idtypes)
     111
     112# fourth round: with filled cache via gid-to-sid
     113flush_cache()
     114fill_cache(gids, 'gid')
     115check_multiple(sids, idtypes)
     116
     117# flush the cache so any incorrect mappings don't break other tests
     118flush_cache()
    46119
    47120sys.exit(0)
Note: See TracChangeset for help on using the changeset viewer.