server: Sharing 0 is not allowed for named pipes.
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 0f89f5b..66664bb 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -940,6 +940,12 @@
     struct unicode_str name;
     struct directory *root = NULL;
 
+    if (!req->sharing || (req->sharing & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)))
+    {
+        set_error( STATUS_INVALID_PARAMETER );
+        return;
+    }
+
     reply->handle = 0;
     get_req_unicode_str( &name );
     if (req->rootdir && !(root = get_directory_obj( current->process, req->rootdir, 0 )))