mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
[ADVAPI32/LSASRV]
- Export LsaLookupPrivilegeName. - Move mockup code from advapi32 to lsasrv (LsaLookupSids --> LsarLookupSids). - Make LsaLookupSids call the server function LsarLookupSids. svn path=/trunk/; revision=47996
This commit is contained in:
parent
2d3333aa11
commit
abed1067fc
3 changed files with 81 additions and 32 deletions
|
@ -373,7 +373,7 @@
|
||||||
@ stdcall LsaLookupNames(long long ptr ptr ptr)
|
@ stdcall LsaLookupNames(long long ptr ptr ptr)
|
||||||
@ stdcall LsaLookupNames2(ptr long long ptr ptr ptr)
|
@ stdcall LsaLookupNames2(ptr long long ptr ptr ptr)
|
||||||
@ stub LsaLookupPrivilegeDisplayName
|
@ stub LsaLookupPrivilegeDisplayName
|
||||||
@ stub LsaLookupPrivilegeName
|
@ stdcall LsaLookupPrivilegeName(ptr ptr ptr)
|
||||||
@ stdcall LsaLookupPrivilegeValue(ptr ptr ptr)
|
@ stdcall LsaLookupPrivilegeValue(ptr ptr ptr)
|
||||||
@ stdcall LsaLookupSids(ptr long ptr ptr ptr)
|
@ stdcall LsaLookupSids(ptr long ptr ptr ptr)
|
||||||
@ stdcall LsaNtStatusToWinError(long)
|
@ stdcall LsaNtStatusToWinError(long)
|
||||||
|
|
|
@ -429,7 +429,7 @@ LsaLookupPrivilegeName(IN LSA_HANDLE PolicyHandle,
|
||||||
PRPC_UNICODE_STRING NameBuffer = NULL;
|
PRPC_UNICODE_STRING NameBuffer = NULL;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TRACE("(%p,%p,%p) stub\n", PolicyHandle, Value, Name);
|
TRACE("(%p,%p,%p)\n", PolicyHandle, Value, Name);
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@ LsaLookupPrivilegeValue(IN LSA_HANDLE PolicyHandle,
|
||||||
LUID Luid;
|
LUID Luid;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TRACE("(%p,%p,%p) stub\n", PolicyHandle, Name, Value);
|
TRACE("(%p,%p,%p)\n", PolicyHandle, Name, Value);
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
|
@ -483,7 +483,7 @@ LsaLookupPrivilegeValue(IN LSA_HANDLE PolicyHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -494,36 +494,49 @@ LsaLookupSids(
|
||||||
PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
|
PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
|
||||||
PLSA_TRANSLATED_NAME *Names)
|
PLSA_TRANSLATED_NAME *Names)
|
||||||
{
|
{
|
||||||
static const UNICODE_STRING UserName = RTL_CONSTANT_STRING(L"Administrator");
|
LSAPR_SID_ENUM_BUFFER SidEnumBuffer;
|
||||||
PLSA_REFERENCED_DOMAIN_LIST LocalDomains;
|
LSAPR_TRANSLATED_NAMES TranslatedNames;
|
||||||
PLSA_TRANSLATED_NAME LocalNames;
|
ULONG MappedCount = 0;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
TRACE("(%p,%u,%p,%p,%p) stub\n", PolicyHandle, Count, Sids,
|
TRACE("(%p,%u,%p,%p,%p)\n", PolicyHandle, Count, Sids,
|
||||||
ReferencedDomains, Names);
|
ReferencedDomains, Names);
|
||||||
|
|
||||||
WARN("LsaLookupSids(): stub. Always returning 'Administrator'\n");
|
if (Count == 0)
|
||||||
if (Count != 1)
|
return STATUS_INVALID_PARAMETER;
|
||||||
return STATUS_NONE_MAPPED;
|
|
||||||
LocalDomains = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(LSA_TRANSLATED_SID));
|
|
||||||
if (!LocalDomains)
|
|
||||||
return SCESTATUS_NOT_ENOUGH_RESOURCE;
|
|
||||||
LocalNames = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(LSA_TRANSLATED_NAME) + UserName.MaximumLength);
|
|
||||||
if (!LocalNames)
|
|
||||||
{
|
|
||||||
LsaFreeMemory(LocalDomains);
|
|
||||||
return SCESTATUS_NOT_ENOUGH_RESOURCE;
|
|
||||||
}
|
|
||||||
LocalDomains[0].Entries = 0;
|
|
||||||
LocalDomains[0].Domains = NULL;
|
|
||||||
LocalNames[0].Use = SidTypeWellKnownGroup;
|
|
||||||
LocalNames[0].Name.Buffer = (LPWSTR)((ULONG_PTR)(LocalNames) + sizeof(LSA_TRANSLATED_NAME));
|
|
||||||
LocalNames[0].Name.Length = UserName.Length;
|
|
||||||
LocalNames[0].Name.MaximumLength = UserName.MaximumLength;
|
|
||||||
RtlCopyMemory(LocalNames[0].Name.Buffer, UserName.Buffer, UserName.MaximumLength);
|
|
||||||
|
|
||||||
*ReferencedDomains = LocalDomains;
|
SidEnumBuffer.Entries = Count;
|
||||||
*Names = LocalNames;
|
SidEnumBuffer.SidInfo = (PLSAPR_SID_INFORMATION)Sids;
|
||||||
return STATUS_SUCCESS;
|
|
||||||
|
RpcTryExcept
|
||||||
|
{
|
||||||
|
*ReferencedDomains = NULL;
|
||||||
|
*Names = NULL;
|
||||||
|
|
||||||
|
TranslatedNames.Entries = 0;
|
||||||
|
TranslatedNames.Names = NULL;
|
||||||
|
|
||||||
|
Status = LsarLookupSids((LSAPR_HANDLE)PolicyHandle,
|
||||||
|
&SidEnumBuffer,
|
||||||
|
(PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains,
|
||||||
|
&TranslatedNames,
|
||||||
|
LsapLookupWksta,
|
||||||
|
&MappedCount);
|
||||||
|
|
||||||
|
*Names = (PLSA_TRANSLATED_NAME)TranslatedNames.Names;
|
||||||
|
}
|
||||||
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
if (TranslatedNames.Names != NULL)
|
||||||
|
{
|
||||||
|
MIDL_user_free(TranslatedNames.Names);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = I_RpcMapWin32Status(RpcExceptionCode());
|
||||||
|
}
|
||||||
|
RpcEndExcept;
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -347,8 +347,44 @@ NTSTATUS LsarLookupSids(
|
||||||
LSAP_LOOKUP_LEVEL LookupLevel,
|
LSAP_LOOKUP_LEVEL LookupLevel,
|
||||||
DWORD *MappedCount)
|
DWORD *MappedCount)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
static const UNICODE_STRING UserName = RTL_CONSTANT_STRING(L"Administrator");
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
PLSAPR_TRANSLATED_NAME OutputNames = NULL;
|
||||||
|
ULONG OutputNamesLength;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
TRACE("LsarLookupSids(%p, %p, %p, %p, %d, %p)\n",
|
||||||
|
PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
|
||||||
|
LookupLevel, MappedCount);
|
||||||
|
|
||||||
|
TranslatedNames->Entries = SidEnumBuffer->Entries;
|
||||||
|
TranslatedNames->Names = NULL;
|
||||||
|
*ReferencedDomains = NULL;
|
||||||
|
|
||||||
|
OutputNamesLength = SidEnumBuffer->Entries * sizeof(LSA_TRANSLATED_NAME);
|
||||||
|
OutputNames = MIDL_user_allocate(OutputNamesLength);
|
||||||
|
if (OutputNames == NULL)
|
||||||
|
{
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlZeroMemory(OutputNames, OutputNamesLength);
|
||||||
|
|
||||||
|
for (i = 0; i < SidEnumBuffer->Entries; i++)
|
||||||
|
{
|
||||||
|
OutputNames[i].Use = SidTypeWellKnownGroup;
|
||||||
|
OutputNames[i].DomainIndex = 0;
|
||||||
|
OutputNames[i].Name.Buffer = MIDL_user_allocate(UserName.MaximumLength);
|
||||||
|
OutputNames[i].Name.Length = UserName.Length;
|
||||||
|
OutputNames[i].Name.MaximumLength = UserName.MaximumLength;
|
||||||
|
RtlCopyMemory(OutputNames[i].Name.Buffer, UserName.Buffer, UserName.MaximumLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
*MappedCount = SidEnumBuffer->Entries;
|
||||||
|
|
||||||
|
TranslatedNames->Entries = SidEnumBuffer->Entries;
|
||||||
|
TranslatedNames->Names = OutputNames;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue