server: proxy: capture: send sid in SessionInfo
This commit is contained in:
parent
181f2ba846
commit
0bf225ec60
@ -209,8 +209,6 @@ static BOOL capture_plugin_client_post_connect(proxyData* pdata)
|
||||
{
|
||||
SOCKET socket;
|
||||
wStream* s;
|
||||
pClientContext* pc = pdata->pc;
|
||||
rdpSettings* settings = pc->context.settings;
|
||||
|
||||
socket = capture_plugin_init_socket();
|
||||
if (socket == -1)
|
||||
@ -221,7 +219,7 @@ static BOOL capture_plugin_client_post_connect(proxyData* pdata)
|
||||
|
||||
g_plugins_manager->SetPluginData(PLUGIN_NAME, pdata, (void*)socket);
|
||||
|
||||
s = capture_plugin_create_session_info_packet(settings);
|
||||
s = capture_plugin_create_session_info_packet(pdata->pc);
|
||||
if (!s)
|
||||
return FALSE;
|
||||
|
||||
|
@ -31,10 +31,16 @@ wStream* capture_plugin_packet_new(UINT32 payload_size, UINT16 type)
|
||||
return stream;
|
||||
}
|
||||
|
||||
wStream* capture_plugin_create_session_info_packet(rdpSettings* settings)
|
||||
wStream* capture_plugin_create_session_info_packet(pClientContext* pc)
|
||||
{
|
||||
UINT16 username_length;
|
||||
wStream* s = NULL;
|
||||
rdpSettings* settings;
|
||||
|
||||
if (!pc)
|
||||
return NULL;
|
||||
|
||||
settings = pc->context.settings;
|
||||
|
||||
if (!settings || !settings->Username)
|
||||
return NULL;
|
||||
@ -48,10 +54,11 @@ wStream* capture_plugin_create_session_info_packet(rdpSettings* settings)
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
Stream_Write_UINT16(s, username_length); /* username length (2 bytes) */
|
||||
Stream_Write(s, settings->Username, username_length); /* username */
|
||||
Stream_Write_UINT32(s, settings->DesktopWidth); /* desktop width (4 bytes) */
|
||||
Stream_Write_UINT32(s, settings->DesktopHeight); /* desktop height (4 bytes) */
|
||||
Stream_Write_UINT32(s, settings->ColorDepth); /* color depth (4 bytes) */
|
||||
Stream_Write_UINT16(s, username_length); /* username length (2 bytes) */
|
||||
Stream_Write(s, settings->Username, username_length); /* username */
|
||||
Stream_Write_UINT32(s, settings->DesktopWidth); /* desktop width (4 bytes) */
|
||||
Stream_Write_UINT32(s, settings->DesktopHeight); /* desktop height (4 bytes) */
|
||||
Stream_Write_UINT32(s, settings->ColorDepth); /* color depth (4 bytes) */
|
||||
Stream_Write(s, pc->pdata->session_id, PROXY_SESSION_ID_LENGTH); /* color depth (32 bytes) */
|
||||
return s;
|
||||
}
|
||||
|
@ -20,9 +20,11 @@
|
||||
#include <winpr/stream.h>
|
||||
#include <freerdp/settings.h>
|
||||
|
||||
#include "pf_context.h"
|
||||
|
||||
/* protocol message sizes */
|
||||
#define HEADER_SIZE 6
|
||||
#define SESSION_INFO_PDU_BASE_SIZE 14
|
||||
#define SESSION_INFO_PDU_BASE_SIZE 46
|
||||
#define SESSION_END_PDU_BASE_SIZE 0
|
||||
#define CAPTURED_FRAME_PDU_BASE_SIZE 0
|
||||
|
||||
@ -32,4 +34,4 @@
|
||||
#define MESSAGE_TYPE_SESSION_END 3
|
||||
|
||||
wStream* capture_plugin_packet_new(UINT32 payload_size, UINT16 type);
|
||||
wStream* capture_plugin_create_session_info_packet(rdpSettings* settings);
|
||||
wStream* capture_plugin_create_session_info_packet(pClientContext* pc);
|
||||
|
@ -604,9 +604,6 @@ static void pf_client_context_free(freerdp* instance, rdpContext* context)
|
||||
if (!pc)
|
||||
return;
|
||||
|
||||
free(pc->frames_dir);
|
||||
pc->frames_dir = NULL;
|
||||
|
||||
HashTable_Free(pc->vc_ids);
|
||||
}
|
||||
|
||||
|
@ -201,8 +201,10 @@ error:
|
||||
proxyData* proxy_data_new(void)
|
||||
{
|
||||
BYTE temp[16];
|
||||
proxyData* pdata = calloc(1, sizeof(proxyData));
|
||||
char* hex;
|
||||
proxyData* pdata;
|
||||
|
||||
pdata = calloc(1, sizeof(proxyData));
|
||||
if (!pdata)
|
||||
return NULL;
|
||||
|
||||
@ -213,9 +215,14 @@ proxyData* proxy_data_new(void)
|
||||
goto error;
|
||||
|
||||
winpr_RAND((BYTE*)&temp, 16);
|
||||
if (!(pdata->session_id = winpr_BinToHexString(temp, 16, FALSE)))
|
||||
hex = winpr_BinToHexString(temp, 16, FALSE);
|
||||
if (!hex)
|
||||
goto error;
|
||||
|
||||
CopyMemory(pdata->session_id, hex, PROXY_SESSION_ID_LENGTH);
|
||||
pdata->session_id[PROXY_SESSION_ID_LENGTH] = '\0';
|
||||
free(hex);
|
||||
|
||||
if (!(pdata->modules_info = HashTable_New(FALSE)))
|
||||
goto error;
|
||||
|
||||
@ -265,9 +272,6 @@ void proxy_data_free(proxyData* pdata)
|
||||
pdata->gfx_server_ready = NULL;
|
||||
}
|
||||
|
||||
if (pdata->session_id)
|
||||
free(pdata->session_id);
|
||||
|
||||
if (pdata->modules_info)
|
||||
HashTable_Free(pdata->modules_info);
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
#include "pf_config.h"
|
||||
#include "pf_server.h"
|
||||
|
||||
#define PROXY_SESSION_ID_LENGTH 32
|
||||
|
||||
typedef struct proxy_data proxyData;
|
||||
|
||||
/**
|
||||
@ -107,7 +109,7 @@ struct proxy_data
|
||||
HANDLE client_thread;
|
||||
HANDLE gfx_server_ready;
|
||||
|
||||
char* session_id;
|
||||
char session_id[PROXY_SESSION_ID_LENGTH + 1];
|
||||
|
||||
/* used to external modules to store per-session info */
|
||||
wHashTable* modules_info;
|
||||
|
Loading…
x
Reference in New Issue
Block a user