Use servername in NetLocalGroupEnum and NetUserEnum.
svn path=/trunk/; revision=57994
LPDWORD totalentries,
PDWORD_PTR resumehandle)
{
+ UNICODE_STRING ServerName;
PSAM_RID_ENUMERATION CurrentAlias;
PENUM_CONTEXT EnumContext = NULL;
PSID DomainSid = NULL;
*totalentries = 0;
*bufptr = NULL;
+ if (servername != NULL)
+ RtlInitUnicodeString(&ServerName, servername);
+
if (resumehandle != NULL && *resumehandle != 0)
{
EnumContext = (PENUM_CONTEXT)*resumehandle;
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);
goto done;
}
- Status = GetAccountDomainSid(&DomainSid);
+ Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
+ &DomainSid);
if (!NT_SUCCESS(Status))
{
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
/* FUNCTIONS *****************************************************************/
NTSTATUS
-GetAccountDomainSid(PSID *AccountDomainSid)
+GetAccountDomainSid(IN PUNICODE_STRING ServerName,
+ OUT PSID *AccountDomainSid)
{
PPOLICY_ACCOUNT_DOMAIN_INFO AccountDomainInfo = NULL;
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
memset(&ObjectAttributes, 0, sizeof(LSA_OBJECT_ATTRIBUTES));
- Status = LsaOpenPolicy(NULL,
+ Status = LsaOpenPolicy(ServerName,
&ObjectAttributes,
POLICY_VIEW_LOCAL_INFORMATION,
&PolicyHandle);
NTSTATUS
-GetBuiltinDomainSid(PSID *BuiltinDomainSid)
+GetBuiltinDomainSid(OUT PSID *BuiltinDomainSid)
{
PSID Sid = NULL;
PULONG Ptr;
/* misc.c */
NTSTATUS
-GetAccountDomainSid(PSID *AccountDomainSid);
+GetAccountDomainSid(IN PUNICODE_STRING ServerName,
+ OUT PSID *AccountDomainSid);
NTSTATUS
-GetBuiltinDomainSid(PSID *BuiltinDomainSid);
+GetBuiltinDomainSid(OUT PSID *BuiltinDomainSid);
#endif
\ No newline at end of file
LPDWORD totalentries,
LPDWORD resume_handle)
{
+ UNICODE_STRING ServerName;
PSAM_RID_ENUMERATION CurrentUser;
PENUM_CONTEXT EnumContext = NULL;
LPVOID Buffer = NULL;
*totalentries = 0;
*bufptr = NULL;
+ if (servername != NULL)
+ RtlInitUnicodeString(&ServerName, servername);
+
if (resume_handle != NULL && *resume_handle != 0)
{
EnumContext = (PENUM_CONTEXT)*resume_handle;
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);
goto done;
}
- Status = GetAccountDomainSid(&DomainSid);
+ Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
+ &DomainSid);
if (!NT_SUCCESS(Status))
{
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);