From b451846efb5aab20d0791e000cc7de771b65b2c1 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 8 Sep 2004 11:42:56 +0000 Subject: [PATCH] Add support for setting a security descriptor for a file. Send an 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 | 47 ++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/reactos/ntoskrnl/io/iomgr.c b/reactos/ntoskrnl/io/iomgr.c index 36eaa7f18be..35c112054b8 100644 --- a/reactos/ntoskrnl/io/iomgr.c +++ b/reactos/ntoskrnl/io/iomgr.c @@ -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: