From aa6adce364a54ee644c4886c94e62c0285e23311 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 24 Jun 2022 09:09:10 +0200 Subject: [PATCH 1/5] Fixed missing static for functions in RDP plugin. --- plugins/rdp/rdp_plugin.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/plugins/rdp/rdp_plugin.c b/plugins/rdp/rdp_plugin.c index 3e65a179f..100f18bc9 100644 --- a/plugins/rdp/rdp_plugin.c +++ b/plugins/rdp/rdp_plugin.c @@ -386,7 +386,7 @@ static gboolean remmina_rdp_tunnel_init(RemminaProtocolWidget *gp) return TRUE; } -BOOL rf_auto_reconnect(rfContext *rfi) +static BOOL rf_auto_reconnect(rfContext *rfi) { TRACE_CALL(__func__); rdpSettings *settings = rfi->instance->settings; @@ -503,7 +503,7 @@ BOOL rf_auto_reconnect(rfContext *rfi) return FALSE; } -BOOL rf_begin_paint(rdpContext *context) +static BOOL rf_begin_paint(rdpContext *context) { TRACE_CALL(__func__); rdpGdi *gdi; @@ -518,7 +518,7 @@ BOOL rf_begin_paint(rdpContext *context) return TRUE; } -BOOL rf_end_paint(rdpContext *context) +static BOOL rf_end_paint(rdpContext *context) { TRACE_CALL(__func__); rdpGdi *gdi; @@ -648,7 +648,7 @@ static BOOL rf_keyboard_set_indicators(rdpContext *context, UINT16 led_flags) return TRUE; } -BOOL rf_keyboard_set_ime_status(rdpContext *context, UINT16 imeId, UINT32 imeState, +static BOOL rf_keyboard_set_ime_status(rdpContext *context, UINT16 imeId, UINT32 imeState, UINT32 imeConvMode) { TRACE_CALL(__func__); @@ -660,7 +660,6 @@ BOOL rf_keyboard_set_ime_status(rdpContext *context, UINT16 imeId, UINT32 imeSta return TRUE; } - static BOOL remmina_rdp_pre_connect(freerdp *instance) { TRACE_CALL(__func__); @@ -901,8 +900,8 @@ static BOOL remmina_rdp_gw_authenticate(freerdp *instance, char **username, char } static DWORD remmina_rdp_verify_certificate_ex(freerdp *instance, const char *host, UINT16 port, - const char *common_name, const char *subject, - const char *issuer, const char *fingerprint, DWORD flags) + const char *common_name, const char *subject, + const char *issuer, const char *fingerprint, DWORD flags) { TRACE_CALL(__func__); gint status; @@ -924,7 +923,7 @@ static DWORD remmina_rdp_verify_certificate(freerdp *instance, const char *common_name, const char *subject, const char *issuer, const char *fingerprint, BOOL host_mismatch) __attribute__ ((unused)); static DWORD remmina_rdp_verify_certificate(freerdp *instance, const char *common_name, const char *subject, - const char *issuer, const char *fingerprint, BOOL host_mismatch) + const char *issuer, const char *fingerprint, BOOL host_mismatch) { TRACE_CALL(__func__); gint status; @@ -943,10 +942,10 @@ remmina_rdp_verify_certificate(freerdp *instance, const char *common_name, const } static DWORD remmina_rdp_verify_changed_certificate_ex(freerdp *instance, const char *host, UINT16 port, - const char *common_name, const char *subject, - const char *issuer, const char *fingerprint, - const char *old_subject, const char *old_issuer, - const char *old_fingerprint, DWORD flags) + const char *common_name, const char *subject, + const char *issuer, const char *fingerprint, + const char *old_subject, const char *old_issuer, + const char *old_fingerprint, DWORD flags) { TRACE_CALL(__func__); gint status; @@ -974,7 +973,7 @@ static void remmina_rdp_post_disconnect(freerdp *instance) PubSub_UnsubscribeChannelConnected(instance->context->pubSub, (pChannelConnectedEventHandler)remmina_rdp_OnChannelConnectedEventHandler); PubSub_UnsubscribeChannelDisconnected(instance->context->pubSub, - (pChannelDisconnectedEventHandler)remmina_rdp_OnChannelDisconnectedEventHandler); + (pChannelDisconnectedEventHandler)remmina_rdp_OnChannelDisconnectedEventHandler); /* The remaining cleanup will be continued on main thread by complete_cleanup_on_main_thread() */ } @@ -982,15 +981,13 @@ static void remmina_rdp_post_disconnect(freerdp *instance) static void remmina_rdp_main_loop(RemminaProtocolWidget *gp) { TRACE_CALL(__func__); - DWORD nCount; DWORD status; - HANDLE handles[64]; gchar buf[100]; rfContext *rfi = GET_PLUGIN_DATA(gp); - while (!freerdp_shall_disconnect(rfi->instance)) { - nCount = freerdp_get_event_handles(rfi->instance->context, &handles[0], 64); + HANDLE handles[64]={0}; + DWORD nCount = freerdp_get_event_handles(rfi->instance->context, &handles[0], 64); if (rfi->event_handle) handles[nCount++] = rfi->event_handle; @@ -1040,7 +1037,7 @@ static void remmina_rdp_main_loop(RemminaProtocolWidget *gp) REMMINA_PLUGIN_DEBUG("RDP client disconnected"); } -int remmina_rdp_load_static_channel_addin(rdpChannels *channels, rdpSettings *settings, char *name, void *data) +static int remmina_rdp_load_static_channel_addin(rdpChannels *channels, rdpSettings *settings, char *name, void *data) { TRACE_CALL(__func__); PVIRTUALCHANNELENTRY entry = NULL; @@ -1067,7 +1064,7 @@ int remmina_rdp_load_static_channel_addin(rdpChannels *channels, rdpSettings *se return FALSE; } -gchar *remmina_rdp_find_prdriver(char *smap, char *prn) +static gchar *remmina_rdp_find_prdriver(char *smap, char *prn) { char c, *p, *dr; int matching; @@ -1142,7 +1139,7 @@ found: * - For each enumerated local printer tries to set the Printer Name and Driver. * @return 1 if there are other printers to scan or 0 when it's done. */ -int remmina_rdp_set_printers(void *user_data, unsigned flags, cups_dest_t *dest) +static int remmina_rdp_set_printers(void *user_data, unsigned flags, cups_dest_t *dest) { rfContext *rfi = (rfContext *)user_data; RemminaProtocolWidget *gp = rfi->protocol_widget; -- GitLab From 8ed56b6e50a9a6c9df87bff84dfcbc379adbccf4 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 24 Jun 2022 11:46:53 +0200 Subject: [PATCH 2/5] Fixed type of channel connect/disconnect callbacks --- plugins/rdp/rdp_channels.c | 8 ++++---- plugins/rdp/rdp_channels.h | 4 ++-- plugins/rdp/rdp_plugin.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/rdp/rdp_channels.c b/plugins/rdp/rdp_channels.c index f5089b7c1..249e56ef5 100644 --- a/plugins/rdp/rdp_channels.c +++ b/plugins/rdp/rdp_channels.c @@ -43,7 +43,7 @@ #include #include -void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e) +void remmina_rdp_OnChannelConnectedEventHandler(void* context, ChannelConnectedEventArgs* e) { TRACE_CALL(__func__); @@ -58,7 +58,7 @@ void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConn }else if (g_strcmp0(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0) { if (freerdp_settings_get_bool(rfi->settings, FreeRDP_SoftwareGdi)) { rfi->rdpgfxchan = TRUE; - gdi_graphics_pipeline_init(context->gdi, (RdpgfxClientContext*) e->pInterface); + gdi_graphics_pipeline_init(rfi->context.gdi, (RdpgfxClientContext*) e->pInterface); } else g_print("Unimplemented: channel %s connected but libfreerdp is in HardwareGdi mode\n", e->name); @@ -83,14 +83,14 @@ void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConn REMMINA_PLUGIN_DEBUG("Channel %s has been opened", e->name); } -void remmina_rdp_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e) +void remmina_rdp_OnChannelDisconnectedEventHandler(void* context, ChannelConnectedEventArgs* e) { TRACE_CALL(__func__); rfContext* rfi = (rfContext*)context; if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0) { if (freerdp_settings_get_bool(rfi->settings, FreeRDP_SoftwareGdi)) - gdi_graphics_pipeline_uninit(context->gdi, (RdpgfxClientContext*) e->pInterface); + gdi_graphics_pipeline_uninit(rfi->context.gdi, (RdpgfxClientContext*) e->pInterface); } REMMINA_PLUGIN_DEBUG("Channel %s has been closed", e->name); diff --git a/plugins/rdp/rdp_channels.h b/plugins/rdp/rdp_channels.h index 61d46f530..2bd3dcd87 100644 --- a/plugins/rdp/rdp_channels.h +++ b/plugins/rdp/rdp_channels.h @@ -48,8 +48,8 @@ G_BEGIN_DECLS -void remmina_rdp_OnChannelConnectedEventHandler(rdpContext *context, ChannelConnectedEventArgs *e); -void remmina_rdp_OnChannelDisconnectedEventHandler(rdpContext *context, ChannelConnectedEventArgs *e); +void remmina_rdp_OnChannelConnectedEventHandler(void *context, ChannelConnectedEventArgs *e); +void remmina_rdp_OnChannelDisconnectedEventHandler(void *context, ChannelConnectedEventArgs *e); G_END_DECLS diff --git a/plugins/rdp/rdp_plugin.c b/plugins/rdp/rdp_plugin.c index 100f18bc9..b7c6b8360 100644 --- a/plugins/rdp/rdp_plugin.c +++ b/plugins/rdp/rdp_plugin.c @@ -675,9 +675,9 @@ static BOOL remmina_rdp_pre_connect(freerdp *instance) freerdp_settings_set_uint32(settings, FreeRDP_OffscreenSupportLevel, 1); PubSub_SubscribeChannelConnected(instance->context->pubSub, - (pChannelConnectedEventHandler)remmina_rdp_OnChannelConnectedEventHandler); + remmina_rdp_OnChannelConnectedEventHandler); PubSub_SubscribeChannelDisconnected(instance->context->pubSub, - (pChannelDisconnectedEventHandler)remmina_rdp_OnChannelDisconnectedEventHandler); + remmina_rdp_OnChannelDisconnectedEventHandler); if (!freerdp_client_load_addins(channels, settings)) return FALSE; @@ -971,9 +971,9 @@ static void remmina_rdp_post_disconnect(freerdp *instance) return; PubSub_UnsubscribeChannelConnected(instance->context->pubSub, - (pChannelConnectedEventHandler)remmina_rdp_OnChannelConnectedEventHandler); + remmina_rdp_OnChannelConnectedEventHandler); PubSub_UnsubscribeChannelDisconnected(instance->context->pubSub, - (pChannelDisconnectedEventHandler)remmina_rdp_OnChannelDisconnectedEventHandler); + remmina_rdp_OnChannelDisconnectedEventHandler); /* The remaining cleanup will be continued on main thread by complete_cleanup_on_main_thread() */ } -- GitLab From 1286fdfff27fb0750efb8dcf2d5695b16bfedf6a Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 24 Jun 2022 11:53:15 +0200 Subject: [PATCH 3/5] Fixed a memory leak --- src/remmina_ssh_plugin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/remmina_ssh_plugin.c b/src/remmina_ssh_plugin.c index 47a45ea84..f78981371 100644 --- a/src/remmina_ssh_plugin.c +++ b/src/remmina_ssh_plugin.c @@ -1263,6 +1263,8 @@ remmina_plugin_ssh_init(RemminaProtocolWidget *gp) sshlogname = remmina_file_format_properties(remminafile, sshlogname); fp = g_strconcat(dir, "/", sshlogname, NULL); + g_free(sshlogname); + gpdata->vte_session_file = g_file_new_for_path(fp); g_free(fp); -- GitLab From 399d574f386333c4edf6a1c4412edbed8fbbed43 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 24 Jun 2022 11:55:58 +0200 Subject: [PATCH 4/5] Fixed memory leak --- src/remmina_ext_exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/remmina_ext_exec.c b/src/remmina_ext_exec.c index 1182266f1..6414c8c4a 100644 --- a/src/remmina_ext_exec.c +++ b/src/remmina_ext_exec.c @@ -125,7 +125,9 @@ GtkDialog* remmina_ext_exec_new(RemminaFile* remminafile, const char *remmina_ex g_error_free(error); } g_strfreev(argv); + g_free(cmd); return (pcspinner->dialog); } + g_free(cmd); return FALSE; } -- GitLab From 9d348df4adb53580e4732f784337f12cd8680e1b Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 24 Jun 2022 12:26:22 +0200 Subject: [PATCH 5/5] Fixed ChannelDisconnected argument types --- plugins/rdp/rdp_channels.c | 2 +- plugins/rdp/rdp_channels.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/rdp/rdp_channels.c b/plugins/rdp/rdp_channels.c index 249e56ef5..e90c563a4 100644 --- a/plugins/rdp/rdp_channels.c +++ b/plugins/rdp/rdp_channels.c @@ -83,7 +83,7 @@ void remmina_rdp_OnChannelConnectedEventHandler(void* context, ChannelConnectedE REMMINA_PLUGIN_DEBUG("Channel %s has been opened", e->name); } -void remmina_rdp_OnChannelDisconnectedEventHandler(void* context, ChannelConnectedEventArgs* e) +void remmina_rdp_OnChannelDisconnectedEventHandler(void* context, ChannelDisconnectedEventArgs* e) { TRACE_CALL(__func__); rfContext* rfi = (rfContext*)context; diff --git a/plugins/rdp/rdp_channels.h b/plugins/rdp/rdp_channels.h index 2bd3dcd87..92ae3efbd 100644 --- a/plugins/rdp/rdp_channels.h +++ b/plugins/rdp/rdp_channels.h @@ -49,7 +49,7 @@ G_BEGIN_DECLS void remmina_rdp_OnChannelConnectedEventHandler(void *context, ChannelConnectedEventArgs *e); -void remmina_rdp_OnChannelDisconnectedEventHandler(void *context, ChannelConnectedEventArgs *e); +void remmina_rdp_OnChannelDisconnectedEventHandler(void *context, ChannelDisconnectedEventArgs *e); G_END_DECLS -- GitLab