diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2019-04-04 16:50:24 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2019-04-04 16:50:24 +0300 |
commit | 7ead937d4ad932222eac90ac243c57266a724abd (patch) | |
tree | 0e0dd1b6262f7f278cbbd235c127663c00951534 | |
parent | 62b38b0aeecb9fc9f6ed1313f3561219742c95b9 (diff) |
Fixing sodium dependencies
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/remmina.c | 7 | ||||
-rw-r--r-- | src/remmina_pref.c | 4 | ||||
-rw-r--r-- | src/remmina_pref_dialog.c | 15 | ||||
-rw-r--r-- | src/remmina_sodium.c | 5 | ||||
-rw-r--r-- | src/remmina_sodium.h | 4 | ||||
-rw-r--r-- | src/remmina_unlock.c | 6 | ||||
-rw-r--r-- | src/remmina_unlock.h | 2 |
8 files changed, 21 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c3fb32e4a..915b86d68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,6 +319,11 @@ find_suggested_package(GCRYPT) find_suggested_package(AVAHI) find_package(OpenSSL) find_package(sodium REQUIRED) +if(sodium_FOUND) + message(STATUS "sodium_LIBRARY_RELEASE: ${sodium_LIBRARY_RELEASE}") + message(STATUS "sodium_INCLUDE_DIR: ${sodium_INCLUDE_DIR}") + message(STATUS "sodium_LIBRARY_DEBUG: ${sodium_LIBRARY_DEBUG}") +endif() if(WITH_TRACE_CALLS) message(STATUS "Enabling trace calls.") diff --git a/src/remmina.c b/src/remmina.c index db24fa0b5..fa085b907 100644 --- a/src/remmina.c +++ b/src/remmina.c @@ -41,6 +41,7 @@ #include <stdlib.h> #include "config.h" +#include "remmina_sodium.h" #include "remmina.h" #include "remmina_exec.h" #include "remmina_file_manager.h" @@ -49,10 +50,6 @@ #include "remmina_masterthread_exec.h" #include "remmina_plugin_manager.h" #include "remmina_pref.h" -#include <sodium.h> -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) -#include "remmina_sodium.h" -#endif #include "remmina_public.h" #include "remmina_sftp_plugin.h" #include "remmina_ssh_plugin.h" @@ -124,7 +121,7 @@ static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine * gchar *protocol; gchar *server; -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 remmina_sodium_init(); #endif remmina_pref_init(); diff --git a/src/remmina_pref.c b/src/remmina_pref.c index 6728a07d8..673c9632a 100644 --- a/src/remmina_pref.c +++ b/src/remmina_pref.c @@ -46,7 +46,7 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include <sodium.h> +#include "remmina_sodium.h" #include "remmina_public.h" #include "remmina_string_array.h" @@ -689,7 +689,7 @@ gboolean remmina_pref_save(void) g_key_file_set_string(gkeyfile, "remmina_pref", "remmina_file_name", remmina_pref.remmina_file_name); g_key_file_set_boolean(gkeyfile, "remmina_pref", "deny_screenshot_clipboard", remmina_pref.deny_screenshot_clipboard); g_key_file_set_boolean(gkeyfile, "remmina_pref", "save_view_mode", remmina_pref.save_view_mode); -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 g_key_file_set_boolean(gkeyfile, "remmina_pref", "use_master_password", remmina_pref.use_master_password); g_key_file_set_integer(gkeyfile, "remmina_pref", "unlock_timeout", remmina_pref.unlock_timeout); g_key_file_set_string(gkeyfile, "remmina_pref", "unlock_password", remmina_pref.unlock_password); diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c index 1ca9ea792..04c53ee42 100644 --- a/src/remmina_pref_dialog.c +++ b/src/remmina_pref_dialog.c @@ -41,11 +41,8 @@ #if defined (HAVE_LIBSSH) && defined (HAVE_LIBVTE) #include <vte/vte.h> #endif -#include "remmina_public.h" -#include <sodium.h> -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) #include "remmina_sodium.h" -#endif +#include "remmina_public.h" #include "remmina_string_list.h" #include "remmina_widget_pool.h" #include "remmina_key_chooser.h" @@ -208,7 +205,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) remmina_pref.deny_screenshot_clipboard = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_options_deny_screenshot_clipboard)); remmina_pref.save_view_mode = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_options_remember_last_view_mode)); remmina_pref.use_master_password = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_security_use_master_password)); -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 remmina_pref.unlock_repassword = gtk_entry_get_text(remmina_pref_dialog->unlock_repassword); if (gtk_entry_get_text_length(remmina_pref_dialog->unlock_repassword) != 0) remmina_pref.unlock_password = remmina_sodium_pwhash_str(gtk_entry_get_text(remmina_pref_dialog->unlock_password)); @@ -250,7 +247,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) if (remmina_pref.ssh_tcp_usrtimeout <= 0) remmina_pref.ssh_tcp_usrtimeout = SSH_SOCKET_TCP_USER_TIMEOUT; remmina_pref.ssh_parseconfig = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_options_ssh_parseconfig)); -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 remmina_pref.unlock_timeout = atoi(gtk_entry_get_text(remmina_pref_dialog->unlock_timeout)); if (remmina_pref.unlock_timeout < 0) remmina_pref.unlock_timeout = 0; @@ -433,9 +430,7 @@ static void remmina_pref_dialog_init(void) gtk_dialog_set_default_response(GTK_DIALOG(remmina_pref_dialog->dialog), GTK_RESPONSE_CLOSE); gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_options_remember_last_view_mode), remmina_pref.save_view_mode); - g_info("SODIUM_LIBRARY_VERSION_MAJOR %d", SODIUM_LIBRARY_VERSION_MAJOR); - g_info("SODIUM_LIBRARY_VERSION_MINOR %d", SODIUM_LIBRARY_VERSION_MINOR); -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_use_master_password), remmina_pref.use_master_password); if (remmina_pref.unlock_password != NULL) { gtk_entry_set_text(remmina_pref_dialog->unlock_password, remmina_pref.unlock_password); @@ -577,7 +572,7 @@ static void remmina_pref_dialog_init(void) g_snprintf(buf, sizeof(buf), "%i", remmina_pref.vte_lines); gtk_entry_set_text(remmina_pref_dialog->entry_scrollback_lines, buf); -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 g_snprintf(buf, sizeof(buf), "%i", remmina_pref.unlock_timeout); gtk_entry_set_text(remmina_pref_dialog->unlock_timeout, buf); #endif diff --git a/src/remmina_sodium.c b/src/remmina_sodium.c index c7a3fab11..f5e4019a4 100644 --- a/src/remmina_sodium.c +++ b/src/remmina_sodium.c @@ -54,8 +54,6 @@ * */ -#include <sodium.h> -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) #include <string.h> #if defined(__linux__) @@ -67,9 +65,10 @@ #include "config.h" #include <glib.h> +#include "remmina/remmina_trace_calls.h" #include "remmina_sodium.h" -#include "remmina/remmina_trace_calls.h" +#if SODIUM_VERSION_INT >= 90200 gchar *remmina_sodium_pwhash(const gchar *pass) { diff --git a/src/remmina_sodium.h b/src/remmina_sodium.h index 5d7894904..afc9de5ff 100644 --- a/src/remmina_sodium.h +++ b/src/remmina_sodium.h @@ -36,7 +36,9 @@ G_BEGIN_DECLS -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#include <sodium.h> +#define SODIUM_VERSION_INT (SODIUM_LIBRARY_VERSION_MAJOR * 10000 + SODIUM_LIBRARY_VERSION_MINOR * 100) +#if SODIUM_VERSION_INT >= 90200 void remmina_sodium_init(void); gchar *remmina_sodium_pwhash(const gchar *pass); gchar *remmina_sodium_pwhash_str(const gchar *pass); diff --git a/src/remmina_unlock.c b/src/remmina_unlock.c index c851ca00b..e88fb521c 100644 --- a/src/remmina_unlock.c +++ b/src/remmina_unlock.c @@ -40,17 +40,13 @@ #include <glib/gprintf.h> #include "config.h" -#include <sodium.h> -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) #include "remmina_sodium.h" -#else -#endif #include "remmina_pref.h" #include "remmina_unlock.h" #include "remmina_public.h" #include "remmina/remmina_trace_calls.h" -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 static RemminaUnlockDialog *remmina_unlock_dialog; #define GET_OBJ(object_name) gtk_builder_get_object(remmina_unlock_dialog->builder, object_name) diff --git a/src/remmina_unlock.h b/src/remmina_unlock.h index 9fe523025..0641caad3 100644 --- a/src/remmina_unlock.h +++ b/src/remmina_unlock.h @@ -36,7 +36,7 @@ #include <sodium.h> -#if (SODIUM_LIBRARY_VERSION_MAJOR >= 9) && (SODIUM_LIBRARY_VERSION_MINOR >= 2) +#if SODIUM_VERSION_INT >= 90200 typedef struct _RemminaUnlockDialog { GtkBuilder *builder; GtkDialog *dialog; |