mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:12:57 +00:00
Implement most simple code path of SeAssignSecurity().
svn path=/trunk/; revision=10193
This commit is contained in:
parent
9ba0b83e50
commit
9e08323787
1 changed files with 47 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: semgr.c,v 1.33 2004/07/14 14:25:31 ekohl Exp $
|
/* $Id: semgr.c,v 1.34 2004/07/18 13:02:28 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -322,31 +322,65 @@ SepInheritAcl(PACL Acl,
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,
|
SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL,
|
||||||
PSECURITY_DESCRIPTOR ExplicitDescriptor,
|
PSECURITY_DESCRIPTOR ExplicitDescriptor OPTIONAL,
|
||||||
PSECURITY_DESCRIPTOR* NewDescriptor,
|
PSECURITY_DESCRIPTOR *NewDescriptor,
|
||||||
BOOLEAN IsDirectoryObject,
|
BOOLEAN IsDirectoryObject,
|
||||||
PSECURITY_SUBJECT_CONTEXT SubjectContext,
|
PSECURITY_SUBJECT_CONTEXT SubjectContext,
|
||||||
PGENERIC_MAPPING GenericMapping,
|
PGENERIC_MAPPING GenericMapping,
|
||||||
POOL_TYPE PoolType)
|
POOL_TYPE PoolType)
|
||||||
{
|
{
|
||||||
|
PSECURITY_DESCRIPTOR Descriptor;
|
||||||
|
ULONG Length;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
if (ExplicitDescriptor != NULL)
|
||||||
|
{
|
||||||
|
Length = RtlLengthSecurityDescriptor(ExplicitDescriptor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("No explicit security descriptor\n");
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Descriptor = ExAllocatePool(NonPagedPool,
|
||||||
|
Length);
|
||||||
|
if (Descriptor == NULL)
|
||||||
|
{
|
||||||
|
DPRINT1("ExAlloctePool() failed\n");
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = RtlMakeSelfRelativeSD(ExplicitDescriptor,
|
||||||
|
Descriptor,
|
||||||
|
&Length);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("RtlMakeSelfRelativeSD() failed (Status %lx)\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
*NewDescriptor = Descriptor;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
PSECURITY_DESCRIPTOR Descriptor;
|
|
||||||
PSID Owner;
|
PSID Owner;
|
||||||
PSID PrimaryGroup;
|
PSID PrimaryGroup;
|
||||||
PACL DefaultDacl;
|
PACL DefaultDacl;
|
||||||
PSID ProcessOwner;
|
PSID ProcessOwner;
|
||||||
PSID ProcessPrimaryGroup;
|
PSID ProcessPrimaryGroup;
|
||||||
PACL Sacl;
|
PACL Sacl;
|
||||||
|
|
||||||
if (ExplicitDescriptor == NULL)
|
if (ExplicitDescriptor == NULL)
|
||||||
{
|
{
|
||||||
RtlCreateSecurityDescriptor(&Descriptor, 1);
|
RtlCreateSecurityDescriptor(&Descriptor, 1);
|
||||||
|
@ -355,19 +389,23 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,
|
||||||
{
|
{
|
||||||
Descriptor = ExplicitDescriptor;
|
Descriptor = ExplicitDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
SeLockSubjectContext(SubjectContext);
|
SeLockSubjectContext(SubjectContext);
|
||||||
|
|
||||||
SepGetDefaultsSubjectContext(SubjectContext,
|
SepGetDefaultsSubjectContext(SubjectContext,
|
||||||
&Owner,
|
&Owner,
|
||||||
&PrimaryGroup,
|
&PrimaryGroup,
|
||||||
&DefaultDacl,
|
&DefaultDacl,
|
||||||
&ProcessOwner,
|
&ProcessOwner,
|
||||||
&ProcessPrimaryGroup);
|
&ProcessPrimaryGroup);
|
||||||
|
|
||||||
if (Descriptor->Control & SE_SACL_PRESENT ||
|
if (Descriptor->Control & SE_SACL_PRESENT ||
|
||||||
Descriptor->Control & SE_SACL_DEFAULTED)
|
Descriptor->Control & SE_SACL_DEFAULTED)
|
||||||
{
|
{
|
||||||
if (ParentDescriptor == NULL)
|
if (ParentDescriptor == NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Descriptor->Control & SE_SACL_PRESENT ||
|
if (Descriptor->Control & SE_SACL_PRESENT ||
|
||||||
Descriptor->Sacl == NULL ||)
|
Descriptor->Sacl == NULL ||)
|
||||||
{
|
{
|
||||||
|
@ -378,9 +416,10 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,
|
||||||
Sacl = Descriptor->Sacl;
|
Sacl = Descriptor->Sacl;
|
||||||
if (Descriptor->Control & SE_SELF_RELATIVE)
|
if (Descriptor->Control & SE_SELF_RELATIVE)
|
||||||
{
|
{
|
||||||
Sacl = (PACL)(((PVOID)Sacl) + (PVOID)Descriptor);
|
Sacl = (PACL)(((ULONG_PTR)Sacl) + (ULONG_PTR)Descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SepInheritAcl(Sacl,
|
SepInheritAcl(Sacl,
|
||||||
IsDirectoryObject,
|
IsDirectoryObject,
|
||||||
Owner,
|
Owner,
|
||||||
|
@ -389,9 +428,6 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,
|
||||||
ProcessOwner,
|
ProcessOwner,
|
||||||
GenericMapping);
|
GenericMapping);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return(STATUS_NOT_IMPLEMENTED);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue