Commit f70c7337 authored by Marc-André Moreau's avatar Marc-André Moreau

vnc: fix cmake build script

parent fefba668
cmake_minimum_required(VERSION 2.6)
project(LibVNCServer)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckTypeSize)
include(TestBigEndian)
set(PACKAGE_NAME "LibVNCServer")
set(FULL_PACKAGE_NAME "LibVNCServer")
set(PACKAGE_VERSION "0.9.8.2")
set(PROJECT_BUGREPORT_PATH "http://sourceforge.net/projects/libvncserver")
#set(PACKAGE_NAME "LibVNCServer")
#set(FULL_PACKAGE_NAME "LibVNCServer")
#set(PACKAGE_VERSION "0.9.8.2")
#set(PROJECT_BUGREPORT_PATH "http://sourceforge.net/projects/libvncserver")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libvncserver ${CMAKE_CURRENT_SOURCE_DIR}/common)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common)
find_package(ZLIB)
find_package(JPEG)
......@@ -56,15 +54,15 @@ check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
check_function_exists(gettimeofday LIBVNCSERVER_HAVE_GETTIMEOFDAY)
if(CMAKE_USE_PTHREADS_INIT)
set(LIBVNCSERVER_HAVE_LIBPTHREAD 1)
set(LIBVNCSERVER_HAVE_LIBPTHREAD 1)
endif(CMAKE_USE_PTHREADS_INIT)
if(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
# socklen_t
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
# socklen_t
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
endif(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
if(HAVE_ARPA_INET_H)
# in_addr_t
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "arpa/inet.h")
# in_addr_t
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "arpa/inet.h")
endif(HAVE_ARPA_INET_H)
check_type_size(pid_t LIBVNCSERVER_PID_T)
......@@ -73,7 +71,7 @@ check_type_size(socklen_t LIBVNCSERVER_SOCKLEN_T)
check_type_size(in_addr_t LIBVNCSERVER_IN_ADDR_T)
if(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
set(LIBVNCSERVER_NEED_INADDR_T 1)
set(LIBVNCSERVER_NEED_INADDR_T 1)
endif(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
TEST_BIG_ENDIAN(LIBVNCSERVER_WORDS_BIGENDIAN)
......@@ -85,24 +83,20 @@ set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
set(LIBVNCCLIENT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libvncclient)
set(LIBVNCCLIENT_SOURCES
${LIBVNCCLIENT_DIR}/cursor.c
${LIBVNCCLIENT_DIR}/listen.c
${LIBVNCCLIENT_DIR}/rfbproto.c
${LIBVNCCLIENT_DIR}/sockets.c
${LIBVNCCLIENT_DIR}/vncviewer.c
${COMMON_DIR}/minilzo.c
${LIBVNCCLIENT_DIR}/tls.c
${LIBVNCCLIENT_DIR}/cursor.c
${LIBVNCCLIENT_DIR}/listen.c
${LIBVNCCLIENT_DIR}/rfbproto.c
${LIBVNCCLIENT_DIR}/sockets.c
${LIBVNCCLIENT_DIR}/vncviewer.c
${COMMON_DIR}/minilzo.c
${LIBVNCCLIENT_DIR}/tls.c
)
add_library(vncclient STATIC ${LIBVNCCLIENT_SOURCES})
if(WIN32)
set(ADDITIONAL_LIBS ws2_32)
set(ADDITIONAL_LIBS ws2_32)
endif(WIN32)
target_link_libraries(vncclient
${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES}
${JPEG_LIBRARIES}
${SDL_LIBRARY}
)
target_link_libraries(vncclient ${ADDITIONAL_LIBS} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES})
......@@ -981,7 +981,7 @@ static void remmina_plugin_vnc_rfb_output(const char *format, ...)
f = g_strdup (format);
if (f[strlen (f) - 1] == '\n') f[strlen (f) - 1] = '\0';
if (g_strcmp0 (f, "VNC connection failed: %s") == 0)
if (g_strcmp0(f, "VNC connection failed: %s") == 0)
{
p = va_arg (args, gchar*);
g_snprintf (vnc_error, MAX_ERROR_LENGTH, _(f), _(p));
......
......@@ -24,29 +24,46 @@
#include "remmina_widget_pool.h"
#include "remmina_about.h"
void remmina_about_open(GtkWindow *parent)
void remmina_about_open(GtkWindow* parent)
{
const gchar *authors[] =
{ N_("Maintainers:"), "Vic Lee <llyzs@163.com>", "", N_("Contributors:"), "Alex Chateau <ash@zednet.lv>",
"Alexander Logvinov <avl@logvinov.com>", "Harun Trefry <aihtdikh@gmail.com>",
"Nikolay Botev <bono8106@gmail.com>", NULL };
const gchar *artists[] =
{ "Martin Lettner <m.lettner@gmail.com>", NULL };
const gchar *licenses[] =
{ N_("Remmina is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version."), N_("Remmina is distributed in the hope that it will be useful, "
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
"GNU General Public License for more details."), N_(
"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, "
"Boston, MA 02111-1307, USA.") };
gchar *license = g_strjoin("\n\n", _(licenses[0]), _(licenses[1]), _(licenses[2]), NULL);
GtkWidget *dialog;
const gchar* authors[] =
{
N_("Maintainers:"),
"Vic Lee <llyzs@163.com>",
"",
N_("Contributors:"),
"Alex Chateau <ash@zednet.lv>",
"Alexander Logvinov <avl@logvinov.com>",
"Harun Trefry <aihtdikh@gmail.com>",
"Nikolay Botev <bono8106@gmail.com>",
NULL
};
const gchar* artists[] =
{
"Martin Lettner <m.lettner@gmail.com>",
NULL
};
const gchar* licenses[] =
{
N_("Remmina is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version."),
N_("Remmina is distributed in the hope that it will be useful, "
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
"GNU General Public License for more details."), N_(
"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, "
"Boston, MA 02111-1307, USA.")
};
gchar* license = g_strjoin("\n\n", _(licenses[0]), _(licenses[1]), _(licenses[2]), NULL);
GtkWidget* dialog;
dialog = gtk_about_dialog_new();
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog), "Remmina");
......@@ -66,6 +83,7 @@ void remmina_about_open(GtkWindow *parent)
gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
}
g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_window_present(GTK_WINDOW(dialog));
......@@ -73,4 +91,3 @@ void remmina_about_open(GtkWindow *parent)
g_free(license);
}
......@@ -28,7 +28,7 @@ G_DEFINE_TYPE( RemminaAppletMenuItem, remmina_applet_menu_item, GTK_TYPE_IMAGE_M
#define IS_EMPTY(s) ((!s)||(s[0]==0))
static void remmina_applet_menu_item_destroy(RemminaAppletMenuItem *item, gpointer data)
static void remmina_applet_menu_item_destroy(RemminaAppletMenuItem* item, gpointer data)
{
g_free(item->filename);
g_free(item->name);
......@@ -37,11 +37,11 @@ static void remmina_applet_menu_item_destroy(RemminaAppletMenuItem *item, gpoint
g_free(item->server);
}
static void remmina_applet_menu_item_class_init(RemminaAppletMenuItemClass *klass)
static void remmina_applet_menu_item_class_init(RemminaAppletMenuItemClass* klass)
{
}
static void remmina_applet_menu_item_init(RemminaAppletMenuItem *item)
static void remmina_applet_menu_item_init(RemminaAppletMenuItem* item)
{
item->filename = NULL;
item->name = NULL;
......@@ -52,69 +52,71 @@ static void remmina_applet_menu_item_init(RemminaAppletMenuItem *item)
g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(remmina_applet_menu_item_destroy), NULL);
}
GtkWidget*
remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ...)
GtkWidget* remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ...)
{
va_list ap;
RemminaAppletMenuItem *item;
GKeyFile *gkeyfile;
GtkWidget *widget;
const gchar *iconname;
RemminaAppletMenuItem* item;
GKeyFile* gkeyfile;
GtkWidget* widget;
const gchar* iconname;
va_start(ap, item_type);
item = REMMINA_APPLET_MENU_ITEM (g_object_new (REMMINA_TYPE_APPLET_MENU_ITEM, NULL));
item = REMMINA_APPLET_MENU_ITEM(g_object_new(REMMINA_TYPE_APPLET_MENU_ITEM, NULL));
item->item_type = item_type;
switch (item_type)
{
case REMMINA_APPLET_MENU_ITEM_FILE:
item->filename = g_strdup (va_arg(ap, const gchar *));
/* Load the file */
gkeyfile = g_key_file_new ();
if (!g_key_file_load_from_file (gkeyfile, item->filename, G_KEY_FILE_NONE, NULL)) return NULL;
item->filename = g_strdup(va_arg(ap, const gchar*));
item->name = g_key_file_get_string (gkeyfile, "remmina", "name", NULL);
item->group = g_key_file_get_string (gkeyfile, "remmina", "group", NULL);
item->protocol = g_key_file_get_string (gkeyfile, "remmina", "protocol", NULL);
item->server = g_key_file_get_string (gkeyfile, "remmina", "server", NULL);
item->ssh_enabled = g_key_file_get_boolean (gkeyfile, "remmina", "ssh_enabled", NULL);
/* Load the file */
gkeyfile = g_key_file_new();
g_key_file_free (gkeyfile);
break;
if (!g_key_file_load_from_file(gkeyfile, item->filename, G_KEY_FILE_NONE, NULL))
return NULL;
item->name = g_key_file_get_string(gkeyfile, "remmina", "name", NULL);
item->group = g_key_file_get_string(gkeyfile, "remmina", "group", NULL);
item->protocol = g_key_file_get_string(gkeyfile, "remmina", "protocol", NULL);
item->server = g_key_file_get_string(gkeyfile, "remmina", "server", NULL);
item->ssh_enabled = g_key_file_get_boolean(gkeyfile, "remmina", "ssh_enabled", NULL);
g_key_file_free(gkeyfile);
break;
case REMMINA_APPLET_MENU_ITEM_DISCOVERED:
item->name = g_strdup (va_arg(ap, const gchar *));
item->group = g_strdup (_("Discovered"));
item->protocol = g_strdup ("VNC");
break;
item->name = g_strdup(va_arg(ap, const gchar *));
item->group = g_strdup(_("Discovered"));
item->protocol = g_strdup("VNC");
break;
case REMMINA_APPLET_MENU_ITEM_NEW:
item->name = g_strdup (_("New Connection"));
break;
item->name = g_strdup(_("New Connection"));
break;
}
va_end(ap);
/* Create the label */
widget = gtk_label_new (item->name);
gtk_widget_show (widget);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
gtk_widget_show(widget);
gtk_misc_set_alignment(GTK_MISC (widget), 0.0, 0.5);
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)
if (g_strcmp0(item->protocol, "SFTP") == 0)
{
iconname = "remmina-sftp";
}
else if (g_strcmp0 (item->protocol, "SSH") == 0)
else if (g_strcmp0(item->protocol, "SSH") == 0)
{
iconname = "utilities-terminal";
}
else if (g_strcmp0 (item->protocol, "RDP") == 0)
else if (g_strcmp0(item->protocol, "RDP") == 0)
{
iconname = (item->ssh_enabled ? "remmina-rdp-ssh" : "remmina-rdp");
}
......@@ -122,11 +124,11 @@ remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ...)
{
iconname = (item->ssh_enabled ? "remmina-vnc-ssh" : "remmina-vnc");
}
else if (g_strcmp0 (item->protocol, "XDMCP") == 0)
else if (g_strcmp0(item->protocol, "XDMCP") == 0)
{
iconname = (item->ssh_enabled ? "remmina-xdmcp-ssh" : "remmina-xdmcp");
}
else if (g_strcmp0 (item->protocol, "NX") == 0)
else if (g_strcmp0(item->protocol, "NX") == 0)
{
iconname = "remmina-nx";
}
......@@ -134,38 +136,40 @@ remmina_applet_menu_item_new(RemminaAppletMenuItemType item_type, ...)
{
iconname = "remmina";
}
widget = gtk_image_new_from_icon_name (iconname, GTK_ICON_SIZE_MENU);
widget = gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU);
}
else
{
widget = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU);
widget = gtk_image_new_from_stock(GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU);
}
gtk_widget_show (widget);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), widget);
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
gtk_widget_show(widget);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), widget);
gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(item), TRUE);
if (item->server)
{
gtk_widget_set_tooltip_text (GTK_WIDGET (item), item->server);
gtk_widget_set_tooltip_text(GTK_WIDGET(item), item->server);
}
return GTK_WIDGET (item);
return GTK_WIDGET(item);
}
gint remmina_applet_menu_item_compare(gconstpointer a, gconstpointer b, gpointer user_data)
{
RemminaAppletMenuItem *itema, *itemb;
gint cmp;
RemminaAppletMenuItem* itema;
RemminaAppletMenuItem* itemb;
/* Passed in parameters are pointers to pointers */
itema = REMMINA_APPLET_MENU_ITEM(*((void**) a));
itemb = REMMINA_APPLET_MENU_ITEM(*((void**) b));
/* Put ungrouped items to the last */
if (IS_EMPTY (itema->group) && !IS_EMPTY (itemb->group)
) return 1;
if (!IS_EMPTY (itema->group) && IS_EMPTY (itemb->group)
) return -1;
if (IS_EMPTY(itema->group) && !IS_EMPTY(itemb->group))
return 1;
if (!IS_EMPTY(itema->group) && IS_EMPTY(itemb->group))
return -1;
/* Put discovered items the last group */
if (itema->item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED && itemb->item_type != REMMINA_APPLET_MENU_ITEM_DISCOVERED)
......@@ -173,13 +177,13 @@ gint remmina_applet_menu_item_compare(gconstpointer a, gconstpointer b, gpointer
if (itema->item_type != REMMINA_APPLET_MENU_ITEM_DISCOVERED && itemb->item_type == REMMINA_APPLET_MENU_ITEM_DISCOVERED)
return -1;
if (itema->item_type != REMMINA_APPLET_MENU_ITEM_DISCOVERED && !IS_EMPTY (itema->group))
if (itema->item_type != REMMINA_APPLET_MENU_ITEM_DISCOVERED && !IS_EMPTY(itema->group))
{
cmp = g_strcmp0(itema->group, itemb->group);
if (cmp != 0)
return cmp;
}
return g_strcmp0(itema->name, itemb->name);
}
......@@ -23,12 +23,12 @@
G_BEGIN_DECLS
#define REMMINA_TYPE_APPLET_MENU_ITEM (remmina_applet_menu_item_get_type ())
#define REMMINA_APPLET_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), REMMINA_TYPE_APPLET_MENU_ITEM, RemminaAppletMenuItem))
#define REMMINA_APPLET_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), REMMINA_TYPE_APPLET_MENU_ITEM, RemminaAppletMenuItemClass))
#define REMMINA_IS_APPLET_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), REMMINA_TYPE_APPLET_MENU_ITEM))
#define REMMINA_IS_APPLET_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), REMMINA_TYPE_APPLET_MENU_ITEM))
#define REMMINA_APPLET_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), REMMINA_TYPE_APPLET_MENU_ITEM, RemminaAppletMenuItemClass))
#define REMMINA_TYPE_APPLET_MENU_ITEM (remmina_applet_menu_item_get_type())
#define REMMINA_APPLET_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), REMMINA_TYPE_APPLET_MENU_ITEM, RemminaAppletMenuItem))
#define REMMINA_APPLET_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), REMMINA_TYPE_APPLET_MENU_ITEM, RemminaAppletMenuItemClass))
#define REMMINA_IS_APPLET_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), REMMINA_TYPE_APPLET_MENU_ITEM))
#define REMMINA_IS_APPLET_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), REMMINA_TYPE_APPLET_MENU_ITEM))
#define REMMINA_APPLET_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), REMMINA_TYPE_APPLET_MENU_ITEM, RemminaAppletMenuItemClass))
typedef enum
{
......@@ -40,11 +40,11 @@ typedef struct _RemminaAppletMenuItem
GtkImageMenuItem image_menu_item;
RemminaAppletMenuItemType item_type;
gchar *filename;
gchar *name;
gchar *group;
gchar *protocol;
gchar *server;
gchar* filename;
gchar* name;
gchar* group;
gchar* protocol;
gchar* server;
gboolean ssh_enabled;
} RemminaAppletMenuItem;
......
......@@ -27,113 +27,121 @@
#include "remmina_crypt.h"
#ifdef HAVE_LIBGCRYPT
static gboolean
remmina_crypt_init (gcry_cipher_hd_t *phd)
static gboolean remmina_crypt_init(gcry_cipher_hd_t *phd)
{
guchar* secret;
gcry_error_t err;
guchar *secret;
gsize secret_len;
secret = g_base64_decode (remmina_pref.secret, &secret_len);
secret = g_base64_decode(remmina_pref.secret, &secret_len);
if (secret_len < 32)
{
g_print ("secret corrupted\n");
g_free (secret);
g_print("secret corrupted\n");
g_free(secret);
return FALSE;
}
err = gcry_cipher_open (phd, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0);
err = gcry_cipher_open(phd, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0);
if (err)
{
g_print ("gcry_cipher_open failure: %s\n", gcry_strerror (err));
g_free (secret);
g_print("gcry_cipher_open failure: %s\n", gcry_strerror(err));
g_free(secret);
return FALSE;
}
err = gcry_cipher_setkey ((*phd), secret, 24);
err = gcry_cipher_setkey((*phd), secret, 24);
if (err)
{
g_print ("gcry_cipher_setkey failure: %s\n", gcry_strerror (err));
g_free (secret);
gcry_cipher_close ((*phd));
g_print("gcry_cipher_setkey failure: %s\n", gcry_strerror(err));
g_free(secret);
gcry_cipher_close((*phd));
return FALSE;
}
err = gcry_cipher_setiv ((*phd), secret + 24, 8);
err = gcry_cipher_setiv((*phd), secret + 24, 8);
if (err)
{
g_print ("gcry_cipher_setiv failure: %s\n", gcry_strerror (err));
g_free (secret);
gcry_cipher_close ((*phd));
g_print("gcry_cipher_setiv failure: %s\n", gcry_strerror(err));
g_free(secret);
gcry_cipher_close((*phd));
return FALSE;
}
g_free (secret);
g_free(secret);
return TRUE;
}
gchar*
remmina_crypt_encrypt (const gchar *str)
gchar* remmina_crypt_encrypt(const gchar *str)
{
guchar* buf;
gint buf_len;
gchar* result;
gcry_error_t err;
gcry_cipher_hd_t hd;
guchar *buf;
gint buf_len;
gchar *result;
if (!str || str[0] == '\0') return NULL;
if (!str || str[0] == '\0')
return NULL;
if (!remmina_crypt_init (&hd)) return NULL;
if (!remmina_crypt_init(&hd))
return NULL;
buf_len = strlen (str);
buf_len = strlen(str);
/* Pack to 64bit block size, and make sure it's always 0-terminated */
buf_len += 8 - buf_len % 8;
buf = (guchar*) g_malloc (buf_len);
memset (buf, 0, buf_len);
memcpy (buf, str, strlen (str));
buf = (guchar*) g_malloc(buf_len);
memset(buf, 0, buf_len);
memcpy(buf, str, strlen(str));
err = gcry_cipher_encrypt(hd, buf, buf_len, NULL, 0);
err = gcry_cipher_encrypt (hd, buf, buf_len, NULL, 0);
if (err)
{
g_print ("gcry_cipher_encrypt failure: %s\n", gcry_strerror (err));
g_free (buf);
gcry_cipher_close (hd);
g_print("gcry_cipher_encrypt failure: %s\n", gcry_strerror(err));
g_free(buf);
gcry_cipher_close(hd);
return NULL;
}
result = g_base64_encode (buf, buf_len);
result = g_base64_encode(buf, buf_len);
g_free (buf);
gcry_cipher_close (hd);
g_free(buf);
gcry_cipher_close(hd);
return result;
}
gchar*
remmina_crypt_decrypt (const gchar *str)
gchar* remmina_crypt_decrypt(const gchar *str)
{
guchar* buf;
gsize buf_len;
gcry_error_t err;
gcry_cipher_hd_t hd;
guchar *buf;
gsize buf_len;
if (!str || str[0] == '\0') return NULL;
if (!str || str[0] == '\0')
return NULL;
if (!remmina_crypt_init(&hd))
return NULL;
if (!remmina_crypt_init (&hd)) return NULL;
buf = g_base64_decode(str, &buf_len);
buf = g_base64_decode (str, &buf_len);
err = gcry_cipher_decrypt(hd, buf, buf_len, NULL, 0);
err = gcry_cipher_decrypt (hd, buf, buf_len, NULL, 0);
if (err)
{
g_print ("gcry_cipher_decrypt failure: %s\n", gcry_strerror (err));
g_free (buf);
gcry_cipher_close (hd);
g_print("gcry_cipher_decrypt failure: %s\n", gcry_strerror(err));
g_free(buf);
gcry_cipher_close(hd);
return NULL;
}
gcry_cipher_close (hd);
gcry_cipher_close(hd);
/* Just in case */
buf[buf_len - 1] = '\0';
......@@ -143,14 +151,12 @@ remmina_crypt_decrypt (const gchar *str)
#else
gchar*
remmina_crypt_encrypt(const gchar *str)
gchar* remmina_crypt_encrypt(const gchar *str)
{
return NULL;
}
gchar*
remmina_crypt_decrypt(const gchar *str)
gchar* remmina_crypt_decrypt(const gchar *str)
{
return NULL;
}
......
......@@ -23,8 +23,8 @@
G_BEGIN_DECLS
gchar* remmina_crypt_encrypt(const gchar *str);
gchar* remmina_crypt_decrypt(const gchar *str);
gchar* remmina_crypt_encrypt(const gchar* str);
gchar* remmina_crypt_decrypt(const gchar* str);
G_END_DECLS
......
......@@ -289,7 +289,7 @@ remmina_file_editor_create_ssh_privatekey (RemminaFileEditor *gfe, GtkWidget *ta
g_signal_connect (G_OBJECT (widget), "toggled",
G_CALLBACK (remmina_file_editor_ssh_auth_publickey_radio_on_toggled), gfe);
priv->ssh_auth_publickey_radio = widget;
gtk_widget_show (widget);
gtk_widget_show(widget);
gtk_table_attach (GTK_TABLE (table), widget, column, column + 1, row, row + 1, GTK_FILL, 0, 0, 0);
dialog = gtk_file_chooser_dialog_new (_("Identity file"), GTK_WINDOW (gfe), GTK_FILE_CHOOSER_ACTION_OPEN,
......@@ -304,7 +304,7 @@ remmina_file_editor_create_ssh_privatekey (RemminaFileEditor *gfe, GtkWidget *ta
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (widget), s);
}
g_free (s);
gtk_widget_show (widget);
gtk_widget_show(widget);
gtk_table_attach_defaults (GTK_TABLE (table), widget, column + 1, column + 2, row, row + 1);
priv->ssh_privatekey_chooser = widget;
......@@ -349,14 +349,14 @@ static void remmina_file_editor_create_server(RemminaFileEditor *gfe, const Remm
gfe->priv->avahi_service_type = (const gchar*) setting->opt1;
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
gtk_widget_show(hbox);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
widget = gtk_button_new_with_label ("...");
s = g_strdup_printf (_("Browse the network to find a %s server"), plugin->name);
gtk_widget_set_tooltip_text (widget, s);
g_free (s);
gtk_widget_show (widget);
gtk_widget_show(widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (widget), "clicked", G_CALLBACK (remmina_file_editor_browse_avahi), gfe);
......@@ -732,19 +732,19 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor *gfe, RemminaPr
"SSH", 9, 3);
hbox = gtk_hbox_new (TRUE, 0);
gtk_widget_show (hbox);
gtk_widget_show(hbox);
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 0, 3, 0, 1);
row++;
widget = gtk_check_button_new_with_label (_("Enable SSH tunnel"));
gtk_widget_show (widget);
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_widget_show(widget);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
priv->ssh_loopback_check = widget;
}
......@@ -759,21 +759,21 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor *gfe, RemminaPr
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_widget_show(widget);
gtk_table_attach_defaults (GTK_TABLE (table), widget, 1, 3, row, row + 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_widget_show(widget);
gtk_table_attach (GTK_TABLE (table), widget, 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
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_widget_show(widget);
gtk_entry_set_max_length (GTK_ENTRY (widget), 100);
gtk_widget_set_tooltip_markup (widget, _(server_tips2));
gtk_table_attach_defaults (GTK_TABLE (table), widget, 2, 3, row, row + 1);
......@@ -842,14 +842,14 @@ static void remmina_file_editor_create_ssh_tab(RemminaFileEditor *gfe, RemminaPr
row++;
widget = gtk_radio_button_new_with_label (NULL, _("Password"));
gtk_widget_show (widget);
gtk_widget_show(widget);
gtk_table_attach_defaults (GTK_TABLE (table), widget, 1, 3, row, row + 1);
priv->ssh_auth_password_radio = widget;
row++;
widget = gtk_radio_button_new_with_label_from_widget (
GTK_RADIO_BUTTON (priv->ssh_auth_password_radio), _("Public key (automatic)"));
gtk_widget_show (widget);
gtk_widget_show(widget);
gtk_table_attach_defaults (GTK_TABLE (table), widget, 1, 3, row, row + 1);
<