- Implement ObAssignSecurity().
svn path=/trunk/; revision=10253
PSECURITY_DESCRIPTOR SecurityDescriptor,
PULONG BufferLength)
{
- DPRINT1 ("CmiObjectSecurity() called\n");
+ DPRINT("CmiObjectSecurity() called\n");
- return STATUS_SUCCESS;
+ switch (OperationCode)
+ {
+ case SetSecurityDescriptor:
+ DPRINT("Set security descriptor\n");
+ return STATUS_SUCCESS;
+
+ case QuerySecurityDescriptor:
+ DPRINT("Query security descriptor\n");
+ return STATUS_UNSUCCESSFUL;
+
+ case DeleteSecurityDescriptor:
+ DPRINT("Delete security descriptor\n");
+ return STATUS_SUCCESS;
+
+ case AssignSecurityDescriptor:
+ DPRINT("Assign security descriptor\n");
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_UNSUCCESSFUL;
}
-/* $Id: iomgr.c,v 1.48 2004/05/09 15:02:07 hbirr Exp $
+/* $Id: iomgr.c,v 1.49 2004/07/22 18:36:35 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
}
+NTSTATUS STDCALL
+IopSecurityFile(PVOID ObjectBody,
+ SECURITY_OPERATION_CODE OperationCode,
+ SECURITY_INFORMATION SecurityInformation,
+ PSECURITY_DESCRIPTOR SecurityDescriptor,
+ PULONG BufferLength)
+{
+ DPRINT("IopSecurityFile() called\n");
+
+ switch (OperationCode)
+ {
+ case SetSecurityDescriptor:
+ DPRINT("Set security descriptor\n");
+ return STATUS_SUCCESS;
+
+ case QuerySecurityDescriptor:
+ DPRINT("Query security descriptor\n");
+ return STATUS_UNSUCCESSFUL;
+
+ case DeleteSecurityDescriptor:
+ DPRINT("Delete security descriptor\n");
+ return STATUS_SUCCESS;
+
+ case AssignSecurityDescriptor:
+ DPRINT("Assign security descriptor\n");
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_UNSUCCESSFUL;
+}
+
+
NTSTATUS STDCALL
IopQueryNameFile(PVOID ObjectBody,
POBJECT_NAME_INFORMATION ObjectNameInfo,
IoFileObjectType->Close = IopCloseFile;
IoFileObjectType->Delete = IopDeleteFile;
IoFileObjectType->Parse = NULL;
- IoFileObjectType->Security = NULL;
+ IoFileObjectType->Security = IopSecurityFile;
IoFileObjectType->QueryName = IopQueryNameFile;
IoFileObjectType->OkayToClose = NULL;
IoFileObjectType->Create = IopCreateFile;
-/* $Id: object.c,v 1.80 2004/07/19 12:48:59 ekohl Exp $
+/* $Id: object.c,v 1.81 2004/07/22 18:38:08 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
if (!NT_SUCCESS(Status))
{
DPRINT("ObFindObject() failed! (Status 0x%x)\n", Status);
- return(Status);
+ return Status;
}
}
else
RtlFreeUnicodeString(&Header->Name);
RtlFreeUnicodeString(&RemainingPath);
ExFreePool(Header);
- return(Status);
+ return Status;
}
}
RtlFreeUnicodeString(&RemainingPath);
if (Header->ObjectType->Security != NULL)
{
- /* FIXME: Call the security method */
+ /* Call the security method */
+ Status = Header->ObjectType->Security(HEADER_TO_BODY(Header),
+ AssignSecurityDescriptor,
+ 0,
+ NewSecurityDescriptor,
+ NULL);
+#if 0
Status = STATUS_SUCCESS;
+#endif
}
else
{
*Object = HEADER_TO_BODY(Header);
}
- return(STATUS_SUCCESS);
+ return STATUS_SUCCESS;
}
/* FUNCTIONS ***************************************************************/
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS STDCALL
ObAssignSecurity(IN PACCESS_STATE AccessState,
IN PVOID Object,
IN POBJECT_TYPE Type)
{
- UNIMPLEMENTED;
- return(STATUS_NOT_IMPLEMENTED);
+ PSECURITY_DESCRIPTOR NewDescriptor;
+ NTSTATUS Status;
+
+ /* Build the new security descriptor */
+ Status = SeAssignSecurity(SecurityDescriptor,
+ AccessState->SecurityDescriptor,
+ &NewDescriptor,
+ (Type == ObDirectoryType),
+ &AccessState->SubjectSecurityContext,
+ Type->Mapping,
+ PagedPool);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ if (Type->Security != NULL)
+ {
+ /* Call the security method */
+ Status = Type->Security(Object,
+ AssignSecurityDescriptor,
+ 0,
+ NewDescriptor,
+ NULL);
+ }
+ else
+ {
+ /* Assign the security descriptor to the object header */
+ Status = ObpAddSecurityDescriptor(NewDescriptor,
+ &(BODY_TO_HEADER(Object)->SecurityDescriptor));
+ }
+
+ /* Release the new security descriptor */
+ SeDeassignSecurity(&NewDescriptor);
+
+ return Status;
}