[NPFS]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 4 Dec 2010 15:25:27 +0000 (15:25 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 4 Dec 2010 15:25:27 +0000 (15:25 +0000)
- Fail attempts to connect or disconnect a directory or device.
- Fail attempts to connect or disconnect a pipe by the client.

svn path=/trunk/; revision=49948

reactos/drivers/filesystems/npfs/fsctrl.c

index 9055bb1..decae59 100644 (file)
@@ -95,6 +95,20 @@ NpfsConnectPipe(PIRP Irp,
 
     DPRINT("NpfsConnectPipe()\n");
 
 
     DPRINT("NpfsConnectPipe()\n");
 
+    /* Fail, if the CCB is not a pipe CCB */
+    if (Ccb->Type != CCB_PIPE)
+    {
+        DPRINT1("Not a pipe\n");
+        return STATUS_ILLEGAL_FUNCTION;
+    }
+
+    /* Fail, if the CCB is not a server end CCB */
+    if (Ccb->PipeEnd != FILE_PIPE_SERVER_END)
+    {
+        DPRINT1("Not the server end\n");
+        return STATUS_ILLEGAL_FUNCTION;
+    }
+
     if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
     {
         KeResetEvent(&Ccb->ConnectEvent);
     if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE)
     {
         KeResetEvent(&Ccb->ConnectEvent);
@@ -192,6 +206,20 @@ NpfsDisconnectPipe(PNPFS_CCB Ccb)
 
     DPRINT("NpfsDisconnectPipe()\n");
 
 
     DPRINT("NpfsDisconnectPipe()\n");
 
+    /* Fail, if the CCB is not a pipe CCB */
+    if (Ccb->Type != CCB_PIPE)
+    {
+        DPRINT1("Not a pipe\n");
+        return STATUS_ILLEGAL_FUNCTION;
+    }
+
+    /* Fail, if the CCB is not a server end CCB */
+    if (Ccb->PipeEnd != FILE_PIPE_SERVER_END)
+    {
+        DPRINT1("Not the server end\n");
+        return STATUS_ILLEGAL_FUNCTION;
+    }
+
     Fcb = Ccb->Fcb;
     KeLockMutex(&Fcb->CcbListLock);
 
     Fcb = Ccb->Fcb;
     KeLockMutex(&Fcb->CcbListLock);