Author: ekohl
Date: Thu Jan 17 22:05:37 2013
New Revision: 58187
URL:
http://svn.reactos.org/svn/reactos?rev=58187&view=rev
Log:
[SAMSRV]
Fix SamrRemoveMemberFromGroup.
Modified:
trunk/reactos/dll/win32/samsrv/group.c
trunk/reactos/dll/win32/samsrv/user.c
Modified: trunk/reactos/dll/win32/samsrv/group.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/group.c?r…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/group.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/group.c [iso-8859-1] Thu Jan 17 22:05:37 2013
@@ -90,17 +90,14 @@
ULONG i;
NTSTATUS Status;
- Status = SampGetObjectAttribute(GroupObject,
- L"Members",
- NULL,
- NULL,
- &Length);
+ SampGetObjectAttribute(GroupObject,
+ L"Members",
+ NULL,
+ NULL,
+ &Length);
- if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
+ if (Length == 0)
return STATUS_MEMBER_NOT_IN_GROUP;
-
- if (!NT_SUCCESS(Status))
- return Status;
MembersBuffer = midl_user_allocate(Length);
if (MembersBuffer == NULL)
@@ -126,12 +123,15 @@
{
Length -= sizeof(ULONG);
Status = STATUS_SUCCESS;
+
+ if (MembersCount - i - 1 > 0)
+ {
+ CopyMemory(&MembersBuffer[i],
+ &MembersBuffer[i + 1],
+ (MembersCount - i - 1) * sizeof(ULONG));
+ }
+
break;
- }
-
- if (Status == STATUS_SUCCESS && i < MembersCount - 1)
- {
- MembersBuffer[i] = MembersBuffer[i + 1];
}
}
Modified: trunk/reactos/dll/win32/samsrv/user.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/user.c?re…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/user.c [iso-8859-1] Thu Jan 17 22:05:37 2013
@@ -117,22 +117,19 @@
ULONG GroupsCount = 0;
ULONG Length = 0;
ULONG i;
- NTSTATUS Status;
+ NTSTATUS Status = STATUS_SUCCESS;
TRACE("(%p %lu)\n",
UserObject, GroupId);
- Status = SampGetObjectAttribute(UserObject,
- L"Groups",
- NULL,
- NULL,
- &Length);
-
- if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
+ SampGetObjectAttribute(UserObject,
+ L"Groups",
+ NULL,
+ NULL,
+ &Length);
+
+ if (Length == 0)
return STATUS_MEMBER_NOT_IN_GROUP;
-
- if (!NT_SUCCESS(Status))
- return Status;
GroupsBuffer = midl_user_allocate(Length);
if (GroupsBuffer == NULL)
@@ -158,14 +155,15 @@
{
Length -= sizeof(GROUP_MEMBERSHIP);
Status = STATUS_SUCCESS;
+
+ if (GroupsCount - i - 1 > 0)
+ {
+ CopyMemory(&GroupsBuffer[i],
+ &GroupsBuffer[i + 1],
+ (GroupsCount - i - 1) * sizeof(GROUP_MEMBERSHIP));
+ }
+
break;
- }
-
- if (Status == STATUS_SUCCESS && i < GroupsCount - 1)
- {
- CopyMemory(&GroupsBuffer[i],
- &GroupsBuffer[i + 1],
- sizeof(GROUP_MEMBERSHIP));
}
}