Merge pull request #5297 from akallabeth/nla_server_functions

Exposing NLA functions to impersonate and revert context.
This commit is contained in:
Martin Fleisz 2019-03-08 10:44:09 +01:00 committed by GitHub
commit 6e2cfef5a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 0 deletions

View File

@ -479,6 +479,9 @@ FREERDP_API const char* freerdp_get_logon_error_info_data(UINT32 data);
FREERDP_API ULONG freerdp_get_transport_sent(rdpContext* context,
BOOL resetCount);
FREERDP_API BOOL freerdp_nla_impersonate(rdpContext* context);
FREERDP_API BOOL freerdp_nla_revert_to_self(rdpContext* context);
FREERDP_API void clearChannelError(rdpContext* context);
FREERDP_API HANDLE getChannelErrorEventHandle(rdpContext* context);
FREERDP_API UINT getChannelError(rdpContext* context);

View File

@ -1001,6 +1001,40 @@ ULONG freerdp_get_transport_sent(rdpContext* context, BOOL resetCount)
return written;
}
BOOL freerdp_nla_impersonate(rdpContext* context)
{
rdpNla* nla;
if (!context)
return FALSE;
if (!context->rdp)
return FALSE;
if (!context->rdp->transport)
return FALSE;
nla = context->rdp->transport->nla;
return nla_impersonate(nla);
}
BOOL freerdp_nla_revert_to_self(rdpContext* context)
{
rdpNla* nla;
if (!context)
return FALSE;
if (!context->rdp)
return FALSE;
if (!context->rdp->transport)
return FALSE;
nla = context->rdp->transport->nla;
return nla_revert_to_self(nla);
}
HANDLE getChannelErrorEventHandle(rdpContext* context)
{
return context->channelErrorEvent;

View File

@ -2468,3 +2468,25 @@ BOOL nla_set_service_principal(rdpNla* nla, LPSTR principal)
nla->ServicePrincipalName = principal;
return TRUE;
}
BOOL nla_impersonate(rdpNla* nla)
{
if (!nla)
return FALSE;
if (!nla->table || !nla->table->ImpersonateSecurityContext)
return FALSE;
return (nla->table->ImpersonateSecurityContext(&nla->context) == SEC_E_OK);
}
BOOL nla_revert_to_self(rdpNla* nla)
{
if (!nla)
return FALSE;
if (!nla->table || !nla->table->RevertSecurityContext)
return FALSE;
return (nla->table->RevertSecurityContext(&nla->context) == SEC_E_OK);
}

View File

@ -61,6 +61,9 @@ FREERDP_LOCAL BOOL nla_set_state(rdpNla* nla, NLA_STATE state);
FREERDP_LOCAL BOOL nla_set_service_principal(rdpNla* nla, LPSTR principal);
FREERDP_LOCAL BOOL nla_impersonate(rdpNla* nla);
FREERDP_LOCAL BOOL nla_revert_to_self(rdpNla* nla);
FREERDP_LOCAL rdpNla* nla_new(freerdp* instance, rdpTransport* transport,
rdpSettings* settings);
FREERDP_LOCAL void nla_free(rdpNla* nla);