The Samba-Bugzilla – Attachment 16775 Details for
Bug 14816
smbd built with ‘-DDISABLE_OPATH=1’ will hang opening FIFO file in the samba share.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.14 and 4.15 cherry-picked from master
bug14816-v414,v415.patch (text/plain), 6.04 KB, created by
Ralph Böhme
on 2021-09-06 10:56:19 UTC
(
hide
)
Description:
Patch for 4.14 and 4.15 cherry-picked from master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2021-09-06 10:56:19 UTC
Size:
6.04 KB
patch
obsolete
>From 8bc606c98be09674107cfad01d38d966dcc3e32f Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 2 Sep 2021 15:32:27 -0700 >Subject: [PATCH 1/2] s3: smbd: Add fifo test for the DISABLE_OPATH case. > >Currently we hang when trying to list a directory >containing a fifo when configured with DISABLE_OPATH. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14816 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit a54d9ffc87ebe602a0e7c48e35643ed2ff1a00bc) >--- > selftest/skip.opath-required | 4 ++ > source3/script/tests/test_fifo.sh | 83 +++++++++++++++++++++++++++++++ > source3/selftest/tests.py | 3 ++ > 3 files changed, 90 insertions(+) > create mode 100755 source3/script/tests/test_fifo.sh > >diff --git a/selftest/skip.opath-required b/selftest/skip.opath-required >index 0faf0c4bd6c..c62d3ebd2e0 100644 >--- a/selftest/skip.opath-required >+++ b/selftest/skip.opath-required >@@ -7,3 +7,7 @@ > # These fail because become_root() doesn't work in make test > ^samba3.blackbox.dropbox.* > ^samba3.raw.samba3hide.* >+# This fails because of BUG: https://bugzilla.samba.org/show_bug.cgi?id=14816 >+# which causes the server to hang when trying to open a pathref fifo without O_PATH. >+# We need to add O_NONBLOCK to make this work. >+^samba3.blackbox.fifo >diff --git a/source3/script/tests/test_fifo.sh b/source3/script/tests/test_fifo.sh >new file mode 100755 >index 00000000000..11741dcc038 >--- /dev/null >+++ b/source3/script/tests/test_fifo.sh >@@ -0,0 +1,83 @@ >+#!/bin/sh >+# >+# Check smbclient can list a directory containing a fifo. >+# >+ >+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 that listing a share with a directory containing a fifo succeeds. >+# >+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=14816 >+# >+test_fifo() >+{ >+ local fifo_dir_path="$PREFIX/$TARGET_ENV/share/fifodir" >+ local fifo_path="$fifo_dir_path/fifo_name" >+ >+ local tmpfile=$PREFIX/smbclient.in.$$ >+ >+ cat > $tmpfile <<EOF >+cd fifodir >+ls >+quit >+EOF >+ >+ # Create fifo directory. >+ mkdir -p $fifo_dir_path >+ # Create fifo underneath. >+ mkfifo $fifo_path >+ >+ local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/$1 -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1' >+ eval echo "$cmd" >+ out=`eval $cmd` >+ ret=$? >+ >+ # Remove fifo and containing dir. >+ rm $fifo_path >+ rmdir $fifo_dir_path >+ rm -f $tmpfile >+ >+ # Check for smbclient error. >+ if [ $ret != 0 ] ; then >+ echo "Failed accessing share containing dir with fifo $ret" >+ echo "$out" >+ return 1 >+ fi >+ >+ # Check for smbclient timeout (server hung). >+ echo "$out" | grep 'NT_STATUS_' >+ ret=$? >+ if [ $ret -eq 0 ] ; then >+ # Client was disconnected as server timed out. >+ echo "$out" >+ return 1 >+ fi >+ >+ return 0 >+} >+ >+testit "list directory containing a fifo" \ >+ test_fifo tmp || failed=`expr $failed + 1` >+ >+exit $failed >diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py >index d7f383a0e05..dd573547a7b 100755 >--- a/source3/selftest/tests.py >+++ b/source3/selftest/tests.py >@@ -567,6 +567,9 @@ plantestsuite("samba3.blackbox.smbclient_s3.SMB3.crypt", env, [os.path.join(samb > '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode2', > '-d', 'smbclient_tar.SMB3', '-b', smbclient3, > '--subunit', '--', configuration, '-mSMB3']) >+ plantestsuite("samba3.blackbox.fifo", env, >+ [os.path.join(samba3srcdir, "script/tests/test_fifo.sh"), >+ '$SERVER', '$DOMAIN', 'gooduser', '$PASSWORD', '$PREFIX', env, smbclient3]) > > for env in ["fileserver:local"]: > plantestsuite("samba3.blackbox.net_usershare", env, [os.path.join(samba3srcdir, "script/tests/test_net_usershare.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbclient3]) >-- >2.31.1 > > >From 45c492719c6fa40798aea31c0eac07482a5b18bd Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 2 Sep 2021 14:40:53 -0700 >Subject: [PATCH 2/2] s3: smbd: Fix openat_pathref_fsp() to cope with FIFO's in > the filesystem. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Remove skip test for the DISABLE_OPATH case. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14816 >RN: Fix pathref open of a filesystem fifo in the DISABLE_OPATH build > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> > >Autobuild-User(master): Ralph Böhme <slow@samba.org> >Autobuild-Date(master): Mon Sep 6 09:51:54 UTC 2021 on sn-devel-184 > >(cherry picked from commit 2f2c53c4f8f59a497bc33a24e5e0fc15ea076876) >--- > selftest/skip.opath-required | 4 ---- > source3/smbd/files.c | 4 ++++ > 2 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/selftest/skip.opath-required b/selftest/skip.opath-required >index c62d3ebd2e0..0faf0c4bd6c 100644 >--- a/selftest/skip.opath-required >+++ b/selftest/skip.opath-required >@@ -7,7 +7,3 @@ > # These fail because become_root() doesn't work in make test > ^samba3.blackbox.dropbox.* > ^samba3.raw.samba3hide.* >-# This fails because of BUG: https://bugzilla.samba.org/show_bug.cgi?id=14816 >-# which causes the server to hang when trying to open a pathref fifo without O_PATH. >-# We need to add O_NONBLOCK to make this work. >-^samba3.blackbox.fifo >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index 413706fee0c..a2269d8da65 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -503,6 +503,10 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp, > } > } > >+ if (S_ISFIFO(smb_fname->st.st_ex_mode)) { >+ open_flags |= O_NONBLOCK; >+ } >+ > status = fd_openat(dirfsp, smb_fname, fsp, open_flags, 0); > if (!NT_STATUS_IS_OK(status)) { > if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND) || >-- >2.31.1 >
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
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 14816
:
16760
|
16761
| 16775