From 8daa83a594a2e98f39d764422bfbdbc62c9efd44 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 19:20:00 +0200 Subject: Adding upstream version 2:4.20.0+dfsg. Signed-off-by: Daniel Baumann --- source4/client/tests/test_cifsdd.sh | 77 +++++++++++++++++ source4/client/tests/test_smbclient.sh | 154 +++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+) create mode 100755 source4/client/tests/test_cifsdd.sh create mode 100755 source4/client/tests/test_smbclient.sh (limited to 'source4/client/tests') diff --git a/source4/client/tests/test_cifsdd.sh b/source4/client/tests/test_cifsdd.sh new file mode 100755 index 0000000..21a8840 --- /dev/null +++ b/source4/client/tests/test_cifsdd.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +# Basic script to make sure that cifsdd can do both local and remote I/O. + +if [ $# -lt 4 ]; then + cat </dev/null + +ls -l $sourcepath + +for bs in 512 4k 48k; do + + echo "Testing $bs block size ..." + + # Check whether we can do local IO + runcopy "Testing local -> local copy" if=$sourcepath of=$destpath bs=$bs + compare "Checking local differences" $sourcepath $destpath + + # Check whether we can do a round trip + runcopy "Testing local -> remote copy" \ + if=$sourcepath of=//$SERVER/$SHARE/$sourcefile bs=$bs + runcopy "Testing remote -> local copy" \ + if=//$SERVER/$SHARE/$sourcefile of=$destpath bs=$bs + compare "Checking differences" $sourcepath $destpath + + # Check that copying within the remote server works + runcopy "Testing local -> remote copy" \ + if=//$SERVER/$SHARE/$sourcefile of=//$SERVER/$SHARE/$sourcefile bs=$bs + runcopy "Testing remote -> remote copy" \ + if=//$SERVER/$SHARE/$sourcefile of=//$SERVER/$SHARE/$destfile bs=$bs + runcopy "Testing remote -> local copy" \ + if=//$SERVER/$SHARE/$destfile of=$destpath bs=$bs + compare "Checking differences" $sourcepath $destpath + +done + +rm -f $sourcepath $destpath + +exit $failed diff --git a/source4/client/tests/test_smbclient.sh b/source4/client/tests/test_smbclient.sh new file mode 100755 index 0000000..121de17 --- /dev/null +++ b/source4/client/tests/test_smbclient.sh @@ -0,0 +1,154 @@ +#!/bin/sh +# Blackbox tests for smbclient +# Copyright (C) 2006-2007 Jelmer Vernooij +# Copyright (C) 2006-2007 Andrew Bartlett + +if [ $# -lt 5 ]; then + cat <$PREFIX/tmpfile + +# put that file +runcmd "MPutting file" "lcd $PREFIX; mput tmpfile" || failed=$(expr $failed + 1) +# check file info +runcmd "Getting alternative name" 'altname tmpfile' || failed=$(expr $failed + 1) +# run allinfo on that file +runcmd "Checking info on file" 'allinfo tmpfile' || failed=$(expr $failed + 1) +# get that file +mv $PREFIX/tmpfile $PREFIX/tmpfile-old +runcmd "MGetting file" "lcd $PREFIX; mget tmpfile" || failed=$(expr $failed + 1) +# remove that file +runcmd "Removing file" 'rm tmpfile' || failed=$(expr $failed + 1) +# compare locally +testit "Comparing files" diff $PREFIX/tmpfile-old $PREFIX/tmpfile || failed=$(expr $failed + 1) +# create directory +# cd to directory +# cd to top level directory +# remove directory +runcmd "Creating directory, Changing directory, Going back" 'mkdir bla; cd bla; cd ..; rmdir bla' || failed=$(expr $failed + 1) +# enable recurse, create nested directory +runcmd "Creating nested directory" 'mkdir bla/bloe' || failed=$(expr $failed + 1) +# remove child directory +runcmd "Removing directory" 'rmdir bla/bloe' || failed=$(expr $failed + 1) +# remove parent directory +runcmd "Removing directory" 'rmdir bla' || failed=$(expr $failed + 1) +# enable recurse, create nested directory +runcmd "Creating nested directory" 'mkdir bla' || failed=$(expr $failed + 1) +# rename bla to bla2 +runcmd "rename of nested directory" 'rename bla bla2' || failed=$(expr $failed + 1) +# deltree +runcmd "deltree of nested directory" 'deltree bla2' || failed=$(expr $failed + 1) +# run fsinfo +runcmd "Getting file system info" 'fsinfo allocation' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo volume' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo volumeinfo' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo sizeinfo' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo deviceinfo' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo attributeinfo' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo volume-information' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo size-information' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo device-information' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo attribute-information' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo quota-information' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo fullsize-information' || failed=$(expr $failed + 1) +runcmd "Getting file system info" 'fsinfo objectid' || failed=$(expr $failed + 1) + +# put that file +runcmd "Putting file" "lcd $PREFIX; put tmpfile" || failed=$(expr $failed + 1) +# get that file +mv $PREFIX/tmpfile $PREFIX/tmpfile-old +runcmd "Getting file" "lcd $PREFIX; get tmpfile" || failed=$(expr $failed + 1) +runcmd "Getting file EA info" 'eainfo tmpfile' || failed=$(expr $failed + 1) +# remove that file +runcmd "Removing file" 'rm tmpfile' || failed=$(expr $failed + 1) +# compare locally +testit "Comparing files" diff $PREFIX/tmpfile-old $PREFIX/tmpfile || failed=$(expr $failed + 1) +# put that file +runcmd "Putting file with different name" "lcd $PREFIX; put tmpfile tmpfilex" || failed=$(expr $failed + 1) +# get that file +runcmd "Getting file again" "lcd $PREFIX; get tmpfilex" || failed=$(expr $failed + 1) +# compare locally +testit "Comparing files" diff $PREFIX/tmpfilex $PREFIX/tmpfile || failed=$(expr $failed + 1) +# remove that file +runcmd "Removing file" 'rm tmpfilex' || failed=$(expr $failed + 1) + +runcmd "Lookup name" "lookup $DOMAIN\\$USERNAME" || failed=$(expr $failed + 1) + +#Fails unless there are privileges +#runcmd "Lookup privs of name" "privileges $DOMAIN\\$USERNAME" || failed=`expr $failed + 1` + +# do some simple operations using old protocol versions +runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 --option=clientntlmv2auth=no || failed=$(expr $failed + 1) +runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 --option=clientntlmv2auth=no || failed=$(expr $failed + 1) + +runcmd "Print current working directory" 'pwd' || failed=$(expr $failed + 1) + +( + echo "password=$PASSWORD" + echo "username=$USERNAME" + echo "domain=$DOMAIN" +) >$PREFIX/tmpauthfile + +testit "Test login with --authentication-file" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --authentication-file=$PREFIX/tmpauthfile || failed=$(expr $failed + 1) + +PASSWD_FILE="$PREFIX/tmppassfile" +echo "$PASSWORD" >$PASSWD_FILE +export PASSWD_FILE +testit "Test login with PASSWD_FILE" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=$(expr $failed + 1) +PASSWD_FILE="" +export PASSWD_FILE +unset PASSWD_FILE + +PASSWD="$PASSWORD" +export PASSWD +testit "Test login with PASSWD" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=$(expr $failed + 1) + +oldUSER=$USER +USER="$USERNAME" +export USER +testit "Test login with USER and PASSWD" $VALGRIND $smbclient --use-kerberos=disabled -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" || failed=$(expr $failed + 1) +PASSWD= +export PASSWD +unset PASSWD +USER=$oldUSER +export USER + +rm -f $PREFIX/tmpfile $PREFIX/tmpfile-old $PREFIX/tmpfilex $PREFIX/tmpauthfile $PREFIX/tmppassfile +exit $failed -- cgit v1.2.3