Skip to content

Commit

Permalink
Merge pull request #393 from giox069/next
Browse files Browse the repository at this point in the history
Varoius fixes
  • Loading branch information
giox069 committed Dec 6, 2014
2 parents cda5584 + 38fb86f commit fb99c8b
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 67 deletions.
2 changes: 1 addition & 1 deletion cmake/FindFREERDP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Boston, MA 02111-1307, USA.

find_package(PkgConfig)
pkg_check_modules(PC_FREERDP freerdp>=1.0)
pkg_check_modules(PC_FREERDP freerdp>=1.2)
set(FREERDP_DEFINITIONS ${PC_FREERDP_CFLAGS_OTHER})

find_path(FREERDP_INCLUDE_DIR NAMES freerdp/freerdp.h
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindLIBSSH.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Boston, MA 02111-1307, USA.

find_package(PkgConfig)
pkg_check_modules(PC_LIBSSH libssh>=0.4)
pkg_check_modules(PC_LIBSSH libssh>=0.6)
set(LIBSSH_DEFINITIONS ${PC_LIBSSH_CFLAGS_OTHER})

find_path(LIBSSH_INCLUDE_DIR NAMES libssh/libssh.h
Expand Down
54 changes: 21 additions & 33 deletions remmina-plugins/nx/nx_session.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Remmina - The GTK+ Remote Desktop Client
* Copyright (C) 2010 Vic Lee
* Copyright (C) 2010 Vic Lee
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* In addition, as a special exception, the copyright holders give
Expand Down Expand Up @@ -166,8 +166,8 @@ void remmina_nx_session_free(RemminaNXSession *nx)
}
if (nx->channel)
{
channel_close(nx->channel);
channel_free(nx->channel);
ssh_channel_close(nx->channel);
ssh_channel_free(nx->channel);
}
if (nx->server_sock >= 0)
{
Expand Down Expand Up @@ -538,26 +538,23 @@ static void remmina_nx_session_send_command(RemminaNXSession *nx, const gchar *c

va_start (args, cmdfmt);
cmd = g_strdup_vprintf (cmdfmt, args);
channel_write (nx->channel, cmd, strlen (cmd));
ssh_channel_write (nx->channel, cmd, strlen (cmd));
g_free(cmd);

ssh_set_fd_towrite (nx->session);
channel_write (nx->channel, "\n", 1);
ssh_channel_write (nx->channel, "\n", 1);
}

gboolean remmina_nx_session_open(RemminaNXSession *nx, const gchar *server, guint port, const gchar *private_key_file,
RemminaNXPassphraseCallback passphrase_func, gpointer userdata)
{
gint ret;
ssh_private_key privkey;
ssh_public_key pubkey;
ssh_string pubkeystr;
ssh_key priv_key;
gint keytype;
gboolean encrypted;
gchar *passphrase = NULL;
gchar tmpfile[L_tmpnam + 1];

nx ->session = ssh_new();
nx->session = ssh_new();
ssh_options_set(nx->session, SSH_OPTIONS_HOST, server);
ssh_options_set(nx->session, SSH_OPTIONS_PORT, &port);
ssh_options_set(nx->session, SSH_OPTIONS_USER, "nx");
Expand All @@ -573,54 +570,45 @@ nx ->session = ssh_new();
{
return FALSE;
}
privkey = privatekey_from_file(nx->session, private_key_file, keytype, (passphrase ? passphrase : ""));
if ( ssh_pki_import_privkey_file(private_key_file, (passphrase ? passphrase : ""), NULL, NULL, &priv_key) != SSH_OK ) {
remmina_nx_session_set_application_error(nx, "Error importing private key from file.");
g_free(passphrase);
return FALSE;
}
g_free(passphrase);
}
else
{
/* Use NoMachine's default nx private key */
if ((tmpnam(tmpfile)) == NULL || !g_file_set_contents(tmpfile, nx_default_private_key, -1, NULL))
{
remmina_nx_session_set_application_error(nx, "Failed to create temporary private key file.");
if ( ssh_pki_import_privkey_base64(nx_default_private_key, NULL, NULL, NULL, &priv_key) != SSH_OK ) {
remmina_nx_session_set_application_error(nx, "Failed to import NX default private key.");
return FALSE;
}
privkey = privatekey_from_file(nx->session, tmpfile, REMMINA_SSH_TYPE_DSS, "");
g_unlink(tmpfile);
}

if (privkey == NULL)
{
remmina_nx_session_set_error(nx, "Invalid private key file: %s");
return FALSE;
}
pubkey = publickey_from_privatekey(privkey);
pubkeystr = publickey_to_string(pubkey);
publickey_free(pubkey);

if (ssh_connect(nx->session))
{
string_free(pubkeystr);
privatekey_free(privkey);
ssh_key_free(priv_key);
remmina_nx_session_set_error(nx, "Failed to startup SSH session: %s");
return FALSE;
}

ret = ssh_userauth_pubkey(nx->session, NULL, pubkeystr, privkey);
string_free(pubkeystr);
privatekey_free(privkey);
ret = ssh_userauth_publickey(nx->session, NULL, priv_key);

ssh_key_free(priv_key);

if (ret != SSH_AUTH_SUCCESS)
{
remmina_nx_session_set_error(nx, "NX SSH authentication failed: %s");
return FALSE;
}

if ((nx->channel = channel_new(nx->session)) == NULL || channel_open_session(nx->channel))
if ((nx->channel = ssh_channel_new(nx->session)) == NULL || ssh_channel_open_session(nx->channel) != SSH_OK)
{
return FALSE;
}

if (channel_request_shell(nx->channel))
if (ssh_channel_request_shell(nx->channel) != SSH_OK)
{
return FALSE;
}
Expand Down
6 changes: 3 additions & 3 deletions remmina-plugins/nx/nx_session_manager.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Remmina - The GTK+ Remote Desktop Client
* Copyright (C) 2010 Vic Lee
* Copyright (C) 2010 Vic Lee
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* In addition, as a special exception, the copyright holders give
Expand Down Expand Up @@ -149,7 +149,7 @@ static gboolean remmina_nx_session_manager_main(RemminaProtocolWidget *gp)
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Restore"), REMMINA_NX_EVENT_RESTORE);
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Start"), REMMINA_NX_EVENT_START);
}
gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, REMMINA_NX_EVENT_CANCEL);
gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Cancel"), REMMINA_NX_EVENT_CANCEL);

widget = gtk_dialog_add_button(GTK_DIALOG(dialog), _("Terminate"), REMMINA_NX_EVENT_TERMINATE);
gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), widget,
Expand Down
5 changes: 3 additions & 2 deletions remmina-plugins/rdp/rdp_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,12 +833,13 @@ gboolean remmina_rdp_event_queue_ui(RemminaProtocolWidget* gp)
break;
}
}
rf_object_free(gp, ui);

// Should we signal the subthread to unlock ?
if ( ui->sync )
if (ui->sync) {
pthread_mutex_unlock(&ui->sync_wait_mutex);
}

rf_object_free(gp, ui);

return TRUE;
}
Expand Down
38 changes: 26 additions & 12 deletions remmina-plugins/rdp/rdp_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
gint port;
gchar* host;
gchar* value;
gchar* hostport;
gint rdpsnd_rate;
gint rdpsnd_channel;
char *rdpsnd_params[3];
Expand All @@ -613,9 +614,9 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
RemminaFile* remminafile;
rfContext* rfi;

gchar *dest_host;
const gchar *dest_server;
gint dest_port;
const gchar *cert_hostport;
gchar *cert_host;
gint cert_port;

rfi = GET_DATA(gp);
remminafile = remmina_plugin_service->protocol_plugin_get_file(gp);
Expand All @@ -627,20 +628,33 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)

remmina_plugin_service->get_server_port(s, 3389, &host, &port);
rfi->settings->ServerHostname = strdup(host);
g_free(host);
g_free(s);
rfi->settings->ServerPort = port;

// Setup rfi->settings->CertificateName when tunneled with SSH
cert_host = host;
cert_port = port;

if (remmina_plugin_service->file_get_int(remminafile, "ssh_enabled", FALSE)) {
dest_server = remmina_plugin_service->file_get_string(remminafile, "server");
if ( dest_server ) {
remmina_plugin_service->get_server_port(dest_server, 0, &dest_host, &dest_port);
rfi->settings->CertificateName = strdup( dest_host );
g_free(dest_host);
cert_hostport = remmina_plugin_service->file_get_string(remminafile, "server");
if ( cert_hostport ) {
remmina_plugin_service->get_server_port(cert_hostport, 3389, &cert_host, &cert_port);
}
}

if (cert_port == 3389)
{
rfi->settings->CertificateName = strdup(cert_host);
}
else
{
hostport = g_strdup_printf("%s:%d", cert_host, cert_port);
rfi->settings->CertificateName = strdup(hostport);
g_free(hostport);
}

if (cert_host != host) g_free(cert_host);
g_free(host);
g_free(s);

rfi->settings->ServerPort = port;
rfi->settings->ColorDepth = remmina_plugin_service->file_get_int(remminafile, "colordepth", 0);

if (rfi->settings->ColorDepth == 0)
Expand Down
4 changes: 2 additions & 2 deletions remmina-plugins/vnc/vnc_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* In addition, as a special exception, the copyright holders give
Expand Down Expand Up @@ -2031,7 +2031,7 @@ static const RemminaProtocolFeature remmina_plugin_vnc_features[] =
REMMINA_PROTOCOL_FEATURE_PREF_CHECK), "viewonly", N_("View only") },
{ REMMINA_PROTOCOL_FEATURE_TYPE_PREF, REMMINA_PLUGIN_VNC_FEATURE_PREF_DISABLESERVERINPUT, GINT_TO_POINTER(
REMMINA_PROTOCOL_FEATURE_PREF_CHECK), "disableserverinput", N_("Disable server input") },
{ REMMINA_PROTOCOL_FEATURE_TYPE_TOOL, REMMINA_PLUGIN_VNC_FEATURE_TOOL_REFRESH, N_("Refresh"), GTK_STOCK_REFRESH, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_TOOL, REMMINA_PLUGIN_VNC_FEATURE_TOOL_REFRESH, N_("Refresh"), NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_TOOL, REMMINA_PLUGIN_VNC_FEATURE_TOOL_CHAT, N_("Open Chat..."), "face-smile", NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_SCALE, REMMINA_PLUGIN_VNC_FEATURE_SCALE, NULL, NULL, NULL },
{ REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS, REMMINA_PLUGIN_VNC_FEATURE_UNFOCUS, NULL, NULL, NULL },
Expand Down
7 changes: 4 additions & 3 deletions remmina/src/remmina_applet_menu_item.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Remmina - The GTK+ Remote Desktop Client
* Copyright (C) 2009-2010 Vic Lee
* Copyright (C) 2009-2010 Vic Lee
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* In addition, as a special exception, the copyright holders give
Expand All @@ -38,7 +38,7 @@
#include <stdarg.h>
#include "remmina_applet_menu_item.h"

G_DEFINE_TYPE( RemminaAppletMenuItem, remmina_applet_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
G_DEFINE_TYPE( RemminaAppletMenuItem, remmina_applet_menu_item, GTK_TYPE_MENU_ITEM)

#define IS_EMPTY(s) ((!s)||(s[0]==0))

Expand Down Expand Up @@ -120,6 +120,7 @@ GtkWidget* remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ...
gtk_container_add(GTK_CONTAINER(item), widget);

/* Create the image */

if (item_type == REMMINA_APPLET_MENU_ITEM_FILE || item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED)
{
if (g_strcmp0(item->protocol, "SFTP") == 0)
Expand Down
10 changes: 0 additions & 10 deletions remmina/src/remmina_connection_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,6 @@ static void remmina_connection_holder_toolbar_tools(GtkWidget* widget, RemminaCo
const RemminaProtocolFeature* feature;
GtkWidget* menu;
GtkWidget* menuitem;
GtkWidget* image;
const gchar* domain;
gboolean enabled;

Expand All @@ -1180,15 +1179,6 @@ static void remmina_connection_holder_toolbar_tools(GtkWidget* widget, RemminaCo
if (feature->opt1)
{
menuitem = gtk_menu_item_new_with_label(g_dgettext(domain, (const gchar*) feature->opt1));
if (feature->opt2)
{
image = gtk_image_new_from_icon_name((const gchar*) feature->opt2, GTK_ICON_SIZE_MENU);
gtk_widget_show(image);
}
}
else
{
menuitem = gtk_image_menu_item_new_from_stock((const gchar*) feature->opt2, NULL);
}
if (feature->opt3)
{
Expand Down

0 comments on commit fb99c8b

Please sign in to comment.