Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'remmina/src/remmina_protocol_widget.c')
-rw-r--r--remmina/src/remmina_protocol_widget.c230
1 files changed, 119 insertions, 111 deletions
diff --git a/remmina/src/remmina_protocol_widget.c b/remmina/src/remmina_protocol_widget.c
index f688c4a22..22911d126 100644
--- a/remmina/src/remmina_protocol_widget.c
+++ b/remmina/src/remmina_protocol_widget.c
@@ -100,24 +100,24 @@ static void remmina_protocol_widget_class_init(RemminaProtocolWidgetClass *klass
{
TRACE_CALL("remmina_protocol_widget_class_init");
remmina_protocol_widget_signals[CONNECT_SIGNAL] = g_signal_new("connect", G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, connect), NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, connect), NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
remmina_protocol_widget_signals[DISCONNECT_SIGNAL] = g_signal_new("disconnect", G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, disconnect), NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, disconnect), NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
remmina_protocol_widget_signals[DESKTOP_RESIZE_SIGNAL] = g_signal_new("desktop-resize", G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, desktop_resize), NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, desktop_resize), NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
remmina_protocol_widget_signals[UPDATE_ALIGN_SIGNAL] = g_signal_new("update-align", G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, update_align), NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(RemminaProtocolWidgetClass, update_align), NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void remmina_protocol_widget_init_cancel(RemminaInitDialog *dialog, gint response_id, RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_protocol_widget_init_cancel");
if ((response_id == GTK_RESPONSE_CANCEL || response_id == GTK_RESPONSE_DELETE_EVENT)
- && dialog->mode == REMMINA_INIT_MODE_CONNECTING)
+ && dialog->mode == REMMINA_INIT_MODE_CONNECTING)
{
remmina_protocol_widget_close_connection(gp);
}
@@ -210,12 +210,12 @@ void remmina_protocol_widget_open_connection_real(gpointer data)
/* Locate the protocol plugin */
plugin = (RemminaProtocolPlugin*) remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL,
- remmina_file_get_string(remminafile, "protocol"));
+ remmina_file_get_string(remminafile, "protocol"));
if (!plugin || !plugin->init || !plugin->open_connection)
{
remmina_protocol_widget_set_error(gp, _("Protocol plugin %s is not installed."),
- remmina_file_get_string(remminafile, "protocol"));
+ remmina_file_get_string(remminafile, "protocol"));
remmina_protocol_widget_close_connection(gp);
return;
}
@@ -320,13 +320,13 @@ gboolean remmina_protocol_widget_close_connection(RemminaProtocolWidget* gp)
retval = gp->priv->plugin->close_connection(gp);
- #ifdef HAVE_LIBSSH
+#ifdef HAVE_LIBSSH
if (gp->priv->ssh_tunnel)
{
remmina_ssh_tunnel_free(gp->priv->ssh_tunnel);
gp->priv->ssh_tunnel = NULL;
}
- #endif
+#endif
return retval;
}
@@ -351,13 +351,15 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI
GdkKeymapKey *keys;
gint n_keys;
/* Single keystroke replace */
- typedef struct _KeystrokeReplace {
+ typedef struct _KeystrokeReplace
+ {
gchar *search;
gchar *replace;
guint keyval;
} KeystrokeReplace;
/* Special characters to replace */
- KeystrokeReplace keystrokes_replaces[] = {
+ KeystrokeReplace keystrokes_replaces[] =
+ {
{ "\\n", "\n", GDK_KEY_Return },
{ "\\t", "\t", GDK_KEY_Tab },
{ "\\b", "\b", GDK_KEY_BackSpace },
@@ -372,11 +374,12 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI
for (i = 0; keystrokes_replaces[i].replace; i++)
{
remmina_public_str_replace_in_place(keystrokes,
- keystrokes_replaces[i].search,
- keystrokes_replaces[i].replace);
+ keystrokes_replaces[i].search,
+ keystrokes_replaces[i].replace);
}
keyvals = (guint *) g_malloc(strlen(keystrokes));
- while(TRUE) {
+ while(TRUE)
+ {
/* Process each character in the keystrokes */
character = g_utf8_get_char_validated(iter, -1);
if (character == 0)
@@ -398,7 +401,8 @@ void remmina_protocol_widget_send_keystrokes(RemminaProtocolWidget* gp, GtkMenuI
if (character)
{
/* get keyval without modifications */
- if (!gdk_keymap_get_entries_for_keyval(keymap, keyval, &keys, &n_keys)) {
+ if (!gdk_keymap_get_entries_for_keyval(keymap, keyval, &keys, &n_keys))
+ {
g_warning("keyval 0x%04x has no keycode!", keyval);
iter = g_utf8_find_next_char(iter, NULL);
continue;
@@ -461,7 +465,7 @@ gboolean remmina_protocol_widget_query_feature_by_type(RemminaProtocolWidget* gp
#ifdef HAVE_LIBSSH
if (type == REMMINA_PROTOCOL_FEATURE_TYPE_TOOL &&
- remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE))
+ remmina_file_get_int (gp->priv->remmina_file, "ssh_enabled", FALSE))
{
return TRUE;
}
@@ -501,26 +505,26 @@ void remmina_protocol_widget_call_feature_by_ref(RemminaProtocolWidget* gp, cons
switch (feature->id)
{
#ifdef HAVE_LIBSSH
- case REMMINA_PROTOCOL_FEATURE_TOOL_SSH:
+ case REMMINA_PROTOCOL_FEATURE_TOOL_SSH:
if (gp->priv->ssh_tunnel)
{
remmina_connection_window_open_from_file_full (
- remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL);
+ remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SSH"), NULL, gp->priv->ssh_tunnel, NULL);
return;
}
break;
- case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP:
+ case REMMINA_PROTOCOL_FEATURE_TOOL_SFTP:
if (gp->priv->ssh_tunnel)
{
remmina_connection_window_open_from_file_full (
- remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL);
+ remmina_file_dup_temp_protocol (gp->priv->remmina_file, "SFTP"), NULL, gp->priv->ssh_tunnel, NULL);
return;
}
break;
#endif
- default:
- break;
+ default:
+ break;
}
gp->priv->plugin->call_feature(gp, feature);
}
@@ -572,7 +576,7 @@ static gboolean remmina_protocol_widget_init_tunnel (RemminaProtocolWidget* gp)
tunnel = remmina_ssh_tunnel_new_from_file (gp->priv->remmina_file);
remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog),
- _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server);
+ _("Connecting to SSH server %s..."), REMMINA_SSH (tunnel)->server);
if (!remmina_ssh_init_session (REMMINA_SSH (tunnel)))
{
@@ -636,7 +640,7 @@ gchar* remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget* gp, gi
}
remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog),
- _("Connecting to %s through SSH tunnel..."), server);
+ _("Connecting to %s through SSH tunnel..."), server);
if (remmina_file_get_int (gp->priv->remmina_file, "ssh_loopback", FALSE))
{
@@ -678,7 +682,7 @@ gboolean remmina_protocol_widget_start_reverse_tunnel(RemminaProtocolWidget* gp,
}
remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog),
- _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0));
+ _("Waiting for an incoming SSH tunnel at port %i..."), remmina_file_get_int (gp->priv->remmina_file, "listenport", 0));
if (!remmina_ssh_tunnel_reverse (gp->priv->ssh_tunnel, remmina_file_get_int (gp->priv->remmina_file, "listenport", 0), local_port))
{
@@ -694,64 +698,64 @@ gboolean remmina_protocol_widget_ssh_exec(RemminaProtocolWidget* gp, gboolean wa
{
TRACE_CALL("remmina_protocol_widget_ssh_exec");
#ifdef HAVE_LIBSSH
- RemminaSSHTunnel *tunnel = gp->priv->ssh_tunnel;
- ssh_channel channel;
- gint status;
- gboolean ret = FALSE;
- gchar *cmd, *ptr;
- va_list args;
-
- if ((channel = channel_new (REMMINA_SSH (tunnel)->session)) == NULL)
- {
- return FALSE;
- }
+ RemminaSSHTunnel *tunnel = gp->priv->ssh_tunnel;
+ ssh_channel channel;
+ gint status;
+ gboolean ret = FALSE;
+ gchar *cmd, *ptr;
+ va_list args;
- va_start (args, fmt);
- cmd = g_strdup_vprintf (fmt, args);
- va_end (args);
+ if ((channel = ssh_channel_new (REMMINA_SSH (tunnel)->session)) == NULL)
+ {
+ return FALSE;
+ }
+
+ va_start (args, fmt);
+ cmd = g_strdup_vprintf (fmt, args);
+ va_end (args);
- if (channel_open_session (channel) == SSH_OK &&
- channel_request_exec (channel, cmd) == SSH_OK)
+ if (ssh_channel_open_session (channel) == SSH_OK &&
+ ssh_channel_request_exec (channel, cmd) == SSH_OK)
+ {
+ if (wait)
{
- if (wait)
- {
- channel_send_eof (channel);
- status = channel_get_exit_status (channel);
- ptr = strchr (cmd, ' ');
- if (ptr) *ptr = '\0';
- switch (status)
- {
- case 0:
- ret = TRUE;
- break;
- case 127:
- remmina_ssh_set_application_error (REMMINA_SSH (tunnel),
- _("Command %s not found on SSH server"), cmd);
- break;
- default:
- remmina_ssh_set_application_error (REMMINA_SSH (tunnel),
- _("Command %s failed on SSH server (status = %i)."), cmd,status);
- break;
- }
- }
- else
+ ssh_channel_send_eof (channel);
+ status = ssh_channel_get_exit_status (channel);
+ ptr = strchr (cmd, ' ');
+ if (ptr) *ptr = '\0';
+ switch (status)
{
+ case 0:
ret = TRUE;
+ break;
+ case 127:
+ remmina_ssh_set_application_error (REMMINA_SSH (tunnel),
+ _("Command %s not found on SSH server"), cmd);
+ break;
+ default:
+ remmina_ssh_set_application_error (REMMINA_SSH (tunnel),
+ _("Command %s failed on SSH server (status = %i)."), cmd,status);
+ break;
}
}
else
{
- remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to execute command: %s"));
+ ret = TRUE;
}
- g_free(cmd);
- if (wait)
- channel_close (channel);
- channel_free (channel);
- return ret;
+ }
+ else
+ {
+ remmina_ssh_set_error (REMMINA_SSH (tunnel), _("Failed to execute command: %s"));
+ }
+ g_free(cmd);
+ if (wait)
+ ssh_channel_close (channel);
+ ssh_channel_free (channel);
+ return ret;
#else
- return FALSE;
+ return FALSE;
#endif
}
@@ -767,7 +771,7 @@ static gboolean remmina_protocol_widget_tunnel_init_callback (RemminaSSHTunnel *
remmina_public_get_server_port (remmina_file_get_string (gp->priv->remmina_file, "server"), 177, &server, &port);
ret = ((RemminaXPortTunnelInitFunc) gp->priv->init_func) (gp,
- tunnel->remotedisplay, (tunnel->bindlocalhost ? "localhost" : server), port);
+ tunnel->remotedisplay, (tunnel->bindlocalhost ? "localhost" : server), port);
g_free(server);
return ret;
@@ -804,7 +808,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R
if (!remmina_protocol_widget_init_tunnel (gp)) return FALSE;
remmina_init_dialog_set_status (REMMINA_INIT_DIALOG (gp->priv->init_dialog),
- _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server"));
+ _("Connecting to %s through SSH tunnel..."), remmina_file_get_string (gp->priv->remmina_file, "server"));
gp->priv->init_func = init_func;
gp->priv->ssh_tunnel->init_func = remmina_protocol_widget_tunnel_init_callback;
@@ -819,7 +823,7 @@ gboolean remmina_protocol_widget_start_xport_tunnel(RemminaProtocolWidget* gp, R
if (!remmina_ssh_tunnel_xport (gp->priv->ssh_tunnel, bindlocalhost))
{
remmina_protocol_widget_set_error (gp, "Failed to open channel : %s",
- ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session));
+ ssh_get_error (REMMINA_SSH (gp->priv->ssh_tunnel)->session));
return FALSE;
}
@@ -941,26 +945,26 @@ gint remmina_protocol_widget_init_authpwd(RemminaProtocolWidget* gp, RemminaAuth
switch (authpwd_type)
{
- case REMMINA_AUTHPWD_TYPE_PROTOCOL:
- s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol"));
- break;
- case REMMINA_AUTHPWD_TYPE_SSH_PWD:
- s = g_strdup(_("SSH password"));
- break;
- case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY:
- s = g_strdup(_("SSH private key passphrase"));
- break;
- default:
- s = g_strdup(_("Password"));
- break;
+ case REMMINA_AUTHPWD_TYPE_PROTOCOL:
+ s = g_strdup_printf(_("%s password"), remmina_file_get_string(remminafile, "protocol"));
+ break;
+ case REMMINA_AUTHPWD_TYPE_SSH_PWD:
+ s = g_strdup(_("SSH password"));
+ break;
+ case REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY:
+ s = g_strdup(_("SSH private key passphrase"));
+ break;
+ default:
+ s = g_strdup(_("Password"));
+ break;
}
ret = remmina_init_dialog_authpwd(
- REMMINA_INIT_DIALOG(gp->priv->init_dialog),
- s,
- remmina_file_get_filename(remminafile) != NULL &&
- allow_password_saving &&
- authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD &&
- authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY);
+ REMMINA_INIT_DIALOG(gp->priv->init_dialog),
+ s,
+ remmina_file_get_filename(remminafile) != NULL &&
+ allow_password_saving &&
+ authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PWD &&
+ authpwd_type != REMMINA_AUTHPWD_TYPE_SSH_PRIVKEY);
g_free(s);
return ret;
@@ -972,11 +976,11 @@ gint remmina_protocol_widget_init_authuserpwd(RemminaProtocolWidget* gp, gboolea
RemminaFile* remminafile = gp->priv->remmina_file;
return remmina_init_dialog_authuserpwd(
- REMMINA_INIT_DIALOG(gp->priv->init_dialog),
- want_domain,
- remmina_file_get_string(remminafile, "username"),
- want_domain ? remmina_file_get_string(remminafile, "domain") : NULL,
- (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving);
+ REMMINA_INIT_DIALOG(gp->priv->init_dialog),
+ want_domain,
+ remmina_file_get_string(remminafile, "username"),
+ want_domain ? remmina_file_get_string(remminafile, "domain") : NULL,
+ (remmina_file_get_filename(remminafile) != NULL) && allow_password_saving);
}
gint remmina_protocol_widget_init_certificate(RemminaProtocolWidget* gp, const gchar* subject, const gchar* issuer, const gchar* fingerprint)
@@ -1020,8 +1024,8 @@ gint remmina_protocol_widget_init_authx509(RemminaProtocolWidget* gp)
RemminaFile* remminafile = gp->priv->remmina_file;
return remmina_init_dialog_authx509(REMMINA_INIT_DIALOG(gp->priv->init_dialog),
- remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"),
- remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey"));
+ remmina_file_get_string(remminafile, "cacert"), remmina_file_get_string(remminafile, "cacrl"),
+ remmina_file_get_string(remminafile, "clientcert"), remmina_file_get_string(remminafile, "clientkey"));
}
gchar* remmina_protocol_widget_init_get_cacert(RemminaProtocolWidget* gp)
@@ -1068,7 +1072,8 @@ void remmina_protocol_widget_init_save_cred(RemminaProtocolWidget* gp)
gchar* s;
gboolean save = FALSE;
- if ( !remmina_masterthread_exec_is_main_thread() ) {
+ if ( !remmina_masterthread_exec_is_main_thread() )
+ {
/* Allow the execution of this function from a non main thread */
RemminaMTExecData *d;
d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) );
@@ -1126,15 +1131,15 @@ void remmina_protocol_widget_init_show_listen(RemminaProtocolWidget* gp, gint po
{
TRACE_CALL("remmina_protocol_widget_init_show_listen");
remmina_init_dialog_set_status(REMMINA_INIT_DIALOG(gp->priv->init_dialog),
- _("Listening on port %i for an incoming %s connection..."), port,
- remmina_file_get_string(gp->priv->remmina_file, "protocol"));
+ _("Listening on port %i for an incoming %s connection..."), port,
+ remmina_file_get_string(gp->priv->remmina_file, "protocol"));
}
void remmina_protocol_widget_init_show_retry(RemminaProtocolWidget* gp)
{
TRACE_CALL("remmina_protocol_widget_init_show_retry");
remmina_init_dialog_set_status_temp(REMMINA_INIT_DIALOG(gp->priv->init_dialog),
- _("Authentication failed. Trying to reconnect..."));
+ _("Authentication failed. Trying to reconnect..."));
}
void remmina_protocol_widget_init_show(RemminaProtocolWidget* gp)
@@ -1156,7 +1161,7 @@ static void remmina_protocol_widget_chat_on_destroy(RemminaProtocolWidget* gp)
}
void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *name,
- void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp))
+ void(*on_send)(RemminaProtocolWidget* gp, const gchar *text), void(*on_destroy)(RemminaProtocolWidget* gp))
{
TRACE_CALL("remmina_protocol_widget_chat_open");
if (gp->priv->chat_window)
@@ -1168,7 +1173,7 @@ void remmina_protocol_widget_chat_open(RemminaProtocolWidget* gp, const gchar *n
gp->priv->chat_window = remmina_chat_window_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(gp))), name);
g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "send", G_CALLBACK(on_send), gp);
g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy",
- G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp);
+ G_CALLBACK(remmina_protocol_widget_chat_on_destroy), gp);
g_signal_connect_swapped(G_OBJECT(gp->priv->chat_window), "destroy", G_CALLBACK(on_destroy), gp);
gtk_widget_show(gp->priv->chat_window);
}
@@ -1190,7 +1195,8 @@ void remmina_protocol_widget_chat_receive(RemminaProtocolWidget* gp, const gchar
if (gp->priv->chat_window)
{
- if ( !remmina_masterthread_exec_is_main_thread() ) {
+ if ( !remmina_masterthread_exec_is_main_thread() )
+ {
/* Allow the execution of this function from a non main thread */
RemminaMTExecData *d;
d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) );
@@ -1231,7 +1237,8 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k
event.string = "";
event.group = 0;
- if (action & GDK_KEY_PRESS) {
+ if (action & GDK_KEY_PRESS)
+ {
/* Press the requested buttons */
event.type = GDK_KEY_PRESS;
for (i = 0; i < keyvals_length; i++)
@@ -1243,7 +1250,8 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k
}
}
- if (action & GDK_KEY_RELEASE) {
+ if (action & GDK_KEY_RELEASE)
+ {
/* Release the requested buttons in reverse order */
event.type = GDK_KEY_RELEASE;
for (i = (keyvals_length - 1); i >= 0; i--)