mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
[LSASRV]
- 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:
parent
bc733f3d0a
commit
7989048604
3 changed files with 86 additions and 15 deletions
|
@ -647,23 +647,49 @@ NTSTATUS WINAPI LsarLookupSids(
|
||||||
LSAP_LOOKUP_LEVEL LookupLevel,
|
LSAP_LOOKUP_LEVEL LookupLevel,
|
||||||
DWORD *MappedCount)
|
DWORD *MappedCount)
|
||||||
{
|
{
|
||||||
|
LSAPR_TRANSLATED_NAMES_EX TranslatedNamesEx;
|
||||||
|
ULONG i;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TRACE("LsarLookupSids(%p, %p, %p, %p, %d, %p)\n",
|
TRACE("(%p %p %p %p %d %p)\n",
|
||||||
PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
|
PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
|
||||||
LookupLevel, MappedCount);
|
LookupLevel, MappedCount);
|
||||||
|
|
||||||
|
/* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
|
||||||
|
|
||||||
TranslatedNames->Entries = SidEnumBuffer->Entries;
|
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;
|
*ReferencedDomains = NULL;
|
||||||
|
|
||||||
/* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
|
TranslatedNamesEx.Entries = SidEnumBuffer->Entries;
|
||||||
|
TranslatedNamesEx.Names = NULL;;
|
||||||
|
|
||||||
Status = LsapLookupSids(SidEnumBuffer,
|
Status = LsapLookupSids(SidEnumBuffer,
|
||||||
ReferencedDomains,
|
ReferencedDomains,
|
||||||
TranslatedNames,
|
&TranslatedNamesEx,
|
||||||
LookupLevel,
|
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;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -1915,8 +1941,27 @@ NTSTATUS WINAPI LsarLookupSids2(
|
||||||
DWORD LookupOptions,
|
DWORD LookupOptions,
|
||||||
DWORD ClientRevision)
|
DWORD ClientRevision)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
|
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 LookupOptions,
|
||||||
DWORD ClientRevision)
|
DWORD ClientRevision)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
NTSTATUS Status;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -205,8 +205,10 @@ LsapLookupNames(DWORD Count,
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
||||||
PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
|
PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
|
||||||
PLSAPR_TRANSLATED_NAMES TranslatedNames,
|
PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
|
||||||
LSAP_LOOKUP_LEVEL LookupLevel,
|
LSAP_LOOKUP_LEVEL LookupLevel,
|
||||||
DWORD *MappedCount);
|
DWORD *MappedCount,
|
||||||
|
DWORD LookupOptions,
|
||||||
|
DWORD ClientRevision);
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1009,12 +1009,14 @@ done:
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
||||||
PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
|
PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains,
|
||||||
PLSAPR_TRANSLATED_NAMES TranslatedNames,
|
PLSAPR_TRANSLATED_NAMES_EX TranslatedNames,
|
||||||
LSAP_LOOKUP_LEVEL LookupLevel,
|
LSAP_LOOKUP_LEVEL LookupLevel,
|
||||||
DWORD *MappedCount)
|
DWORD *MappedCount,
|
||||||
|
DWORD LookupOptions,
|
||||||
|
DWORD ClientRevision)
|
||||||
{
|
{
|
||||||
PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer = NULL;
|
PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer = NULL;
|
||||||
PLSAPR_TRANSLATED_NAME NamesBuffer = NULL;
|
PLSAPR_TRANSLATED_NAME_EX NamesBuffer = NULL;
|
||||||
ULONG NamesBufferLength;
|
ULONG NamesBufferLength;
|
||||||
ULONG DomainIndex;
|
ULONG DomainIndex;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
@ -1030,7 +1032,7 @@ LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
||||||
ULONG SidLength;
|
ULONG SidLength;
|
||||||
|
|
||||||
|
|
||||||
NamesBufferLength = SidEnumBuffer->Entries * sizeof(LSA_TRANSLATED_NAME);
|
NamesBufferLength = SidEnumBuffer->Entries * sizeof(LSAPR_TRANSLATED_NAME_EX);
|
||||||
NamesBuffer = MIDL_user_allocate(NamesBufferLength);
|
NamesBuffer = MIDL_user_allocate(NamesBufferLength);
|
||||||
if (NamesBuffer == NULL)
|
if (NamesBuffer == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1063,6 +1065,7 @@ LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
||||||
NamesBuffer[i].Name.MaximumLength = 0;
|
NamesBuffer[i].Name.MaximumLength = 0;
|
||||||
NamesBuffer[i].Name.Buffer = NULL;
|
NamesBuffer[i].Name.Buffer = NULL;
|
||||||
NamesBuffer[i].DomainIndex = -1;
|
NamesBuffer[i].DomainIndex = -1;
|
||||||
|
NamesBuffer[i].Flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1085,6 +1088,7 @@ LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer,
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
{
|
{
|
||||||
NamesBuffer[i].Use = ptr->Use;
|
NamesBuffer[i].Use = ptr->Use;
|
||||||
|
NamesBuffer[i].Flags = 0;
|
||||||
|
|
||||||
NamesBuffer[i].Name.Buffer = MIDL_user_allocate(ptr->Name.MaximumLength);
|
NamesBuffer[i].Name.Buffer = MIDL_user_allocate(ptr->Name.MaximumLength);
|
||||||
NamesBuffer[i].Name.Length = ptr->Name.Length;
|
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 */
|
/* Hack: Map the SID to the Admin Account if it is not a well-known SID */
|
||||||
NamesBuffer[i].Use = SidTypeWellKnownGroup;
|
NamesBuffer[i].Use = SidTypeWellKnownGroup;
|
||||||
|
NamesBuffer[i].Flags = 0;
|
||||||
NamesBuffer[i].Name.Length = AdminName.Length;
|
NamesBuffer[i].Name.Length = AdminName.Length;
|
||||||
NamesBuffer[i].Name.MaximumLength = AdminName.MaximumLength;
|
NamesBuffer[i].Name.MaximumLength = AdminName.MaximumLength;
|
||||||
NamesBuffer[i].Name.Buffer = MIDL_user_allocate(AdminName.MaximumLength);
|
NamesBuffer[i].Name.Buffer = MIDL_user_allocate(AdminName.MaximumLength);
|
||||||
|
|
Loading…
Reference in a new issue