mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
[LSASRV]
LsapLookupNames: If a name was found, add its domain SID to the domains list and set the domain index accordingly. svn path=/trunk/; revision=57480
This commit is contained in:
parent
b4266b3394
commit
f6686c1c81
1 changed files with 72 additions and 13 deletions
|
@ -830,6 +830,54 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
LsapAddDomainToDomainsList(PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
|
||||||
|
PUNICODE_STRING Name,
|
||||||
|
PSID Sid,
|
||||||
|
PULONG Index)
|
||||||
|
{
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < ReferencedDomains->Entries &&
|
||||||
|
ReferencedDomains->Domains[i].Sid != NULL)
|
||||||
|
{
|
||||||
|
if (RtlEqualSid(Sid, ReferencedDomains->Domains[i].Sid))
|
||||||
|
{
|
||||||
|
*Index = i;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReferencedDomains->Domains[i].Sid = MIDL_user_allocate(RtlLengthSid(Sid));
|
||||||
|
if (ReferencedDomains->Domains[i].Sid == NULL)
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
RtlCopySid(RtlLengthSid(Sid), ReferencedDomains->Domains[i].Sid, Sid);
|
||||||
|
|
||||||
|
ReferencedDomains->Domains[i].Name.Length = Name->Length;
|
||||||
|
ReferencedDomains->Domains[i].Name.MaximumLength = Name->MaximumLength;
|
||||||
|
ReferencedDomains->Domains[i].Name.Buffer = MIDL_user_allocate(Name->MaximumLength);
|
||||||
|
if (ReferencedDomains->Domains[i].Sid == NULL)
|
||||||
|
{
|
||||||
|
MIDL_user_free(ReferencedDomains->Domains[i].Sid);
|
||||||
|
ReferencedDomains->Domains[i].Sid = NULL;
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlCopyMemory(ReferencedDomains->Domains[i].Name.Buffer,
|
||||||
|
Name->Buffer,
|
||||||
|
Name->MaximumLength);
|
||||||
|
|
||||||
|
ReferencedDomains->Entries++;
|
||||||
|
*Index = i;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LsapLookupNames(DWORD Count,
|
LsapLookupNames(DWORD Count,
|
||||||
PRPC_UNICODE_STRING Names,
|
PRPC_UNICODE_STRING Names,
|
||||||
|
@ -845,6 +893,7 @@ LsapLookupNames(DWORD Count,
|
||||||
PRPC_UNICODE_STRING DomainNames = NULL;
|
PRPC_UNICODE_STRING DomainNames = NULL;
|
||||||
PRPC_UNICODE_STRING AccountNames = NULL;
|
PRPC_UNICODE_STRING AccountNames = NULL;
|
||||||
ULONG SidsBufferLength;
|
ULONG SidsBufferLength;
|
||||||
|
ULONG DomainIndex;
|
||||||
// ULONG DomainSidLength;
|
// ULONG DomainSidLength;
|
||||||
// ULONG AccountSidLength;
|
// ULONG AccountSidLength;
|
||||||
// PSID DomainSid;
|
// PSID DomainSid;
|
||||||
|
@ -853,7 +902,7 @@ LsapLookupNames(DWORD Count,
|
||||||
ULONG Mapped = 0;
|
ULONG Mapped = 0;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
PWELL_KNOWN_SID ptr;
|
PWELL_KNOWN_SID ptr, ptr2;
|
||||||
|
|
||||||
//TRACE("()\n");
|
//TRACE("()\n");
|
||||||
|
|
||||||
|
@ -878,7 +927,6 @@ LsapLookupNames(DWORD Count,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainsBuffer->Entries = 0; //Count;
|
|
||||||
DomainsBuffer->Domains = MIDL_user_allocate(Count * sizeof(LSA_TRUST_INFORMATION));
|
DomainsBuffer->Domains = MIDL_user_allocate(Count * sizeof(LSA_TRUST_INFORMATION));
|
||||||
if (DomainsBuffer->Domains == NULL)
|
if (DomainsBuffer->Domains == NULL)
|
||||||
{
|
{
|
||||||
|
@ -886,6 +934,8 @@ LsapLookupNames(DWORD Count,
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
DomainsBuffer->Entries = 0;
|
||||||
|
DomainsBuffer->MaxEntries = Count;
|
||||||
|
|
||||||
for (i = 0; i < Count; i++)
|
for (i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -911,7 +961,7 @@ LsapLookupNames(DWORD Count,
|
||||||
|
|
||||||
//TRACE("Domain name: %wZ\n", &DomainNames[i]);
|
//TRACE("Domain name: %wZ\n", &DomainNames[i]);
|
||||||
//TRACE("Account name: %wZ\n", &AccountNames[i]);
|
//TRACE("Account name: %wZ\n", &AccountNames[i]);
|
||||||
|
ptr2 = NULL;
|
||||||
ptr = LsapLookupWellKnownName((PUNICODE_STRING)&AccountNames[i]);
|
ptr = LsapLookupWellKnownName((PUNICODE_STRING)&AccountNames[i]);
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
{
|
{
|
||||||
|
@ -922,24 +972,33 @@ LsapLookupNames(DWORD Count,
|
||||||
SidsBuffer[i].DomainIndex = -1;
|
SidsBuffer[i].DomainIndex = -1;
|
||||||
SidsBuffer[i].Flags = 0;
|
SidsBuffer[i].Flags = 0;
|
||||||
|
|
||||||
#if 0
|
if (DomainNames[i].Length != 0)
|
||||||
if (DomainNames[i].Buffer != NULL)
|
|
||||||
{
|
{
|
||||||
ptr2= LsapLookupWellKnownName((PUNICODE_STRING)&DomainNames[i].Buffer);
|
ptr2= LsapLookupWellKnownName((PUNICODE_STRING)&DomainNames[i]);
|
||||||
if (ptr2 != NULL)
|
if (ptr2 != NULL)
|
||||||
{
|
{
|
||||||
|
Status = LsapAddDomainToDomainsList(DomainsBuffer,
|
||||||
|
&ptr2->Name,
|
||||||
|
ptr2->Sid,
|
||||||
|
&DomainIndex);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
SidsBuffer[i].DomainIndex = DomainIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ptr->Domain.Length != 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
if (ptr2 == NULL && ptr->Domain.Length != 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
ptr2= LsapLookupWellKnownName(&ptr->Domain);
|
||||||
|
if (ptr2 != NULL)
|
||||||
|
{
|
||||||
|
Status = LsapAddDomainToDomainsList(DomainsBuffer,
|
||||||
|
&ptr2->Name,
|
||||||
|
ptr2->Sid,
|
||||||
|
&DomainIndex);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
SidsBuffer[i].DomainIndex = DomainIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Mapped++;
|
Mapped++;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue