Add support for setting a security descriptor for a file. Send an
authorEric Kohl <eric.kohl@reactos.org>
Wed, 8 Sep 2004 11:42:56 +0000 (11:42 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 8 Sep 2004 11:42:56 +0000 (11:42 +0000)
IRP_MJ_SET_SECURITY to the filesystem driver and return
STATUS_SUCCESS if the filesystem driver does not support
this IRP.

svn path=/trunk/; revision=10804

reactos/ntoskrnl/io/iomgr.c

index 36eaa7f..35c1120 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: iomgr.c,v 1.51 2004/09/07 11:51:13 ekohl Exp $
+/* $Id: iomgr.c,v 1.52 2004/09/08 11:42:56 ekohl Exp $
  *
  * COPYRIGHT:            See COPYING in the top level directory
  * PROJECT:              ReactOS kernel
@@ -222,9 +222,40 @@ IopSecurityFile(PVOID ObjectBody,
     {
       case SetSecurityDescriptor:
        DPRINT("Set security descriptor\n");
-       return STATUS_SUCCESS;
+       KeResetEvent(&FileObject->Event);
+       Irp = IoBuildSynchronousFsdRequest(IRP_MJ_SET_SECURITY,
+                                          FileObject->DeviceObject,
+                                          NULL,
+                                          0,
+                                          NULL,
+                                          &FileObject->Event,
+                                          &IoStatusBlock);
+
+       StackPtr = IoGetNextIrpStackLocation(Irp);
+       StackPtr->FileObject = FileObject;
+
+       StackPtr->Parameters.SetSecurity.SecurityInformation = SecurityInformation;
+       StackPtr->Parameters.SetSecurity.SecurityDescriptor = SecurityDescriptor;
+
+       Status = IoCallDriver(FileObject->DeviceObject, Irp);
+       if (Status == STATUS_PENDING)
+         {
+           KeWaitForSingleObject(&FileObject->Event,
+                                 Executive,
+                                 KernelMode,
+                                 FALSE,
+                                 NULL);
+           Status = IoStatusBlock.Status;
+         }
+
+       if (Status == STATUS_INVALID_DEVICE_REQUEST)
+         {
+           Status = STATUS_SUCCESS;
+         }
+       return Status;
 
       case QuerySecurityDescriptor:
+       DPRINT("Query security descriptor\n");
        KeResetEvent(&FileObject->Event);
        Irp = IoBuildSynchronousFsdRequest(IRP_MJ_QUERY_SECURITY,
                                           FileObject->DeviceObject,
@@ -253,17 +284,17 @@ IopSecurityFile(PVOID ObjectBody,
            Status = IoStatusBlock.Status;
          }
 
-       if (Status == STATUS_BUFFER_TOO_SMALL)
-         {
-           /* FIXME: retrieve BufferLength */
-           *BufferLength = 0;
-         }
-       else if (Status == STATUS_INVALID_DEVICE_REQUEST)
+       if (Status == STATUS_INVALID_DEVICE_REQUEST)
          {
            Status = IopSetDefaultSecurityDescriptor(SecurityInformation,
                                                     SecurityDescriptor,
                                                     BufferLength);
          }
+       else
+         {
+           /* FIXME: Is this correct?? */
+           *BufferLength = IoStatusBlock.Information;
+         }
        return Status;
 
       case DeleteSecurityDescriptor: