mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
[NETAPI32]
Use servername in NetLocalGroupEnum and NetUserEnum. svn path=/trunk/; revision=57994
This commit is contained in:
parent
9403cc412f
commit
4b858fe42a
4 changed files with 21 additions and 9 deletions
|
@ -150,6 +150,7 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
|||
LPDWORD totalentries,
|
||||
PDWORD_PTR resumehandle)
|
||||
{
|
||||
UNICODE_STRING ServerName;
|
||||
PSAM_RID_ENUMERATION CurrentAlias;
|
||||
PENUM_CONTEXT EnumContext = NULL;
|
||||
PSID DomainSid = NULL;
|
||||
|
@ -171,6 +172,9 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
|||
*totalentries = 0;
|
||||
*bufptr = NULL;
|
||||
|
||||
if (servername != NULL)
|
||||
RtlInitUnicodeString(&ServerName, servername);
|
||||
|
||||
if (resumehandle != NULL && *resumehandle != 0)
|
||||
{
|
||||
EnumContext = (PENUM_CONTEXT)*resumehandle;
|
||||
|
@ -187,7 +191,7 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
|||
EnumContext->Index = 0;
|
||||
EnumContext->BuiltinDone = FALSE;
|
||||
|
||||
Status = SamConnect(NULL,
|
||||
Status = SamConnect((servername != NULL) ? &ServerName : NULL,
|
||||
&EnumContext->ServerHandle,
|
||||
SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN,
|
||||
NULL);
|
||||
|
@ -198,7 +202,8 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
|||
goto done;
|
||||
}
|
||||
|
||||
Status = GetAccountDomainSid(&DomainSid);
|
||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
||||
&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
|
|
|
@ -37,7 +37,8 @@ static SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
|
|||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
GetAccountDomainSid(PSID *AccountDomainSid)
|
||||
GetAccountDomainSid(IN PUNICODE_STRING ServerName,
|
||||
OUT PSID *AccountDomainSid)
|
||||
{
|
||||
PPOLICY_ACCOUNT_DOMAIN_INFO AccountDomainInfo = NULL;
|
||||
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
|
@ -47,7 +48,7 @@ GetAccountDomainSid(PSID *AccountDomainSid)
|
|||
|
||||
memset(&ObjectAttributes, 0, sizeof(LSA_OBJECT_ATTRIBUTES));
|
||||
|
||||
Status = LsaOpenPolicy(NULL,
|
||||
Status = LsaOpenPolicy(ServerName,
|
||||
&ObjectAttributes,
|
||||
POLICY_VIEW_LOCAL_INFORMATION,
|
||||
&PolicyHandle);
|
||||
|
@ -89,7 +90,7 @@ done:
|
|||
|
||||
|
||||
NTSTATUS
|
||||
GetBuiltinDomainSid(PSID *BuiltinDomainSid)
|
||||
GetBuiltinDomainSid(OUT PSID *BuiltinDomainSid)
|
||||
{
|
||||
PSID Sid = NULL;
|
||||
PULONG Ptr;
|
||||
|
|
|
@ -9,9 +9,10 @@ NetpNtStatusToApiStatus(NTSTATUS Status);
|
|||
/* misc.c */
|
||||
|
||||
NTSTATUS
|
||||
GetAccountDomainSid(PSID *AccountDomainSid);
|
||||
GetAccountDomainSid(IN PUNICODE_STRING ServerName,
|
||||
OUT PSID *AccountDomainSid);
|
||||
|
||||
NTSTATUS
|
||||
GetBuiltinDomainSid(PSID *BuiltinDomainSid);
|
||||
GetBuiltinDomainSid(OUT PSID *BuiltinDomainSid);
|
||||
|
||||
#endif
|
|
@ -321,6 +321,7 @@ NetUserEnum(LPCWSTR servername,
|
|||
LPDWORD totalentries,
|
||||
LPDWORD resume_handle)
|
||||
{
|
||||
UNICODE_STRING ServerName;
|
||||
PSAM_RID_ENUMERATION CurrentUser;
|
||||
PENUM_CONTEXT EnumContext = NULL;
|
||||
LPVOID Buffer = NULL;
|
||||
|
@ -346,6 +347,9 @@ NetUserEnum(LPCWSTR servername,
|
|||
*totalentries = 0;
|
||||
*bufptr = NULL;
|
||||
|
||||
if (servername != NULL)
|
||||
RtlInitUnicodeString(&ServerName, servername);
|
||||
|
||||
if (resume_handle != NULL && *resume_handle != 0)
|
||||
{
|
||||
EnumContext = (PENUM_CONTEXT)*resume_handle;
|
||||
|
@ -362,7 +366,7 @@ NetUserEnum(LPCWSTR servername,
|
|||
EnumContext->Index = 0;
|
||||
EnumContext->BuiltinDone = FALSE;
|
||||
|
||||
Status = SamConnect(NULL,
|
||||
Status = SamConnect((servername != NULL) ? &ServerName : NULL,
|
||||
&EnumContext->ServerHandle,
|
||||
SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN,
|
||||
NULL);
|
||||
|
@ -373,7 +377,8 @@ NetUserEnum(LPCWSTR servername,
|
|||
goto done;
|
||||
}
|
||||
|
||||
Status = GetAccountDomainSid(&DomainSid);
|
||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
||||
&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
|
|
Loading…
Reference in a new issue