added work arounds for missing APIs

This commit is contained in:
Manoj Ampalam 2018-02-21 07:18:42 -08:00
parent 89cac52637
commit e610a3d6d1
2 changed files with 17 additions and 12 deletions

View File

@ -53,8 +53,3 @@ NTSTATUS WINAPI LsaManageSidNameMapping(
PLSA_SID_NAME_MAPPING_OPERATION_INPUT OpInput, PLSA_SID_NAME_MAPPING_OPERATION_INPUT OpInput,
PLSA_SID_NAME_MAPPING_OPERATION_OUTPUT *OpOutput PLSA_SID_NAME_MAPPING_OPERATION_OUTPUT *OpOutput
); );
VOID WINAPI RtlInitUnicodeString(
PUNICODE_STRING DestinationString,
PCWSTR SourceString
);

View File

@ -443,8 +443,9 @@ AddSidMappingToLsa(PUNICODE_STRING domain_name,
error("LsaManageSidNameMapping failed with ntstatus: %d \n", status); error("LsaManageSidNameMapping failed with ntstatus: %d \n", status);
} }
if (p_output) /* TODO - Free p_output */
LsaFreeMemory(p_output); /*if (p_output)
LsaFreeMemory(p_output);*/
return ret; return ret;
} }
@ -469,12 +470,21 @@ int RemoveVirtualAccountLSAMapping(PUNICODE_STRING domain_name,
if (status != STATUS_SUCCESS) if (status != STATUS_SUCCESS)
ret = -1; ret = -1;
if (p_output) /* TODO - Free p_output */
LsaFreeMemory(p_output); /*if (p_output)
LsaFreeMemory(p_output);*/
return ret; return ret;
} }
void
InitUnicodeString(PUNICODE_STRING dest, PCWSTR source)
{
dest->Buffer = source;
dest->Length = wcslen(source) * sizeof(wchar_t);
dest->MaximumLength = dest->Length + 2;
}
HANDLE generate_sshd_virtual_token() HANDLE generate_sshd_virtual_token()
{ {
SID_IDENTIFIER_AUTHORITY nt_authority = SECURITY_NT_AUTHORITY; SID_IDENTIFIER_AUTHORITY nt_authority = SECURITY_NT_AUTHORITY;
@ -486,9 +496,9 @@ HANDLE generate_sshd_virtual_token()
StringCchPrintfW(va_name, 32, L"%s_%d", L"sshd", GetCurrentProcessId()); StringCchPrintfW(va_name, 32, L"%s_%d", L"sshd", GetCurrentProcessId());
RtlInitUnicodeString(&domain, VIRTUALUSER_DOMAIN); InitUnicodeString(&domain, VIRTUALUSER_DOMAIN);
RtlInitUnicodeString(&group, VIRTUALUSER_GROUP_NAME); InitUnicodeString(&group, VIRTUALUSER_GROUP_NAME);
RtlInitUnicodeString(&account, va_name); InitUnicodeString(&account, va_name);
/* Initialize SIDs */ /* Initialize SIDs */
/* domain SID - S-1-5-111 */ /* domain SID - S-1-5-111 */