mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
[NETAPI32]
Implement NetLocalGroupDelMember and NetLocalGroupDelMembers (level 0 only). svn path=/trunk/; revision=59192
This commit is contained in:
parent
044ead4a8f
commit
2370b46e6f
1 changed files with 136 additions and 6 deletions
|
@ -648,29 +648,159 @@ done:
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* NetLocalGroupDelMember (NETAPI32.@)
|
* NetLocalGroupDelMember (NETAPI32.@)
|
||||||
*/
|
*/
|
||||||
NET_API_STATUS WINAPI NetLocalGroupDelMember(
|
NET_API_STATUS
|
||||||
|
WINAPI
|
||||||
|
NetLocalGroupDelMember(
|
||||||
LPCWSTR servername,
|
LPCWSTR servername,
|
||||||
LPCWSTR groupname,
|
LPCWSTR groupname,
|
||||||
PSID membersid)
|
PSID membersid)
|
||||||
{
|
{
|
||||||
FIXME("(%s %s %p) stub!\n", debugstr_w(servername),
|
LOCALGROUP_MEMBERS_INFO_0 Member;
|
||||||
|
|
||||||
|
TRACE("(%s %s %p)\n", debugstr_w(servername),
|
||||||
debugstr_w(groupname), membersid);
|
debugstr_w(groupname), membersid);
|
||||||
return NERR_Success;
|
|
||||||
|
Member.lgrmi0_sid = membersid;
|
||||||
|
|
||||||
|
return NetLocalGroupDelMembers(servername,
|
||||||
|
groupname,
|
||||||
|
0,
|
||||||
|
(LPBYTE)&Member,
|
||||||
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* NetLocalGroupDelMembers (NETAPI32.@)
|
* NetLocalGroupDelMembers (NETAPI32.@)
|
||||||
*/
|
*/
|
||||||
NET_API_STATUS WINAPI NetLocalGroupDelMembers(
|
NET_API_STATUS
|
||||||
|
WINAPI
|
||||||
|
NetLocalGroupDelMembers(
|
||||||
LPCWSTR servername,
|
LPCWSTR servername,
|
||||||
LPCWSTR groupname,
|
LPCWSTR groupname,
|
||||||
DWORD level,
|
DWORD level,
|
||||||
LPBYTE buf,
|
LPBYTE buf,
|
||||||
DWORD totalentries)
|
DWORD totalentries)
|
||||||
{
|
{
|
||||||
FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername),
|
UNICODE_STRING ServerName;
|
||||||
|
UNICODE_STRING AliasName;
|
||||||
|
SAM_HANDLE ServerHandle = NULL;
|
||||||
|
SAM_HANDLE DomainHandle = NULL;
|
||||||
|
SAM_HANDLE AliasHandle = NULL;
|
||||||
|
PLOCALGROUP_MEMBERS_INFO_0 MemberList = NULL;
|
||||||
|
ULONG i;
|
||||||
|
NET_API_STATUS ApiStatus = NERR_Success;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
TRACE("(%s %s %d %p %d)\n", debugstr_w(servername),
|
||||||
debugstr_w(groupname), level, buf, totalentries);
|
debugstr_w(groupname), level, buf, totalentries);
|
||||||
return NERR_Success;
|
|
||||||
|
if (servername != NULL)
|
||||||
|
RtlInitUnicodeString(&ServerName, servername);
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&AliasName, groupname);
|
||||||
|
|
||||||
|
switch (level)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
MemberList = (PLOCALGROUP_MEMBERS_INFO_0)buf;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
ApiStatus = ERROR_INVALID_LEVEL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Connect to the SAM Server */
|
||||||
|
Status = SamConnect((servername != NULL) ? &ServerName : NULL,
|
||||||
|
&ServerHandle,
|
||||||
|
SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("SamConnect failed (Status %08lx)\n", Status);
|
||||||
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the Builtin Domain */
|
||||||
|
Status = OpenBuiltinDomain(ServerHandle,
|
||||||
|
DOMAIN_LOOKUP,
|
||||||
|
&DomainHandle);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||||
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the alias account in the builtin domain */
|
||||||
|
ApiStatus = OpenAliasByName(DomainHandle,
|
||||||
|
&AliasName,
|
||||||
|
ALIAS_REMOVE_MEMBER,
|
||||||
|
&AliasHandle);
|
||||||
|
if (ApiStatus != NERR_Success && ApiStatus != ERROR_NONE_MAPPED)
|
||||||
|
{
|
||||||
|
ERR("OpenAliasByName failed (ApiStatus %lu)\n", ApiStatus);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AliasHandle == NULL)
|
||||||
|
{
|
||||||
|
if (DomainHandle != NULL)
|
||||||
|
SamCloseHandle(DomainHandle);
|
||||||
|
|
||||||
|
/* Open the Acount Domain */
|
||||||
|
Status = OpenAccountDomain(ServerHandle,
|
||||||
|
(servername != NULL) ? &ServerName : NULL,
|
||||||
|
DOMAIN_LOOKUP,
|
||||||
|
&DomainHandle);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||||
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the alias account in the account domain */
|
||||||
|
ApiStatus = OpenAliasByName(DomainHandle,
|
||||||
|
&AliasName,
|
||||||
|
ALIAS_REMOVE_MEMBER,
|
||||||
|
&AliasHandle);
|
||||||
|
if (ApiStatus != NERR_Success)
|
||||||
|
{
|
||||||
|
ERR("OpenAliasByName failed (ApiStatus %lu)\n", ApiStatus);
|
||||||
|
if (ApiStatus == ERROR_NONE_MAPPED)
|
||||||
|
ApiStatus = NERR_GroupNotFound;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove members from the alias */
|
||||||
|
for (i = 0; i < totalentries; i++)
|
||||||
|
{
|
||||||
|
Status = SamRemoveMemberFromAlias(AliasHandle,
|
||||||
|
MemberList[i].lgrmi0_sid);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("SamAddMemberToAlias failed (Status %lu)\n", Status);
|
||||||
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (AliasHandle != NULL)
|
||||||
|
SamCloseHandle(AliasHandle);
|
||||||
|
|
||||||
|
if (DomainHandle != NULL)
|
||||||
|
SamCloseHandle(DomainHandle);
|
||||||
|
|
||||||
|
if (ServerHandle != NULL)
|
||||||
|
SamCloseHandle(ServerHandle);
|
||||||
|
|
||||||
|
return ApiStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue