The Samba-Bugzilla – Attachment 15790 Details for
Bug 14279
REGRESSION: We can't change to a dropbox directory with mode 733 and drop a file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
dropbox test with 'put wurst dirmode733/wurst'
dropbox.patch (text/plain), 9.98 KB, created by
Andreas Schneider
on 2020-02-14 16:53:01 UTC
(
hide
)
Description:
dropbox test with 'put wurst dirmode733/wurst'
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2020-02-14 16:53:01 UTC
Size:
9.98 KB
patch
obsolete
>From 56cde8da31a502945a6641858e6f9ee1f013eed6 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Wed, 12 Feb 2020 16:30:01 +0100 >Subject: [PATCH 1/3] s3:tests: Add smbclient test for 'force create mode = > 0664' > >Signed-off-by: Andreas Schneider <asn@samba.org> >--- > selftest/target/Samba3.pm | 8 +++ > .../script/tests/test_force_create_mode.sh | 72 +++++++++++++++++++ > source3/selftest/tests.py | 1 + > 3 files changed, 81 insertions(+) > create mode 100755 source3/script/tests/test_force_create_mode.sh > >diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm >index 0c9adcc76fd..99230a6429c 100755 >--- a/selftest/target/Samba3.pm >+++ b/selftest/target/Samba3.pm >@@ -1071,6 +1071,14 @@ sub setup_fileserver > path = $share_dir > comment = force group test > # force group = everyone >+ >+[create_mode_664] >+ path = $share_dir >+ comment = smb username is [%U] >+ create mask = 0644 >+ force create mode = 0664 >+ vfs objects = dirsort >+ > [homes] > comment = Home directories > browseable = No >diff --git a/source3/script/tests/test_force_create_mode.sh b/source3/script/tests/test_force_create_mode.sh >new file mode 100755 >index 00000000000..d5948b239b1 >--- /dev/null >+++ b/source3/script/tests/test_force_create_mode.sh >@@ -0,0 +1,72 @@ >+#!/bin/sh >+# >+# Blackbox test for 'force create mode' >+# >+ >+if [ $# -lt 7 ]; then >+cat <<EOF >+Usage: $0 SERVER DOMAIN USERNAME PASSWORD PREFIX TARGET_ENV SMBCLIENT >+EOF >+exit 1; >+fi >+ >+SERVER=${1} >+DOMAIN=${2} >+USERNAME=${3} >+PASSWORD=${4} >+PREFIX=${5} >+TARGET_ENV=${6} >+SMBCLIENT=${7} >+shift 7 >+SMBCLIENT="$VALGRIND ${SMBCLIENT}" >+ADDARGS="$@" >+ >+incdir=`dirname $0`/../../../testprogs/blackbox >+. $incdir/subunit.sh >+ >+failed=0 >+ >+test_force_create_mode() >+{ >+ local filename="wurst.$$" >+ local filename_path="$PREFIX/$filename" >+ >+ local tmpfile=$PREFIX/smbclient_interactive_prompt_commands >+ >+ echo wurstbar > $filename_path >+ >+ cat > $tmpfile <<EOF >+lcd $PREFIX >+put $filename >+quit >+EOF >+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -U$USERNAME%$PASSWORD //$SERVER/$1 $ADDARGS < $tmpfile 2>&1' >+ eval echo "$cmd" >+ out=`eval $cmd` >+ ret=$? >+ rm -f $tmpfile >+ >+ if [ $ret -ne 0 ] ; then >+ echo "$out" >+ echo "Failed to connect - error: $ret" >+ return 1 >+ fi >+ rm -f $filename_path >+ >+ share_filename="$PREFIX/$TARGET_ENV/share/$filename" >+ file_perms=$(stat --format=%a $share_filename) >+ if [ "$file_perms" != "664" ]; then >+ echo "Invalid file permissions: $file_perms" >+ return 1 >+ fi >+ >+ rm -f $share_filename >+ >+ return 0 >+} >+ >+testit "test_mode=0664" \ >+ test_force_create_mode create_mode_664 || \ >+ failed=`expr $failed + 1` >+ >+exit $failed >diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py >index 5a897c9ad0b..5953ba9bdaf 100755 >--- a/source3/selftest/tests.py >+++ b/source3/selftest/tests.py >@@ -357,6 +357,7 @@ for env in ["fileserver"]: > plantestsuite("samba3.blackbox.dfree_quota.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_dfree_quota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, smbcquotas, smbcacls, "SMB3"]) > plantestsuite("samba3.blackbox.smbcquotas", env, [os.path.join(samba3srcdir, "script/tests/test_smbcquota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbcquotas]) > plantestsuite("samba3.blackbox.valid_users", env, [os.path.join(samba3srcdir, "script/tests/test_valid_users.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3]) >+ plantestsuite("samba3.blackbox.force_create_mode", env, [os.path.join(samba3srcdir, "script/tests/test_force_create_mode.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', env, smbclient3]) > plantestsuite("samba3.blackbox.offline", env, [os.path.join(samba3srcdir, "script/tests/test_offline.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/offline', smbclient3]) > plantestsuite("samba3.blackbox.shadow_copy2.NT1", env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'NT1']) > plantestsuite("samba3.blackbox.shadow_copy2.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'SMB3']) >-- >2.25.0 > > >From 8fce79d5442887ecb2bb6ffdac5450eda3ad0f78 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 13 Feb 2020 13:48:17 +0100 >Subject: [PATCH 2/3] s3:tests: Add test for a dropbox with dir mode 0733 > >Note: This is currently broken in Samba and a fix will require a rewrite >of smbd with openat() and fchdir(). > >Signed-off-by: Andreas Schneider <asn@samba.org> >--- > selftest/target/Samba3.pm | 7 +++ > source3/script/tests/test_dropbox.sh | 88 ++++++++++++++++++++++++++++ > source3/selftest/tests.py | 1 + > 3 files changed, 96 insertions(+) > create mode 100755 source3/script/tests/test_dropbox.sh > >diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm >index 99230a6429c..4876c158e0f 100755 >--- a/selftest/target/Samba3.pm >+++ b/selftest/target/Samba3.pm >@@ -991,6 +991,9 @@ sub setup_fileserver > my $usershare_sharedir="$share_dir/usershares"; > push(@dirs,$usershare_sharedir); > >+ my $dropbox_sharedir="$share_dir/dropbox"; >+ push(@dirs,$dropbox_sharedir); >+ > my $fileserver_options = " > kernel change notify = yes > rpc_server:mdssvc = embedded >@@ -1079,6 +1082,10 @@ sub setup_fileserver > force create mode = 0664 > vfs objects = dirsort > >+[dropbox] >+ path = $dropbox_sharedir >+ comment = smb username is [%U] >+ > [homes] > comment = Home directories > browseable = No >diff --git a/source3/script/tests/test_dropbox.sh b/source3/script/tests/test_dropbox.sh >new file mode 100755 >index 00000000000..dd1267c9325 >--- /dev/null >+++ b/source3/script/tests/test_dropbox.sh >@@ -0,0 +1,88 @@ >+#!/bin/sh >+# >+# Blackbox test for valid users. >+# >+ >+if [ $# -lt 6 ]; then >+cat <<EOF >+Usage: $0 SERVER DOMAIN USERNAME PASSWORD PREFIX SMBCLIENT >+EOF >+exit 1; >+fi >+ >+SERVER=${1} >+DOMAIN=${2} >+USERNAME=${3} >+PASSWORD=${4} >+PREFIX=${5} >+SMBCLIENT=${6} >+shift 6 >+SMBCLIENT="$VALGRIND ${SMBCLIENT}" >+ADDARGS="$@" >+ >+incdir=`dirname $0`/../../../testprogs/blackbox >+. $incdir/subunit.sh >+ >+failed=0 >+ >+# Test listing a share with valid users succeeds >+test_dropbox() >+{ >+ local filename="wurst.$$" >+ local filename_path="$PREFIX/$filename" >+ local dropbox_path="$PREFIX/$ENVNAME/share/$1/dirmode733" >+ >+ local tmpfile=$PREFIX/smbclient.in.$$ >+ >+ echo "wurstbar" > $filename_path >+ >+ # Create dropbox directory and set permissions >+ mkdir -p $dropbox_path >+ chmod 0333 $dropbox_path >+ >+ cat > $tmpfile <<EOF >+lcd $PREFIX >+cd dirmode733 >+put $filename >+quit >+EOF >+ >+ local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -U$USERNAME%$PASSWORD //$SERVER/$1 $ADDARGS < $tmpfile 2>&1' >+ eval echo "$cmd" >+ local out=$(eval $cmd) >+ ret=$? >+ >+ # Cleanup and reset dropbox permissions >+ rm -f $tmpfile >+ chmod 0755 $dropbox_path >+ >+ if [ $ret != 0 ] ; then >+ echo "failed accessing share $ret" >+ echo "$out" >+ >+ return 1 >+ fi >+ rm -f $filename_path >+ >+ dropped_file="$dropbox_path/$filename" >+ if [ ! -r "$dropped_file" ]; then >+ echo "Failed to drop file $filename" >+ echo "$out" >+ return 1 >+ fi >+ >+ content=$(<$dropped_file) >+ if [ "$content" != "wurstbar" ]; then >+ echo "Invalid file content: $content" >+ echo "$out" >+ return 1 >+ fi >+ >+ return 0 >+} >+ >+testit "dropbox dirmode 0733" \ >+ test_dropbox dropbox || \ >+ failed=`expr $failed + 1` >+ >+exit $failed >diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py >index 5953ba9bdaf..f2bbb7fe5d3 100755 >--- a/source3/selftest/tests.py >+++ b/source3/selftest/tests.py >@@ -358,6 +358,7 @@ for env in ["fileserver"]: > plantestsuite("samba3.blackbox.smbcquotas", env, [os.path.join(samba3srcdir, "script/tests/test_smbcquota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbcquotas]) > plantestsuite("samba3.blackbox.valid_users", env, [os.path.join(samba3srcdir, "script/tests/test_valid_users.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3]) > plantestsuite("samba3.blackbox.force_create_mode", env, [os.path.join(samba3srcdir, "script/tests/test_force_create_mode.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', env, smbclient3]) >+ plantestsuite("samba3.blackbox.dropbox", env, [os.path.join(samba3srcdir, "script/tests/test_dropbox.sh"), '$SERVER', '$DOMAIN', 'gooduser', '$PASSWORD', '$PREFIX', smbclient3]) > plantestsuite("samba3.blackbox.offline", env, [os.path.join(samba3srcdir, "script/tests/test_offline.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/offline', smbclient3]) > plantestsuite("samba3.blackbox.shadow_copy2.NT1", env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'NT1']) > plantestsuite("samba3.blackbox.shadow_copy2.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'SMB3']) >-- >2.25.0 > > >From f856fb3d781fd65b250f7bc76478c832e9f69e23 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Fri, 14 Feb 2020 17:50:39 +0100 >Subject: [PATCH 3/3] SQ Don't cd into the directory > >--- > source3/script/tests/test_dropbox.sh | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > >diff --git a/source3/script/tests/test_dropbox.sh b/source3/script/tests/test_dropbox.sh >index dd1267c9325..474a40f9d7b 100755 >--- a/source3/script/tests/test_dropbox.sh >+++ b/source3/script/tests/test_dropbox.sh >@@ -42,8 +42,7 @@ test_dropbox() > > cat > $tmpfile <<EOF > lcd $PREFIX >-cd dirmode733 >-put $filename >+put $filename dirmode733/$filename > quit > EOF > >-- >2.25.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 14279
:
15788
|
15789
| 15790