mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[LSASRV] LsarLookupSids: Return proper domain information for nameless domains
This commit is contained in:
parent
96692636e4
commit
17864b49e3
1 changed files with 70 additions and 6 deletions
|
@ -940,6 +940,57 @@ LsapAddDomainToDomainsList(PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
|
|||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
LsapAddAuthorityToDomainsList(
|
||||
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
|
||||
PSID Sid,
|
||||
PULONG Index)
|
||||
{
|
||||
SID AuthoritySid;
|
||||
ULONG i;
|
||||
|
||||
RtlInitializeSid(&AuthoritySid,
|
||||
RtlIdentifierAuthoritySid(Sid),
|
||||
0);
|
||||
|
||||
i = 0;
|
||||
while (i < ReferencedDomains->Entries &&
|
||||
ReferencedDomains->Domains[i].Sid != NULL)
|
||||
{
|
||||
if (RtlEqualSid(&AuthoritySid, ReferencedDomains->Domains[i].Sid))
|
||||
{
|
||||
*Index = i;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
ReferencedDomains->Domains[i].Sid = MIDL_user_allocate(RtlLengthSid(&AuthoritySid));
|
||||
if (ReferencedDomains->Domains[i].Sid == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
RtlCopySid(RtlLengthSid(&AuthoritySid), ReferencedDomains->Domains[i].Sid, &AuthoritySid);
|
||||
|
||||
ReferencedDomains->Domains[i].Name.Length = 0;
|
||||
ReferencedDomains->Domains[i].Name.MaximumLength = sizeof(WCHAR);
|
||||
ReferencedDomains->Domains[i].Name.Buffer = MIDL_user_allocate(sizeof(WCHAR));
|
||||
if (ReferencedDomains->Domains[i].Name.Buffer == NULL)
|
||||
{
|
||||
MIDL_user_free(ReferencedDomains->Domains[i].Sid);
|
||||
ReferencedDomains->Domains[i].Sid = NULL;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
ReferencedDomains->Domains[i].Name.Buffer[0] = UNICODE_NULL;
|
||||
|
||||
ReferencedDomains->Entries++;
|
||||
*Index = i;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN
|
||||
LsapIsPrefixSid(IN PSID PrefixSid,
|
||||
IN PSID Sid)
|
||||
|
@ -2033,6 +2084,18 @@ LsapLookupWellKnownSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
|||
|
||||
RtlCopyMemory(NamesBuffer[i].Name.Buffer, ptr->AccountName.Buffer, ptr->AccountName.MaximumLength);
|
||||
|
||||
if (ptr->DomainName.Length == 0)
|
||||
{
|
||||
Status = LsapAddAuthorityToDomainsList(DomainsBuffer,
|
||||
SidEnumBuffer->SidInfo[i].Sid,
|
||||
&DomainIndex);
|
||||
if (!NT_SUCCESS(Status))
|
||||
goto done;
|
||||
|
||||
NamesBuffer[i].DomainIndex = DomainIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName);
|
||||
if (ptr2 != NULL)
|
||||
{
|
||||
|
@ -2045,6 +2108,7 @@ LsapLookupWellKnownSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
|||
|
||||
NamesBuffer[i].DomainIndex = DomainIndex;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue