From cc66d08f383381086d0688bf0681ac51fb8fba11 Mon Sep 17 00:00:00 2001 From: Jeremy Allison 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 --- 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 < $tmpfile < 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. Remove skip test for the DISABLE_OPATH case. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14816 Signed-off-by: Jeremy Allison --- 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.30.2