Author: ekohl
Date: Fri Oct 5 19:41:14 2012
New Revision: 57489
URL:
http://svn.reactos.org/svn/reactos?rev=57489&view=rev
Log:
[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.
Modified:
trunk/reactos/dll/win32/lsasrv/lsarpc.c
trunk/reactos/dll/win32/lsasrv/lsasrv.h
trunk/reactos/dll/win32/lsasrv/sids.c
Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Fri Oct 5 19:41:14 2012
@@ -647,23 +647,49 @@
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 @@
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 @@
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;
}
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Fri Oct 5 19:41:14 2012
@@ -205,8 +205,10 @@
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 */
Modified: trunk/reactos/dll/win32/lsasrv/sids.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/sids.c?re…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/sids.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/sids.c [iso-8859-1] Fri Oct 5 19:41:14 2012
@@ -1009,12 +1009,14 @@
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 @@
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 @@
NamesBuffer[i].Name.MaximumLength = 0;
NamesBuffer[i].Name.Buffer = NULL;
NamesBuffer[i].DomainIndex = -1;
+ NamesBuffer[i].Flags = 0;
}
@@ -1085,6 +1088,7 @@
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 @@
/* 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);