On Tue, Sep 03, 2002 at 09:47:54AM +0200, Kaj Mikkelsen
wrote:> Hi
>
> Even when you are not opening the pipe, but just listing it in cygwin, or
trying to see the properties in explorer, you will have this problem:
> Does anybody know how to disable named pipes in samba?
> Or how you can kill the connection from the client side?
> And no, setting "nt pipe support" to no, doesn't fix the
problem.
> /Kaj
>
>
> Symptom:
> Samba daemon hanging when trying to open a named pipe.
>
> Environment:
> Samba version 2.2.5
> RedHat 7.2
> Kernel 2.4.18 compiled with support for largefiles.
> Client is Win2000 sp 2
>
> How to reproduce:
>
> Unix side
> Go to your home directory (If it is exported by samba)
> make a named pipe: mkfifo .tst
>
> Window side.
> Open your homedirectory in explorer.
> Click on .tst
>
>
> Diagnostics on the samba server:
> ps -ef | grep smbd | grep <yourname>
> strace -p <PID of your smbd process>
>
> It should be hanging in an open statement
> open(".tst", O_RDONLY|O_LARGEFILE <unfinished ...>
The reason this happens now is that we used to open all
files with O_NONBLOCK, which would not block on a named
pipe open. We don't do that any more, but it is a simple
fix to make this happen for UNIX fifo's only.
Can you try this patch please :
Thanks,
Jeremy.
Index: smbd/open.c
==================================================================RCS file:
/data/cvs/samba/source/smbd/open.c,v
retrieving revision 1.62.4.56
diff -u -r1.62.4.56 open.c
--- smbd/open.c 30 Aug 2002 19:30:02 -0000 1.62.4.56
+++ smbd/open.c 3 Sep 2002 19:31:23 -0000
@@ -158,6 +158,16 @@
local_flags &= ~O_TRUNC;
+#if defined(O_NONBLOCK) && defined(S_ISFIFO)
+ /*
+ * We would block on opening a FIFO with no one else on the
+ * other end. Do what we used to do and add O_NONBLOCK to the
+ * open flags. JRA.
+ */
+
+ if (VALID_STAT(*psbuf) && S_ISFIFO(psbuf->st_mode))
+ local_flags |= O_NONBLOCK;
+#endif
fsp->fd = fd_open(conn, fname, local_flags, mode);
if (fsp->fd == -1) {