Commit b53ca5e5 authored by Antenore Gatta's avatar Antenore Gatta

SSH/SFTP protocol editor enhancement

parent 7e82138c
......@@ -57,20 +57,6 @@
G_DEFINE_TYPE( RemminaFileEditor, remmina_file_editor, GTK_TYPE_DIALOG)
#ifdef HAVE_LIBSSH
static const gchar* charset_list = "ASCII,BIG5,"
"CP437,CP720,CP737,CP775,CP850,CP852,CP855,"
"CP857,CP858,CP862,CP866,CP874,CP1125,CP1250,"
"CP1251,CP1252,CP1253,CP1254,CP1255,CP1256,"
"CP1257,CP1258,"
"EUC-JP,EUC-KR,GBK,"
"ISO-8859-1,ISO-8859-2,ISO-8859-3,ISO-8859-4,"
"ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,"
"ISO-8859-9,ISO-8859-10,ISO-8859-11,ISO-8859-12,"
"ISO-8859-13,ISO-8859-14,ISO-8859-15,ISO-8859-16,"
"KOI8-R,SJIS,UTF-8";
#endif
static const gchar* server_tips = N_( "<tt><big>"
"Supported formats\n"
"* server\n"
......@@ -300,16 +286,7 @@ static void remmina_file_editor_ssh_enabled_check_on_toggled(GtkToggleButton* to
if (gfe->priv->ssh_enabled_check)
{
if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SSH ||
ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP)
{
gtk_widget_set_sensitive(gfe->priv->ssh_enabled_check, 1);
gtk_widget_set_sensitive(gfe->priv->ssh_loopback_check, 1);
}
else
{
enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_enabled_check));
}
enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gfe->priv->ssh_enabled_check));
if (gfe->priv->ssh_loopback_check)
gtk_widget_set_sensitive(gfe->priv->ssh_loopback_check, enabled);
if (gfe->priv->ssh_server_default_radio)
......@@ -795,95 +772,77 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor* gfe, RemminaPr
/* The SSH tab (implementation) */
grid = remmina_file_editor_create_notebook_tab (gfe, "dialog-password",
"SSH Settings", 9, 3);
"SSH Tunnel", 9, 3);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(hbox);
gtk_grid_attach (GTK_GRID(grid), hbox, 0, 0, 3, 1);
row++;
if (!(ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SSH ||
ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP))
{
widget = gtk_check_button_new_with_label (_("Enable SSH tunnel"));
gtk_widget_show(widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(widget), "toggled",
G_CALLBACK(remmina_file_editor_ssh_enabled_check_on_toggled), gfe);
priv->ssh_enabled_check = widget;
widget = gtk_check_button_new_with_label (_("Enable SSH tunnel"));
gtk_widget_show(widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(widget), "toggled",
G_CALLBACK(remmina_file_editor_ssh_enabled_check_on_toggled), gfe);
priv->ssh_enabled_check = widget;
widget = gtk_check_button_new_with_label (_("Tunnel via loopback address"));
gtk_widget_show(widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
priv->ssh_loopback_check = widget;
widget = gtk_check_button_new_with_label (_("Tunnel via loopback address"));
gtk_widget_show(widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
priv->ssh_loopback_check = widget;
row++;
}
/* SSH Server group */
row++;
switch (ssh_setting)
{
case REMMINA_PROTOCOL_SSH_SETTING_TUNNEL:
s = g_strdup_printf(_("Same server at port %i"), DEFAULT_SSH_PORT);
widget = gtk_radio_button_new_with_label (NULL, s);
g_free(s);
gtk_widget_show(widget);
gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 3, 1);
priv->ssh_server_default_radio = widget;
row++;
widget = gtk_radio_button_new_with_label_from_widget (
GTK_RADIO_BUTTON(priv->ssh_server_default_radio), _("Custom"));
gtk_widget_show(widget);
gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 1, 1);
g_signal_connect(G_OBJECT(widget), "toggled",
G_CALLBACK(remmina_file_editor_ssh_server_custom_radio_on_toggled), gfe);
priv->ssh_server_custom_radio = widget;
widget = gtk_entry_new ();
gtk_widget_show(widget);
gtk_entry_set_max_length (GTK_ENTRY(widget), 100);
gtk_widget_set_tooltip_markup (widget, _(server_tips2));
gtk_grid_attach (GTK_GRID(grid), widget, 1, row, 2, 1);
priv->ssh_server_entry = widget;
row++;
break;
case REMMINA_PROTOCOL_SSH_SETTING_TUNNEL:
s = g_strdup_printf(_("Same server at port %i"), DEFAULT_SSH_PORT);
widget = gtk_radio_button_new_with_label (NULL, s);
g_free(s);
gtk_widget_show(widget);
gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 3, 1);
priv->ssh_server_default_radio = widget;
row++;
widget = gtk_radio_button_new_with_label_from_widget (
GTK_RADIO_BUTTON(priv->ssh_server_default_radio), _("Custom"));
gtk_widget_show(widget);
gtk_grid_attach (GTK_GRID(grid), widget, 0, row, 1, 1);
g_signal_connect(G_OBJECT(widget), "toggled",
G_CALLBACK(remmina_file_editor_ssh_server_custom_radio_on_toggled), gfe);
priv->ssh_server_custom_radio = widget;
widget = gtk_entry_new ();
gtk_widget_show(widget);
gtk_entry_set_max_length (GTK_ENTRY(widget), 100);
gtk_widget_set_tooltip_markup (widget, _(server_tips2));
gtk_grid_attach (GTK_GRID(grid), widget, 1, row, 2, 1);
priv->ssh_server_entry = widget;
row++;
break;
case REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL:
priv->ssh_server_default_radio = NULL;
priv->ssh_server_custom_radio = NULL;
case REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL:
priv->ssh_server_default_radio = NULL;
priv->ssh_server_custom_radio = NULL;
priv->ssh_server_entry = remmina_file_editor_create_text (gfe, grid, 1, 0,
_("Server"), NULL);
gtk_widget_set_tooltip_markup (priv->ssh_server_entry, _(server_tips));
row++;
break;
case REMMINA_PROTOCOL_SSH_SETTING_SSH:
case REMMINA_PROTOCOL_SSH_SETTING_SFTP:
priv->ssh_server_default_radio = NULL;
priv->ssh_server_custom_radio = NULL;
priv->ssh_server_entry = NULL;
priv->ssh_server_entry = remmina_file_editor_create_text (gfe, grid, 1, 0,
_("Server"), NULL);
gtk_widget_set_tooltip_markup (priv->ssh_server_entry, _(server_tips));
row++;
break;
case REMMINA_PROTOCOL_SSH_SETTING_SSH:
case REMMINA_PROTOCOL_SSH_SETTING_SFTP:
priv->ssh_server_default_radio = NULL;
priv->ssh_server_custom_radio = NULL;
priv->ssh_server_entry = NULL;
break;
break;
default:
break;
default:
break;
}
priv->ssh_charset_combo = remmina_file_editor_create_combo (gfe, grid, row + 3, 0,
_("Character set"), charset_list, remmina_file_get_string (priv->remmina_file, "ssh_charset"));
row++;
if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SSH)
{
widget = remmina_file_editor_create_text (gfe, grid, row + 7, 1,
_("Startup program"), NULL);
cs = remmina_file_get_string (priv->remmina_file, "exec");
gtk_entry_set_text(GTK_ENTRY(widget), cs ? cs : "");
g_hash_table_insert(priv->setting_widgets, "exec", widget);
row++;
}
else if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP)
if (ssh_setting == REMMINA_PROTOCOL_SSH_SETTING_SFTP)
{
widget = remmina_file_editor_create_text (gfe, grid, row + 8, 1,
_("Startup path"), NULL);
......
......@@ -277,6 +277,16 @@ remmina_plugin_sftp_call_feature (RemminaProtocolWidget *gp, const RemminaProtoc
}
}
/* Array of key/value pairs for ssh auth type*/
static gpointer ssh_auth_type[] =
{
"password", N_("Password"),
"ssh_agent", N_("SSH agent"),
"ssh_pubkey_auto", N_("Public key (automatic)"),
"ssh_identity", N_("SSH identfy file"),
NULL
};
/* Array for available features.
* The last element of the array must be REMMINA_PROTOCOL_FEATURE_TYPE_END. */
static const RemminaProtocolFeature remmina_plugin_sftp_features[] =
......@@ -300,6 +310,8 @@ static const RemminaProtocolSetting remmina_sftp_basic_settings[] =
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, "ssh_server", NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_username", N_("User name"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "ssh_password", N_("User password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "ssh_auth_type", N_("Authentication type"), FALSE, ssh_auth_type, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_FILE, "ssh_privatekey", N_("Identity file"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL }
};
......@@ -315,7 +327,7 @@ static RemminaProtocolPlugin remmina_plugin_sftp =
"remmina-sftp", // Icon for SSH connection
remmina_sftp_basic_settings, // Array for basic settings
NULL, // Array for advanced settings
REMMINA_PROTOCOL_SSH_SETTING_SFTP, // SSH settings type
REMMINA_PROTOCOL_SSH_SETTING_TUNNEL, // SSH settings type
remmina_plugin_sftp_features, // Array for available features
remmina_plugin_sftp_init, // Plugin initialization
remmina_plugin_sftp_open_connection, // Plugin open connection
......
......@@ -60,7 +60,6 @@
/* Palette colors taken from sakura */
#define PALETTE_SIZE 16
/* 16 color palettes in GdkRGBA format (red, green, blue, alpha)
* Text displayed in the first 8 colors (0-7) is meek (uses thin strokes).
* Text displayed in the second 8 colors (8-15) is bold (uses thick strokes). */
......@@ -650,6 +649,69 @@ remmina_plugin_ssh_call_feature (RemminaProtocolWidget *gp, const RemminaProtoco
}
}
/* Array of key/value pairs for ssh auth type*/
static gpointer ssh_auth_type[] =
{
"password", N_("Password"),
"ssh_agent", N_("SSH agent"),
"ssh_pubkey_auto", N_("Public key (automatic)"),
"ssh_identity", N_("SSH identfy file"),
NULL
};
/* Charset list */
static gpointer ssh_charset_list[] =
{
"", "",
"", "ASCII",
"", "BIG5",
"", "CP437",
"", "CP720",
"", "CP737",
"", "CP775",
"", "CP850",
"", "CP852",
"", "CP855",
"", "CP857",
"", "CP858",
"", "CP862",
"", "CP866",
"", "CP874",
"", "CP1125",
"", "CP1250",
"", "CP1251",
"", "CP1252",
"", "CP1253",
"", "CP1254",
"", "CP1255",
"", "CP1256",
"", "CP1257",
"", "CP1258",
"", "EUC-JP",
"", "EUC-KR",
"", "GBK",
"", "ISO-8859-1",
"", "ISO-8859-2",
"", "ISO-8859-3",
"", "ISO-8859-4",
"", "ISO-8859-5",
"", "ISO-8859-6",
"", "ISO-8859-7",
"", "ISO-8859-8",
"", "ISO-8859-9",
"", "ISO-8859-10",
"", "ISO-8859-11",
"", "ISO-8859-12",
"", "ISO-8859-13",
"", "ISO-8859-14",
"", "ISO-8859-15",
"", "ISO-8859-16",
"", "KOI8-R",
"", "SJIS",
"", "UTF-8",
NULL
};
/* Array for available features.
* The last element of the array must be REMMINA_PROTOCOL_FEATURE_TYPE_END. */
static RemminaProtocolFeature remmina_plugin_ssh_features[] =
......@@ -674,9 +736,26 @@ static const RemminaProtocolSetting remmina_ssh_basic_settings[] =
{ REMMINA_PROTOCOL_SETTING_TYPE_SERVER, "ssh_server", NULL, FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "ssh_username", N_("User name"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD, "ssh_password", N_("User password"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "ssh_auth_type", N_("Authentication type"), FALSE, ssh_auth_type, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_FILE, "ssh_privatekey", N_("Identity file"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL }
};
/* Array of RemminaProtocolSetting for advanced settings.
* Each item is composed by:
* a) RemminaProtocolSettingType for setting type
* b) Setting name
* c) Setting description
* d) Compact disposition
* e) Values for REMMINA_PROTOCOL_SETTING_TYPE_SELECT or REMMINA_PROTOCOL_SETTING_TYPE_COMBO
* f) Unused pointer
*/
static const RemminaProtocolSetting remmina_ssh_advanced_settings[] =
{
{ REMMINA_PROTOCOL_SETTING_TYPE_SELECT, "ssh_charset", N_("Character set"), FALSE, ssh_charset_list, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_TEXT, "exec", N_("Startup program"), FALSE, NULL, NULL },
{ REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL }
};
/* Protocol plugin definition and features */
static RemminaProtocolPlugin remmina_plugin_ssh =
......@@ -689,8 +768,8 @@ static RemminaProtocolPlugin remmina_plugin_ssh =
"utilities-terminal", // Icon for normal connection
"utilities-terminal", // Icon for SSH connection
remmina_ssh_basic_settings, // Array for basic settings
NULL, // Array for advanced settings
REMMINA_PROTOCOL_SSH_SETTING_SSH, // SSH settings type
remmina_ssh_advanced_settings, // Array for advanced settings
REMMINA_PROTOCOL_SSH_SETTING_TUNNEL, // SSH settings type
remmina_plugin_ssh_features, // Array for available features
remmina_plugin_ssh_init, // Plugin initialization
remmina_plugin_ssh_open_connection, // Plugin open connection
......@@ -713,7 +792,6 @@ remmina_ssh_plugin_register (void)
ssh_threads_set_callbacks(ssh_threads_get_pthread());
ssh_init();
}
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment