mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 01:40:36 +00:00
[SAMSRV]
Implement SamrSetMemberAttributesOfGroup. svn path=/trunk/; revision=58176
This commit is contained in:
parent
813f23e2bd
commit
6b883db864
3 changed files with 102 additions and 6 deletions
|
@ -4158,8 +4158,30 @@ SamrSetMemberAttributesOfGroup(IN SAMPR_HANDLE GroupHandle,
|
||||||
IN unsigned long MemberId,
|
IN unsigned long MemberId,
|
||||||
IN unsigned long Attributes)
|
IN unsigned long Attributes)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
PSAM_DB_OBJECT GroupObject;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Validate the group handle */
|
||||||
|
Status = SampValidateDbObject(GroupHandle,
|
||||||
|
SamDbGroupObject,
|
||||||
|
GROUP_ADD_MEMBER,
|
||||||
|
&GroupObject);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
TRACE("SampValidateDbObject failed with status 0x%08lx\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = SampSetUserGroupAttributes(GroupObject->ParentObject,
|
||||||
|
MemberId,
|
||||||
|
GroupObject->RelativeId,
|
||||||
|
Attributes);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
TRACE("SampSetUserGroupAttributes failed with status 0x%08lx\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -285,4 +285,10 @@ SampGetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject,
|
||||||
IN ULONG GroupId,
|
IN ULONG GroupId,
|
||||||
OUT PULONG GroupAttributes);
|
OUT PULONG GroupAttributes);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
SampSetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject,
|
||||||
|
IN ULONG UserId,
|
||||||
|
IN ULONG GroupId,
|
||||||
|
IN ULONG GroupAttributes);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -214,10 +214,7 @@ SampGetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject,
|
||||||
&Length);
|
&Length);
|
||||||
|
|
||||||
if (Length == 0)
|
if (Length == 0)
|
||||||
{
|
return STATUS_UNSUCCESSFUL; /* FIXME */
|
||||||
*GroupAttributes = 0;
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupsBuffer = midl_user_allocate(Length);
|
GroupsBuffer = midl_user_allocate(Length);
|
||||||
if (GroupsBuffer == NULL)
|
if (GroupsBuffer == NULL)
|
||||||
|
@ -253,4 +250,75 @@ done:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
SampSetUserGroupAttributes(IN PSAM_DB_OBJECT DomainObject,
|
||||||
|
IN ULONG UserId,
|
||||||
|
IN ULONG GroupId,
|
||||||
|
IN ULONG GroupAttributes)
|
||||||
|
{
|
||||||
|
PSAM_DB_OBJECT UserObject = NULL;
|
||||||
|
PGROUP_MEMBERSHIP GroupsBuffer = NULL;
|
||||||
|
ULONG Length = 0;
|
||||||
|
ULONG i;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = SampOpenUserObject(DomainObject,
|
||||||
|
UserId,
|
||||||
|
0,
|
||||||
|
&UserObject);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
SampGetObjectAttribute(UserObject,
|
||||||
|
L"Groups",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&Length);
|
||||||
|
|
||||||
|
if (Length == 0)
|
||||||
|
return STATUS_UNSUCCESSFUL; /* FIXME */
|
||||||
|
|
||||||
|
GroupsBuffer = midl_user_allocate(Length);
|
||||||
|
if (GroupsBuffer == NULL)
|
||||||
|
{
|
||||||
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = SampGetObjectAttribute(UserObject,
|
||||||
|
L"Groups",
|
||||||
|
NULL,
|
||||||
|
GroupsBuffer,
|
||||||
|
&Length);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
for (i = 0; i < (Length / sizeof(GROUP_MEMBERSHIP)); i++)
|
||||||
|
{
|
||||||
|
if (GroupsBuffer[i].RelativeId == GroupId)
|
||||||
|
{
|
||||||
|
GroupsBuffer[i].Attributes = GroupAttributes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = SampSetObjectAttribute(UserObject,
|
||||||
|
L"Groups",
|
||||||
|
REG_BINARY,
|
||||||
|
GroupsBuffer,
|
||||||
|
Length);
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (GroupsBuffer != NULL)
|
||||||
|
midl_user_free(GroupsBuffer);
|
||||||
|
|
||||||
|
if (UserObject != NULL)
|
||||||
|
SampCloseDbObject(UserObject);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue