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
|
static BOOLEAN
|
||||||
LsapIsPrefixSid(IN PSID PrefixSid,
|
LsapIsPrefixSid(IN PSID PrefixSid,
|
||||||
IN PSID Sid)
|
IN PSID Sid)
|
||||||
|
@ -2033,18 +2084,31 @@ LsapLookupWellKnownSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
||||||
|
|
||||||
RtlCopyMemory(NamesBuffer[i].Name.Buffer, ptr->AccountName.Buffer, ptr->AccountName.MaximumLength);
|
RtlCopyMemory(NamesBuffer[i].Name.Buffer, ptr->AccountName.Buffer, ptr->AccountName.MaximumLength);
|
||||||
|
|
||||||
ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName);
|
if (ptr->DomainName.Length == 0)
|
||||||
if (ptr2 != NULL)
|
|
||||||
{
|
{
|
||||||
Status = LsapAddDomainToDomainsList(DomainsBuffer,
|
Status = LsapAddAuthorityToDomainsList(DomainsBuffer,
|
||||||
&ptr2->AccountName,
|
SidEnumBuffer->SidInfo[i].Sid,
|
||||||
ptr2->Sid,
|
&DomainIndex);
|
||||||
&DomainIndex);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
NamesBuffer[i].DomainIndex = DomainIndex;
|
NamesBuffer[i].DomainIndex = DomainIndex;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName);
|
||||||
|
if (ptr2 != NULL)
|
||||||
|
{
|
||||||
|
Status = LsapAddDomainToDomainsList(DomainsBuffer,
|
||||||
|
&ptr2->AccountName,
|
||||||
|
ptr2->Sid,
|
||||||
|
&DomainIndex);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
NamesBuffer[i].DomainIndex = DomainIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name);
|
TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue