- Change LsapLookupSids to match LsarLookupSids2 and LsarLookupSids3.
- Implement LsarLookupSids2 and LsarLookupSids3.
- Update the call to LsapLookupSids in LsarLookupSids and convert the translated names list after calling LsapLookupSids.

svn path=/trunk/; revision=57489
This commit is contained in:
Eric Kohl 2012-10-05 19:41:14 +00:00
parent bc733f3d0a
commit 7989048604
3 changed files with 86 additions and 15 deletions

View file

@ -647,23 +647,49 @@ NTSTATUS WINAPI LsarLookupSids(
LSAP_LOOKUP_LEVEL LookupLevel,
DWORD *MappedCount)
{
LSAPR_TRANSLATED_NAMES_EX TranslatedNamesEx;
ULONG i;
NTSTATUS Status;
TRACE("LsarLookupSids(%p, %p, %p, %p, %d, %p)\n",
TRACE("(%p %p %p %p %d %p)\n",
PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
LookupLevel, MappedCount);
/* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
TranslatedNames->Entries = SidEnumBuffer->Entries;
TranslatedNames->Names = NULL;
TranslatedNames->Names = MIDL_user_allocate(SidEnumBuffer->Entries * sizeof(LSAPR_TRANSLATED_NAME));
if (TranslatedNames->Names == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
*ReferencedDomains = NULL;
/* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
TranslatedNamesEx.Entries = SidEnumBuffer->Entries;
TranslatedNamesEx.Names = NULL;;
Status = LsapLookupSids(SidEnumBuffer,
ReferencedDomains,
TranslatedNames,
&TranslatedNamesEx,
LookupLevel,
MappedCount);
MappedCount,
0,
0);
if (!NT_SUCCESS(Status))
{
MIDL_user_free(TranslatedNamesEx.Names);
return Status;
}
for (i = 0; i < TranslatedNamesEx.Entries; i++)
{
TranslatedNames->Names[i].Use = TranslatedNamesEx.Names[i].Use;
TranslatedNames->Names[i].Name.Length = TranslatedNamesEx.Names[i].Name.Length;
TranslatedNames->Names[i].Name.MaximumLength = TranslatedNamesEx.Names[i].Name.MaximumLength;
TranslatedNames->Names[i].Name.Buffer = TranslatedNamesEx.Names[i].Name.Buffer;
TranslatedNames->Names[i].DomainIndex = TranslatedNamesEx.Names[i].DomainIndex;
}
MIDL_user_free(TranslatedNamesEx.Names);
return Status;
}
@ -1915,8 +1941,27 @@ NTSTATUS WINAPI LsarLookupSids2(
DWORD LookupOptions,
DWORD ClientRevision)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
NTSTATUS Status;
TRACE("(%p %p %p %p %d %p %lu %lu)\n",
PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
LookupLevel, MappedCount, LookupOptions, ClientRevision);
TranslatedNames->Entries = SidEnumBuffer->Entries;
TranslatedNames->Names = NULL;
*ReferencedDomains = NULL;
/* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
Status = LsapLookupSids(SidEnumBuffer,
ReferencedDomains,
TranslatedNames,
LookupLevel,
MappedCount,
LookupOptions,
ClientRevision);
return Status;
}
@ -2142,8 +2187,27 @@ NTSTATUS WINAPI LsarLookupSids3(
DWORD LookupOptions,
DWORD ClientRevision)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
NTSTATUS Status;
TRACE("(%p %p %p %p %d %p %lu %lu)\n",
PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
LookupLevel, MappedCount, LookupOptions, ClientRevision);
TranslatedNames->Entries = SidEnumBuffer->Entries;
TranslatedNames->Names = NULL;
*ReferencedDomains = NULL;
/* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
Status = LsapLookupSids(SidEnumBuffer,
ReferencedDomains,
TranslatedNames,
LookupLevel,
MappedCount,
LookupOptions,
ClientRevision);
return Status;
}

View file

@ -205,8 +205,10 @@ LsapLookupNames(DWORD Count,
NTSTATUS
LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
PLSAPR_TRANSLATED_NAMES TranslatedNames,
PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
LSAP_LOOKUP_LEVEL LookupLevel,
DWORD *MappedCount);
DWORD *MappedCount,
DWORD LookupOptions,
DWORD ClientRevision);
/* EOF */

View file

@ -1009,12 +1009,14 @@ done:
NTSTATUS
LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
PLSAPR_TRANSLATED_NAMES TranslatedNames,
PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
LSAP_LOOKUP_LEVEL LookupLevel,
DWORD *MappedCount)
DWORD *MappedCount,
DWORD LookupOptions,
DWORD ClientRevision)
{
PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer = NULL;
PLSAPR_TRANSLATED_NAME NamesBuffer = NULL;
PLSAPR_TRANSLATED_NAME_EX NamesBuffer = NULL;
ULONG NamesBufferLength;
ULONG DomainIndex;
ULONG i;
@ -1030,7 +1032,7 @@ LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
ULONG SidLength;
NamesBufferLength = SidEnumBuffer->Entries * sizeof(LSA_TRANSLATED_NAME);
NamesBufferLength = SidEnumBuffer->Entries * sizeof(LSAPR_TRANSLATED_NAME_EX);
NamesBuffer = MIDL_user_allocate(NamesBufferLength);
if (NamesBuffer == NULL)
{
@ -1063,6 +1065,7 @@ LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
NamesBuffer[i].Name.MaximumLength = 0;
NamesBuffer[i].Name.Buffer = NULL;
NamesBuffer[i].DomainIndex = -1;
NamesBuffer[i].Flags = 0;
}
@ -1085,6 +1088,7 @@ LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
if (ptr != NULL)
{
NamesBuffer[i].Use = ptr->Use;
NamesBuffer[i].Flags = 0;
NamesBuffer[i].Name.Buffer = MIDL_user_allocate(ptr->Name.MaximumLength);
NamesBuffer[i].Name.Length = ptr->Name.Length;
@ -1109,6 +1113,7 @@ LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
/* Hack: Map the SID to the Admin Account if it is not a well-known SID */
NamesBuffer[i].Use = SidTypeWellKnownGroup;
NamesBuffer[i].Flags = 0;
NamesBuffer[i].Name.Length = AdminName.Length;
NamesBuffer[i].Name.MaximumLength = AdminName.MaximumLength;
NamesBuffer[i].Name.Buffer = MIDL_user_allocate(AdminName.MaximumLength);