#!/bin/sh # # Blackbox test for SMB2 case insensitivity # if [ $# -lt 6 ]; then cat <$tmpfile cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -mSMB3 -U$USERNAME%$PASSWORD "$SERVER" -I $SERVER_IP -c "ls TeStFiLe.TxT" 2>&1' out=$(eval $cmd) ret=$? rm -f $tmpfile if [ $ret = 0 ]; then return 0 else echo "$out" echo "failed to get file with different case" return 1 fi } # Test that a rename causes a conflict works when target name exists in # different case test_rename() { set -x tmpfile=$LOCAL_PATH/torename.txt echo "foobar" >$tmpfile targetfile=$LOCAL_PATH/target.txt touch $targetfile cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -mSMB3 -U$USERNAME%$PASSWORD "$SERVER" -I $SERVER_IP -c "rename ToReNaMe.TxT TaRgEt.txt" 2>&1' out=$(eval $cmd) ret=$? rm -f $tmpfile rm -f $targetfile rm -f $LOCAL_PATH/TaRgEt.txt if [ $ret = 1 -a -z "${out##*COLLISION*}" ]; then return 0 else echo "$out" echo "failed to get file with different case" return 1 fi } testit "accessing a file with different case succeeds" \ test_access_with_different_case || failed=$(expr $failed + 1) testit "renaming a file with different case succeeds" \ test_rename || failed=$(expr $failed + 1) exit $failed