2019-05-17 15:32:54 +03:00
|
|
|
/**
|
2019-11-06 17:24:51 +03:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* FreeRDP Proxy Server
|
|
|
|
*
|
|
|
|
* Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
|
|
|
|
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
|
|
|
|
* Copyright 2019 Idan Freiberg <speidy@gmail.com>
|
2021-09-01 14:30:09 +03:00
|
|
|
* Copyright 2021 Armin Novak <anovak@thincast.com>
|
|
|
|
* Copyright 2021 Thincast Technologies GmbH
|
2019-11-06 17:24:51 +03:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2019-05-17 15:32:54 +03:00
|
|
|
|
2019-12-26 11:25:13 +03:00
|
|
|
#include <winpr/crypto.h>
|
|
|
|
#include <winpr/print.h>
|
|
|
|
|
2022-02-03 19:36:53 +03:00
|
|
|
#include <freerdp/server/proxy/proxy_log.h>
|
2021-08-24 13:50:13 +03:00
|
|
|
#include <freerdp/server/proxy/proxy_server.h>
|
2021-05-17 10:40:18 +03:00
|
|
|
|
2021-08-24 13:50:13 +03:00
|
|
|
#include "pf_client.h"
|
2022-02-03 19:36:53 +03:00
|
|
|
#include "pf_utils.h"
|
2023-01-12 12:39:48 +03:00
|
|
|
#include "proxy_modules.h"
|
|
|
|
|
2021-08-24 13:50:13 +03:00
|
|
|
#include <freerdp/server/proxy/proxy_context.h>
|
2020-02-02 16:15:28 +03:00
|
|
|
|
2021-12-14 15:02:29 +03:00
|
|
|
#include "channels/pf_channel_rdpdr.h"
|
|
|
|
|
2022-02-03 19:36:53 +03:00
|
|
|
#define TAG PROXY_TAG("server")
|
|
|
|
|
|
|
|
static UINT32 ChannelId_Hash(const void* key)
|
|
|
|
{
|
2022-06-15 11:21:29 +03:00
|
|
|
const UINT32* v = (const UINT32*)key;
|
|
|
|
return *v;
|
2022-02-03 19:36:53 +03:00
|
|
|
}
|
|
|
|
|
2022-06-15 11:21:29 +03:00
|
|
|
static BOOL ChannelId_Compare(const UINT32* v1, const UINT32* v2)
|
2022-02-03 19:36:53 +03:00
|
|
|
{
|
|
|
|
return (*v1 == *v2);
|
|
|
|
}
|
|
|
|
|
2022-06-23 08:57:38 +03:00
|
|
|
pServerStaticChannelContext* StaticChannelContext_new(pServerContext* ps, const char* name,
|
|
|
|
UINT32 id)
|
2022-02-03 19:36:53 +03:00
|
|
|
{
|
2022-06-15 11:21:29 +03:00
|
|
|
pServerStaticChannelContext* ret = calloc(1, sizeof(*ret));
|
2022-02-03 19:36:53 +03:00
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
PROXY_LOG_ERR(TAG, ps, "error allocating channel context for '%s'", name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-11-30 11:09:25 +03:00
|
|
|
ret->front_channel_id = id;
|
2022-02-03 19:36:53 +03:00
|
|
|
ret->channel_name = _strdup(name);
|
|
|
|
if (!ret->channel_name)
|
|
|
|
{
|
2022-06-15 11:21:29 +03:00
|
|
|
PROXY_LOG_ERR(TAG, ps, "error allocating name in channel context for '%s'", name);
|
2022-02-03 19:36:53 +03:00
|
|
|
free(ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2023-01-12 12:39:48 +03:00
|
|
|
proxyChannelToInterceptData channel = { .name = name, .channelId = id, .intercept = FALSE };
|
|
|
|
|
|
|
|
if (pf_modules_run_filter(ps->pdata->module, FILTER_TYPE_STATIC_INTERCEPT_LIST, ps->pdata,
|
|
|
|
&channel) &&
|
|
|
|
channel.intercept)
|
|
|
|
ret->channelMode = PF_UTILS_CHANNEL_INTERCEPT;
|
|
|
|
else
|
|
|
|
ret->channelMode = pf_utils_get_channel_mode(ps->pdata->config, name);
|
2022-02-03 19:36:53 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2022-06-15 11:21:29 +03:00
|
|
|
void StaticChannelContext_free(pServerStaticChannelContext* ctx)
|
2022-02-03 19:36:53 +03:00
|
|
|
{
|
|
|
|
if (!ctx)
|
|
|
|
return;
|
|
|
|
|
2022-06-23 08:57:38 +03:00
|
|
|
IFCALL(ctx->contextDtor, ctx->context);
|
2022-03-07 15:46:49 +03:00
|
|
|
|
2022-02-03 19:36:53 +03:00
|
|
|
free(ctx->channel_name);
|
|
|
|
free(ctx);
|
|
|
|
}
|
|
|
|
|
2019-05-17 15:32:54 +03:00
|
|
|
/* Proxy context initialization callback */
|
2021-09-17 10:27:25 +03:00
|
|
|
static void client_to_proxy_context_free(freerdp_peer* client, rdpContext* ctx);
|
2020-12-15 11:58:37 +03:00
|
|
|
static BOOL client_to_proxy_context_new(freerdp_peer* client, rdpContext* ctx)
|
2019-05-17 15:32:54 +03:00
|
|
|
{
|
2021-12-14 15:02:29 +03:00
|
|
|
wObject* obj;
|
2020-12-15 11:58:37 +03:00
|
|
|
pServerContext* context = (pServerContext*)ctx;
|
2021-08-24 13:50:13 +03:00
|
|
|
|
|
|
|
WINPR_ASSERT(client);
|
|
|
|
WINPR_ASSERT(context);
|
2020-02-02 16:15:28 +03:00
|
|
|
|
2019-09-08 18:10:50 +03:00
|
|
|
context->dynvcReady = NULL;
|
2019-08-19 16:05:59 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
context->vcm = WTSOpenServerA((LPSTR)client->context);
|
2019-05-17 15:32:54 +03:00
|
|
|
|
|
|
|
if (!context->vcm || context->vcm == INVALID_HANDLE_VALUE)
|
2019-09-08 18:10:50 +03:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (!(context->dynvcReady = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
|
|
|
goto error;
|
2019-05-17 15:32:54 +03:00
|
|
|
|
2021-12-14 15:02:29 +03:00
|
|
|
context->interceptContextMap = HashTable_New(FALSE);
|
|
|
|
if (!context->interceptContextMap)
|
|
|
|
goto error;
|
|
|
|
if (!HashTable_SetupForStringData(context->interceptContextMap, FALSE))
|
|
|
|
goto error;
|
|
|
|
obj = HashTable_ValueObject(context->interceptContextMap);
|
|
|
|
WINPR_ASSERT(obj);
|
|
|
|
obj->fnObjectFree = intercept_context_entry_free;
|
|
|
|
|
2022-02-03 19:36:53 +03:00
|
|
|
/* channels by ids */
|
2022-11-30 11:09:25 +03:00
|
|
|
context->channelsByFrontId = HashTable_New(FALSE);
|
|
|
|
if (!context->channelsByFrontId)
|
2022-02-03 19:36:53 +03:00
|
|
|
goto error;
|
2022-11-30 11:09:25 +03:00
|
|
|
if (!HashTable_SetHashFunction(context->channelsByFrontId, ChannelId_Hash))
|
2022-02-03 19:36:53 +03:00
|
|
|
goto error;
|
|
|
|
|
2022-11-30 11:09:25 +03:00
|
|
|
obj = HashTable_KeyObject(context->channelsByFrontId);
|
2022-02-03 19:36:53 +03:00
|
|
|
obj->fnObjectEquals = (OBJECT_EQUALS_FN)ChannelId_Compare;
|
|
|
|
|
2022-11-30 11:09:25 +03:00
|
|
|
obj = HashTable_ValueObject(context->channelsByFrontId);
|
2022-06-15 11:21:29 +03:00
|
|
|
obj->fnObjectFree = (OBJECT_FREE_FN)StaticChannelContext_free;
|
2022-11-30 11:09:25 +03:00
|
|
|
|
|
|
|
context->channelsByBackId = HashTable_New(FALSE);
|
|
|
|
if (!context->channelsByBackId)
|
|
|
|
goto error;
|
|
|
|
if (!HashTable_SetHashFunction(context->channelsByBackId, ChannelId_Hash))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
obj = HashTable_KeyObject(context->channelsByBackId);
|
|
|
|
obj->fnObjectEquals = (OBJECT_EQUALS_FN)ChannelId_Compare;
|
|
|
|
|
2019-05-17 15:32:54 +03:00
|
|
|
return TRUE;
|
2019-09-08 18:10:50 +03:00
|
|
|
|
|
|
|
error:
|
2021-09-17 10:27:25 +03:00
|
|
|
client_to_proxy_context_free(client, ctx);
|
2019-09-08 18:10:50 +03:00
|
|
|
|
2019-05-17 15:32:54 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Proxy context free callback */
|
2021-09-17 10:27:25 +03:00
|
|
|
void client_to_proxy_context_free(freerdp_peer* client, rdpContext* ctx)
|
2019-05-17 15:32:54 +03:00
|
|
|
{
|
2020-12-15 11:58:37 +03:00
|
|
|
pServerContext* context = (pServerContext*)ctx;
|
2019-05-17 15:32:54 +03:00
|
|
|
|
2021-09-17 10:27:25 +03:00
|
|
|
WINPR_UNUSED(client);
|
|
|
|
|
|
|
|
if (!context)
|
2019-05-28 16:10:04 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (context->dynvcReady)
|
|
|
|
{
|
|
|
|
CloseHandle(context->dynvcReady);
|
|
|
|
context->dynvcReady = NULL;
|
|
|
|
}
|
2021-12-14 15:02:29 +03:00
|
|
|
|
|
|
|
HashTable_Free(context->interceptContextMap);
|
2022-11-30 11:09:25 +03:00
|
|
|
HashTable_Free(context->channelsByFrontId);
|
|
|
|
HashTable_Free(context->channelsByBackId);
|
2021-12-14 15:02:29 +03:00
|
|
|
|
|
|
|
if (context->vcm && (context->vcm != INVALID_HANDLE_VALUE))
|
|
|
|
WTSCloseServer((HANDLE)context->vcm);
|
|
|
|
context->vcm = NULL;
|
2019-05-17 15:32:54 +03:00
|
|
|
}
|
|
|
|
|
2019-09-08 18:10:50 +03:00
|
|
|
BOOL pf_context_init_server_context(freerdp_peer* client)
|
2019-05-17 15:32:54 +03:00
|
|
|
{
|
2021-08-24 13:50:13 +03:00
|
|
|
WINPR_ASSERT(client);
|
|
|
|
|
2019-05-17 15:32:54 +03:00
|
|
|
client->ContextSize = sizeof(pServerContext);
|
2020-12-15 11:58:37 +03:00
|
|
|
client->ContextNew = client_to_proxy_context_new;
|
|
|
|
client->ContextFree = client_to_proxy_context_free;
|
2019-09-08 18:10:50 +03:00
|
|
|
|
2019-05-17 15:32:54 +03:00
|
|
|
return freerdp_peer_context_new(client);
|
|
|
|
}
|
|
|
|
|
2021-08-24 13:50:13 +03:00
|
|
|
static BOOL pf_context_revert_str_settings(rdpSettings* dst, const rdpSettings* before, size_t nr,
|
|
|
|
const size_t* ids)
|
|
|
|
{
|
|
|
|
size_t x;
|
|
|
|
WINPR_ASSERT(dst);
|
|
|
|
WINPR_ASSERT(before);
|
|
|
|
WINPR_ASSERT(ids || (nr == 0));
|
|
|
|
|
|
|
|
for (x = 0; x < nr; x++)
|
|
|
|
{
|
|
|
|
size_t id = ids[x];
|
|
|
|
const char* what = freerdp_settings_get_string(before, id);
|
|
|
|
if (!freerdp_settings_set_string(dst, id, what))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-01-20 13:12:36 +03:00
|
|
|
void intercept_context_entry_free(void* obj)
|
|
|
|
{
|
|
|
|
InterceptContextMapEntry* entry = obj;
|
|
|
|
if (!entry)
|
|
|
|
return;
|
|
|
|
if (!entry->free)
|
|
|
|
return;
|
|
|
|
entry->free(entry);
|
|
|
|
}
|
|
|
|
|
2019-09-08 15:18:45 +03:00
|
|
|
BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src)
|
2019-07-16 13:28:14 +03:00
|
|
|
{
|
2020-05-19 14:42:26 +03:00
|
|
|
BOOL rc = FALSE;
|
|
|
|
rdpSettings* before_copy;
|
2023-02-03 18:19:18 +03:00
|
|
|
const size_t to_revert[] = { FreeRDP_ConfigPath, FreeRDP_CertificateName };
|
2020-05-19 14:42:26 +03:00
|
|
|
|
|
|
|
if (!dst || !src)
|
|
|
|
return FALSE;
|
2019-08-06 16:46:18 +03:00
|
|
|
|
2020-05-19 14:42:26 +03:00
|
|
|
before_copy = freerdp_settings_clone(dst);
|
2019-07-16 13:28:14 +03:00
|
|
|
if (!before_copy)
|
2019-08-13 15:06:45 +03:00
|
|
|
return FALSE;
|
2019-07-16 13:28:14 +03:00
|
|
|
|
|
|
|
if (!freerdp_settings_copy(dst, src))
|
|
|
|
{
|
|
|
|
freerdp_settings_free(before_copy);
|
2019-08-13 15:06:45 +03:00
|
|
|
return FALSE;
|
2019-07-16 13:28:14 +03:00
|
|
|
}
|
|
|
|
|
2020-05-19 14:42:26 +03:00
|
|
|
/* keep original ServerMode value */
|
2019-09-08 15:18:45 +03:00
|
|
|
dst->ServerMode = before_copy->ServerMode;
|
2019-08-13 15:06:45 +03:00
|
|
|
|
|
|
|
/* revert some values that must not be changed */
|
2021-08-24 13:50:13 +03:00
|
|
|
if (!pf_context_revert_str_settings(dst, before_copy, ARRAYSIZE(to_revert), to_revert))
|
|
|
|
return FALSE;
|
2019-07-16 13:28:14 +03:00
|
|
|
|
2019-09-08 15:18:45 +03:00
|
|
|
if (!dst->ServerMode)
|
2019-07-16 13:28:14 +03:00
|
|
|
{
|
2020-05-19 14:42:26 +03:00
|
|
|
/* adjust instance pointer */
|
2019-07-16 13:28:14 +03:00
|
|
|
dst->instance = before_copy->instance;
|
2020-01-02 16:19:08 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* RdpServerRsaKey must be set to NULL if `dst` is client's context
|
|
|
|
* it must be freed before setting it to NULL to avoid a memory leak!
|
|
|
|
*/
|
|
|
|
|
2022-04-19 15:29:17 +03:00
|
|
|
if (!freerdp_settings_set_pointer_len(dst, FreeRDP_RdpServerRsaKey, NULL, 1))
|
2021-08-24 13:50:13 +03:00
|
|
|
goto out_fail;
|
2019-07-16 13:28:14 +03:00
|
|
|
}
|
|
|
|
|
2021-08-24 13:50:13 +03:00
|
|
|
/* We handle certificate management for this client ourselfes. */
|
|
|
|
rc = freerdp_settings_set_bool(dst, FreeRDP_ExternalCertificateManagement, TRUE);
|
2020-05-19 14:42:26 +03:00
|
|
|
|
|
|
|
out_fail:
|
2019-07-16 13:28:14 +03:00
|
|
|
freerdp_settings_free(before_copy);
|
2020-05-19 14:42:26 +03:00
|
|
|
return rc;
|
2019-07-16 13:28:14 +03:00
|
|
|
}
|
|
|
|
|
2022-11-22 14:28:18 +03:00
|
|
|
pClientContext* pf_context_create_client_context(const rdpSettings* clientSettings)
|
2019-05-17 15:32:54 +03:00
|
|
|
{
|
|
|
|
RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
|
2019-09-25 16:09:36 +03:00
|
|
|
pClientContext* pc;
|
2019-05-17 15:32:54 +03:00
|
|
|
rdpContext* context;
|
2021-08-24 13:50:13 +03:00
|
|
|
|
|
|
|
WINPR_ASSERT(clientSettings);
|
|
|
|
|
2019-05-17 15:32:54 +03:00
|
|
|
RdpClientEntry(&clientEntryPoints);
|
|
|
|
context = freerdp_client_context_new(&clientEntryPoints);
|
|
|
|
|
|
|
|
if (!context)
|
|
|
|
return NULL;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
pc = (pClientContext*)context;
|
2019-09-25 16:09:36 +03:00
|
|
|
|
2019-09-08 15:18:45 +03:00
|
|
|
if (!pf_context_copy_settings(context->settings, clientSettings))
|
2019-05-20 14:09:12 +03:00
|
|
|
goto error;
|
|
|
|
|
2019-09-25 16:09:36 +03:00
|
|
|
return pc;
|
2019-05-20 14:09:12 +03:00
|
|
|
error:
|
|
|
|
freerdp_client_context_free(context);
|
|
|
|
return NULL;
|
2019-05-17 15:32:54 +03:00
|
|
|
}
|
2019-05-12 20:48:51 +03:00
|
|
|
|
2019-08-19 16:05:59 +03:00
|
|
|
proxyData* proxy_data_new(void)
|
2019-05-12 20:48:51 +03:00
|
|
|
{
|
2019-12-26 11:25:13 +03:00
|
|
|
BYTE temp[16];
|
2020-06-10 10:16:59 +03:00
|
|
|
char* hex;
|
|
|
|
proxyData* pdata;
|
2019-05-12 20:48:51 +03:00
|
|
|
|
2020-06-10 10:16:59 +03:00
|
|
|
pdata = calloc(1, sizeof(proxyData));
|
2020-05-19 14:42:26 +03:00
|
|
|
if (!pdata)
|
2019-05-12 20:48:51 +03:00
|
|
|
return NULL;
|
|
|
|
|
2019-07-16 16:13:12 +03:00
|
|
|
if (!(pdata->abort_event = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
2020-05-19 14:42:26 +03:00
|
|
|
goto error;
|
2019-05-26 15:33:28 +03:00
|
|
|
|
2019-11-12 11:42:28 +03:00
|
|
|
if (!(pdata->gfx_server_ready = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
2020-05-19 14:42:26 +03:00
|
|
|
goto error;
|
2019-11-12 11:42:28 +03:00
|
|
|
|
2019-12-26 11:25:13 +03:00
|
|
|
winpr_RAND((BYTE*)&temp, 16);
|
2020-06-10 10:16:59 +03:00
|
|
|
hex = winpr_BinToHexString(temp, 16, FALSE);
|
|
|
|
if (!hex)
|
2020-05-19 14:42:26 +03:00
|
|
|
goto error;
|
2019-12-26 11:25:13 +03:00
|
|
|
|
2020-06-10 10:16:59 +03:00
|
|
|
CopyMemory(pdata->session_id, hex, PROXY_SESSION_ID_LENGTH);
|
|
|
|
pdata->session_id[PROXY_SESSION_ID_LENGTH] = '\0';
|
|
|
|
free(hex);
|
|
|
|
|
2019-12-31 12:16:12 +03:00
|
|
|
if (!(pdata->modules_info = HashTable_New(FALSE)))
|
2020-05-19 14:42:26 +03:00
|
|
|
goto error;
|
2019-12-31 12:16:12 +03:00
|
|
|
|
|
|
|
/* modules_info maps between plugin name to custom data */
|
2021-05-17 10:40:18 +03:00
|
|
|
if (!HashTable_SetupForStringData(pdata->modules_info, FALSE))
|
|
|
|
goto error;
|
2020-05-19 14:42:26 +03:00
|
|
|
|
2019-05-12 20:48:51 +03:00
|
|
|
return pdata;
|
2020-05-19 14:42:26 +03:00
|
|
|
error:
|
|
|
|
proxy_data_free(pdata);
|
|
|
|
return NULL;
|
2019-05-12 20:48:51 +03:00
|
|
|
}
|
|
|
|
|
2019-12-26 11:25:13 +03:00
|
|
|
/* updates circular pointers between proxyData and pClientContext instances */
|
|
|
|
void proxy_data_set_client_context(proxyData* pdata, pClientContext* context)
|
|
|
|
{
|
2021-08-24 13:50:13 +03:00
|
|
|
WINPR_ASSERT(pdata);
|
|
|
|
WINPR_ASSERT(context);
|
2019-12-26 11:25:13 +03:00
|
|
|
pdata->pc = context;
|
|
|
|
context->pdata = pdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* updates circular pointers between proxyData and pServerContext instances */
|
|
|
|
void proxy_data_set_server_context(proxyData* pdata, pServerContext* context)
|
|
|
|
{
|
2021-08-24 13:50:13 +03:00
|
|
|
WINPR_ASSERT(pdata);
|
|
|
|
WINPR_ASSERT(context);
|
2019-12-26 11:25:13 +03:00
|
|
|
pdata->ps = context;
|
|
|
|
context->pdata = pdata;
|
|
|
|
}
|
|
|
|
|
2019-05-26 15:33:28 +03:00
|
|
|
void proxy_data_free(proxyData* pdata)
|
2019-05-12 20:48:51 +03:00
|
|
|
{
|
2021-08-24 13:50:13 +03:00
|
|
|
if (!pdata)
|
|
|
|
return;
|
|
|
|
|
2019-07-16 16:13:12 +03:00
|
|
|
if (pdata->abort_event)
|
|
|
|
CloseHandle(pdata->abort_event);
|
|
|
|
|
|
|
|
if (pdata->client_thread)
|
|
|
|
CloseHandle(pdata->client_thread);
|
2019-05-28 16:10:04 +03:00
|
|
|
|
2019-11-12 11:42:28 +03:00
|
|
|
if (pdata->gfx_server_ready)
|
|
|
|
CloseHandle(pdata->gfx_server_ready);
|
|
|
|
|
2019-12-31 12:16:12 +03:00
|
|
|
if (pdata->modules_info)
|
|
|
|
HashTable_Free(pdata->modules_info);
|
|
|
|
|
2021-09-07 14:42:33 +03:00
|
|
|
if (pdata->pc)
|
|
|
|
freerdp_client_context_free(&pdata->pc->context);
|
|
|
|
|
2019-05-12 20:48:51 +03:00
|
|
|
free(pdata);
|
|
|
|
}
|
2019-07-16 16:13:12 +03:00
|
|
|
|
|
|
|
void proxy_data_abort_connect(proxyData* pdata)
|
|
|
|
{
|
2021-08-24 13:50:13 +03:00
|
|
|
WINPR_ASSERT(pdata);
|
|
|
|
WINPR_ASSERT(pdata->abort_event);
|
2019-07-16 16:13:12 +03:00
|
|
|
SetEvent(pdata->abort_event);
|
2021-09-17 10:27:25 +03:00
|
|
|
if (pdata->pc)
|
2022-04-19 15:29:17 +03:00
|
|
|
freerdp_abort_connect_context(&pdata->pc->context);
|
2019-07-16 16:13:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL proxy_data_shall_disconnect(proxyData* pdata)
|
|
|
|
{
|
2021-08-24 13:50:13 +03:00
|
|
|
WINPR_ASSERT(pdata);
|
|
|
|
WINPR_ASSERT(pdata->abort_event);
|
2019-07-16 16:13:12 +03:00
|
|
|
return WaitForSingleObject(pdata->abort_event, 0) == WAIT_OBJECT_0;
|
|
|
|
}
|