diff options
author | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2022-01-07 11:30:51 +0300 |
---|---|---|
committer | Antenore Gatta (tmow) <antenore@simbiosi.org> | 2022-01-07 11:30:51 +0300 |
commit | 8272aeb7c79872a38e845d1c87edc9517bcb6754 (patch) | |
tree | ed337547b8cbaf9d4d5a93d53116aef0ac78f157 | |
parent | e5f27de6ad23f85dd1cfcd0ec560b2c54234c58a (diff) |
Auditing facility
This patch add a macro to log auditing traces, this traces will be
shown when the audit is enabled in the general preferences (security):
- in the linux journal if available
- if Remmina has been started with the Remmina Desktop file
- if started from the terminal
- from the terminal if G_MESSAGES_DEBUG=all is set (always).
Signed-off-by: Antenore Gatta (tmow) <antenore@simbiosi.org>
-rw-r--r-- | data/ui/remmina_preferences.glade | 90 | ||||
-rw-r--r-- | plugins/exec/exec_plugin_config.h | 21 | ||||
-rw-r--r-- | plugins/gvnc/gvnc_plugin.h | 22 | ||||
-rw-r--r-- | plugins/rdp/rdp_channels.c | 3 | ||||
-rw-r--r-- | plugins/rdp/rdp_event.c | 3 | ||||
-rw-r--r-- | plugins/rdp/rdp_plugin.c | 7 | ||||
-rw-r--r-- | plugins/rdp/rdp_plugin.h | 27 | ||||
-rw-r--r-- | plugins/spice/spice_plugin.h | 22 | ||||
-rw-r--r-- | plugins/vnc/vnc_plugin.c | 1 | ||||
-rw-r--r-- | plugins/vnc/vnc_plugin.h | 21 | ||||
-rw-r--r-- | plugins/www/www_plugin.h | 21 | ||||
-rw-r--r-- | src/include/remmina/plugin.h | 1 | ||||
-rw-r--r-- | src/remmina.c | 4 | ||||
-rw-r--r-- | src/remmina_file.c | 1 | ||||
-rw-r--r-- | src/remmina_file_editor.c | 3 | ||||
-rw-r--r-- | src/remmina_file_editor.h | 6 | ||||
-rw-r--r-- | src/remmina_log.c | 37 | ||||
-rw-r--r-- | src/remmina_log.h | 2 | ||||
-rw-r--r-- | src/remmina_plugin_manager.c | 1 | ||||
-rw-r--r-- | src/remmina_pref.c | 6 | ||||
-rw-r--r-- | src/remmina_pref.h | 1 | ||||
-rw-r--r-- | src/remmina_pref_dialog.c | 11 | ||||
-rw-r--r-- | src/remmina_pref_dialog.h | 1 | ||||
-rw-r--r-- | src/remmina_ssh_plugin.c | 2 |
24 files changed, 212 insertions, 102 deletions
diff --git a/data/ui/remmina_preferences.glade b/data/ui/remmina_preferences.glade index 9defa9522..1418c189d 100644 --- a/data/ui/remmina_preferences.glade +++ b/data/ui/remmina_preferences.glade @@ -358,7 +358,7 @@ <object class="GtkEntry" id="entry_options_file_name"> <property name="visible">True</property> <property name="can-focus">True</property> - <property name="tooltip-text" translatable="yes">%G Group name (slash will be converted to - automatically) + <property name="tooltip-text" translatable="yes" comments="Place holders used to name a Remmina connection profile">%G Group name (slash will be converted to - automatically) %P Protocol name %N Connection name %h Hostname/IP @@ -1838,7 +1838,7 @@ It changes the background colour of connection names in the Remmina connection t <property name="can-focus">False</property> <property name="left-padding">12</property> <child> - <!-- n-columns=2 n-rows=4 --> + <!-- n-columns=2 n-rows=1 --> <object class="GtkGrid" id="grid_security_audit"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -1849,6 +1849,7 @@ It changes the background colour of connection names in the Remmina connection t <property name="halign">start</property> <property name="margin-start">18</property> <property name="margin-top">9</property> + <property name="margin-bottom">9</property> <property name="label" translatable="yes">Enable auditing logs</property> </object> <packing> @@ -1857,19 +1858,6 @@ It changes the background colour of connection names in the Remmina connection t </packing> </child> <child> - <object class="GtkLabel" id="label_security_audit_folder"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="margin-start">18</property> - <property name="label" translatable="yes">Auditing log folder path</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">1</property> - </packing> - </child> - <child> <object class="GtkSwitch" id="switch_security_audit"> <property name="visible">True</property> <property name="can-focus">True</property> @@ -1877,81 +1865,11 @@ It changes the background colour of connection names in the Remmina connection t <property name="margin-start">6</property> <property name="margin-end">18</property> <property name="margin-top">9</property> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">0</property> - </packing> - </child> - <child> - <object class="GtkFileChooserButton" id="filechooserbutton_audit_path"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="margin-start">6</property> - <property name="margin-end">18</property> - <property name="action">select-folder</property> - <property name="title" translatable="yes">Remmina audit log folder path</property> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label_security_audit_file"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="margin-start">18</property> - <property name="label" translatable="yes">Auditing log filename specification</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="audit_file_spec"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="halign">start</property> - <property name="margin-start">6</property> - <property name="margin-end">18</property> - <property name="placeholder-text" translatable="yes">remmina_audit_%Y%M%D.log</property> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label_security_audit_format"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="halign">start</property> - <property name="margin-start">18</property> - <property name="margin-bottom">9</property> - <property name="label" translatable="yes">Auditing log format specification</property> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">3</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="audit_format_spec"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="halign">start</property> - <property name="margin-start">6</property> - <property name="margin-end">18</property> <property name="margin-bottom">9</property> - <property name="placeholder-text" translatable="yes">%h %l %u %t \"%r\" %>s </property> </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">3</property> + <property name="top-attach">0</property> </packing> </child> </object> diff --git a/plugins/exec/exec_plugin_config.h b/plugins/exec/exec_plugin_config.h index 75549e82d..de9d15f40 100644 --- a/plugins/exec/exec_plugin_config.h +++ b/plugins/exec/exec_plugin_config.h @@ -41,3 +41,24 @@ #define PLUGIN_DESCRIPTION N_("Execute a command") #define PLUGIN_VERSION "1.0" #define PLUGIN_APPICON "org.remmina.Remmina-tool-symbolic" + +#define REMMINA_PLUGIN_INFO(fmt, ...) \ + remmina_plugin_service->_remmina_info(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_MESSAGE(fmt, ...) \ + remmina_plugin_service->_remmina_message(__func, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_DEBUG(fmt, ...) \ + remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_WARNING(fmt, ...) \ + remmina_plugin_service->_remmina_warning(__func__, fmt, ##__VA_ARGS__) + +/* This will intentionally crash Remmina */ +#define REMMINA_PLUGIN_ERROR(fmt, ...) \ + remmina_plugin_service->_remmina_error(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_CRITICAL(fmt, ...) \ + remmina_plugin_service->_remmina_critical(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_AUDIT(fmt, ...) \ + remmina_plugin_service->_remmina_audit(__func__, fmt, ##__VA_ARGS__) diff --git a/plugins/gvnc/gvnc_plugin.h b/plugins/gvnc/gvnc_plugin.h index c32003dbd..07b610e28 100644 --- a/plugins/gvnc/gvnc_plugin.h +++ b/plugins/gvnc/gvnc_plugin.h @@ -87,7 +87,27 @@ #endif #define GET_PLUGIN_DATA(gp) (GVncPluginData *)g_object_get_data(G_OBJECT(gp), "plugin-data") -#define REMMINA_PLUGIN_DEBUG(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ## __VA_ARGS__) + +#define REMMINA_PLUGIN_INFO(fmt, ...) \ + remmina_plugin_service->_remmina_info(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_MESSAGE(fmt, ...) \ + remmina_plugin_service->_remmina_message(__func, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_DEBUG(fmt, ...) \ + remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_WARNING(fmt, ...) \ + remmina_plugin_service->_remmina_warning(__func__, fmt, ##__VA_ARGS__) + +/* This will intentionally crash Remmina */ +#define REMMINA_PLUGIN_ERROR(fmt, ...) \ + remmina_plugin_service->_remmina_error(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_CRITICAL(fmt, ...) \ + remmina_plugin_service->_remmina_critical(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_AUDIT(fmt, ...) \ + remmina_plugin_service->_remmina_audit(__func__, fmt, ##__VA_ARGS__) typedef struct _GVncPluginData { GtkWidget * box; diff --git a/plugins/rdp/rdp_channels.c b/plugins/rdp/rdp_channels.c index 96dd0f540..f5089b7c1 100644 --- a/plugins/rdp/rdp_channels.c +++ b/plugins/rdp/rdp_channels.c @@ -79,7 +79,8 @@ void remmina_rdp_OnChannelConnectedEventHandler(rdpContext* context, ChannelConn if (rfi->scale == REMMINA_PROTOCOL_WIDGET_SCALE_MODE_DYNRES) { remmina_rdp_event_send_delayed_monitor_layout(rfi->protocol_widget); } - }REMMINA_PLUGIN_DEBUG("Channel %s has been opened", e->name); + } + REMMINA_PLUGIN_DEBUG("Channel %s has been opened", e->name); } void remmina_rdp_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e) diff --git a/plugins/rdp/rdp_event.c b/plugins/rdp/rdp_event.c index 91eb3a6a2..251f9ae0d 100644 --- a/plugins/rdp/rdp_event.c +++ b/plugins/rdp/rdp_event.c @@ -1112,6 +1112,9 @@ static void remmina_rdp_event_connected(RemminaProtocolWidget *gp, RemminaPlugin remmina_rdp_event_update_scale(gp); remmina_plugin_service->protocol_plugin_signal_connection_opened(gp); + const gchar *host = freerdp_settings_get_string (rfi->settings, FreeRDP_ServerHostname); + // TRANSLATORS: the placeholder may be either an IP/FQDN or a server hostname + REMMINA_PLUGIN_AUDIT(_("Connected to %s via RDP"), host); } static void remmina_rdp_event_reconnect_progress(RemminaProtocolWidget *gp, RemminaPluginRdpUiObject *ui) diff --git a/plugins/rdp/rdp_plugin.c b/plugins/rdp/rdp_plugin.c index 6cadfae5c..01354f67e 100644 --- a/plugins/rdp/rdp_plugin.c +++ b/plugins/rdp/rdp_plugin.c @@ -1022,6 +1022,9 @@ static void remmina_rdp_main_loop(RemminaProtocolWidget *gp) break; } } + const gchar *host = freerdp_settings_get_string (rfi->settings, FreeRDP_ServerHostname); + // TRANSLATORS: the placeholder may be either an IP/FQDN or a server hostname + REMMINA_PLUGIN_AUDIT(_("Disconnected from %s via RDP"), host); freerdp_disconnect(rfi->instance); REMMINA_PLUGIN_DEBUG("RDP client disconnected"); } @@ -1305,14 +1308,14 @@ static gchar *remmina_get_rdp_kbd_remap(const gchar *keymap) rdp_kbd_remap = g_malloc0(512); display = XOpenDisplay(0); for (i = 0; table[i] > 0; i += 2) { - g_snprintf(keys, sizeof(keys), "0x%02x=0x%02x", freerdp_keyboard_get_rdp_scancode_from_x11_keycode(XKeysymToKeycode(display, table[i])), + g_snprintf(keys, sizeof(keys), "0x%02x=0x%02x", freerdp_keyboard_get_rdp_scancode_from_x11_keycode(XKeysymToKeycode(display, table[i])), freerdp_keyboard_get_rdp_scancode_from_x11_keycode(XKeysymToKeycode(display, table[i + 1]))); if (i > 0) g_strlcat(rdp_kbd_remap, ",", 512); g_strlcat(rdp_kbd_remap, keys, 512); } XCloseDisplay(display); - + return rdp_kbd_remap; } diff --git a/plugins/rdp/rdp_plugin.h b/plugins/rdp/rdp_plugin.h index 9702bafce..bb26c3fe5 100644 --- a/plugins/rdp/rdp_plugin.h +++ b/plugins/rdp/rdp_plugin.h @@ -62,7 +62,6 @@ * * Returns: %TRUE if FREERDP headers are new enough */ - #define FREERDP_CHECK_VERSION(major,minor,revision) \ (FREERDP_VERSION_MAJOR > (major) || \ (FREERDP_VERSION_MAJOR == (major) && FREERDP_VERSION_MINOR > (minor)) || \ @@ -82,7 +81,9 @@ typedef struct rf_context rfContext; #define GET_PLUGIN_DATA(gp) (rfContext *)g_object_get_data(G_OBJECT(gp), "plugin-data") -/* Performance Flags, from freerdp source +/** + * Performance Flags, from freerdp source + * * PERF_FLAG_NONE 0x00000000 * PERF_DISABLE_WALLPAPER 0x00000001 * PERF_DISABLE_FULLWINDOWDRAG 0x00000002 @@ -103,7 +104,27 @@ typedef struct rf_context rfContext; #define DEFAULT_QUALITY_9 0x80 extern RemminaPluginService *remmina_plugin_service; -#define REMMINA_PLUGIN_DEBUG(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_INFO(fmt, ...) \ + remmina_plugin_service->_remmina_info(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_MESSAGE(fmt, ...) \ + remmina_plugin_service->_remmina_message(__func, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_DEBUG(fmt, ...) \ + remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_WARNING(fmt, ...) \ + remmina_plugin_service->_remmina_warning(__func__, fmt, ##__VA_ARGS__) + +/* This will intentionally crash Remmina */ +#define REMMINA_PLUGIN_ERROR(fmt, ...) \ + remmina_plugin_service->_remmina_error(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_CRITICAL(fmt, ...) \ + remmina_plugin_service->_remmina_critical(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_AUDIT(fmt, ...) \ + remmina_plugin_service->_remmina_audit(__func__, fmt, ##__VA_ARGS__) struct rf_clipboard { rfContext * rfi; diff --git a/plugins/spice/spice_plugin.h b/plugins/spice/spice_plugin.h index 10d1c1eb5..6303e5192 100644 --- a/plugins/spice/spice_plugin.h +++ b/plugins/spice/spice_plugin.h @@ -51,7 +51,27 @@ #define GET_PLUGIN_DATA(gp) (RemminaPluginSpiceData *)g_object_get_data(G_OBJECT(gp), "plugin-data") extern RemminaPluginService *remmina_plugin_service; -#define REMMINA_PLUGIN_DEBUG(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_INFO(fmt, ...) \ + remmina_plugin_service->_remmina_info(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_MESSAGE(fmt, ...) \ + remmina_plugin_service->_remmina_message(__func, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_DEBUG(fmt, ...) \ + remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_WARNING(fmt, ...) \ + remmina_plugin_service->_remmina_warning(__func__, fmt, ##__VA_ARGS__) + +/* This will intentionally crash Remmina */ +#define REMMINA_PLUGIN_ERROR(fmt, ...) \ + remmina_plugin_service->_remmina_error(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_CRITICAL(fmt, ...) \ + remmina_plugin_service->_remmina_critical(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_AUDIT(fmt, ...) \ + remmina_plugin_service->_remmina_audit(__func__, fmt, ##__VA_ARGS__) typedef struct _RemminaPluginSpiceData { SpiceAudio * audio; diff --git a/plugins/vnc/vnc_plugin.c b/plugins/vnc/vnc_plugin.c index 54a1e77d1..dbe56c282 100644 --- a/plugins/vnc/vnc_plugin.c +++ b/plugins/vnc/vnc_plugin.c @@ -51,7 +51,6 @@ #define GET_PLUGIN_DATA(gp) (RemminaPluginVncData *)g_object_get_data(G_OBJECT(gp), "plugin-data") static RemminaPluginService *remmina_plugin_service = NULL; -#define REMMINA_PLUGIN_DEBUG(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ## __VA_ARGS__) static int dot_cursor_x_hot = 2; static int dot_cursor_y_hot = 2; diff --git a/plugins/vnc/vnc_plugin.h b/plugins/vnc/vnc_plugin.h index bc2aceaa2..b79f0c1c7 100644 --- a/plugins/vnc/vnc_plugin.h +++ b/plugins/vnc/vnc_plugin.h @@ -49,6 +49,27 @@ #define VNCI_PLUGIN_SSH_APPICON "org.remmina.Remmina-vnc-ssh-symbolic" #endif +#define REMMINA_PLUGIN_INFO(fmt, ...) \ + remmina_plugin_service->_remmina_info(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_MESSAGE(fmt, ...) \ + remmina_plugin_service->_remmina_message(__func, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_DEBUG(fmt, ...) \ + remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_WARNING(fmt, ...) \ + remmina_plugin_service->_remmina_warning(__func__, fmt, ##__VA_ARGS__) + +/* This will intentionally crash Remmina */ +#define REMMINA_PLUGIN_ERROR(fmt, ...) \ + remmina_plugin_service->_remmina_error(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_CRITICAL(fmt, ...) \ + remmina_plugin_service->_remmina_critical(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_AUDIT(fmt, ...) \ + remmina_plugin_service->_remmina_audit(__func__, fmt, ##__VA_ARGS__) + typedef struct _RemminaPluginVncData { /* Whether the user requests to connect/disconnect */ gboolean connected; diff --git a/plugins/www/www_plugin.h b/plugins/www/www_plugin.h index 0a06d290e..b599d597f 100644 --- a/plugins/www/www_plugin.h +++ b/plugins/www/www_plugin.h @@ -48,8 +48,27 @@ typedef enum { } WWWWebViewDocumentType; extern RemminaPluginService *remmina_plugin_service; -#define REMMINA_PLUGIN_DEBUG(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_INFO(fmt, ...) \ + remmina_plugin_service->_remmina_info(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_MESSAGE(fmt, ...) \ + remmina_plugin_service->_remmina_message(__func, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_DEBUG(fmt, ...) \ + remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_WARNING(fmt, ...) \ + remmina_plugin_service->_remmina_warning(__func__, fmt, ##__VA_ARGS__) + +/* This will intentionally crash Remmina */ +#define REMMINA_PLUGIN_ERROR(fmt, ...) \ + remmina_plugin_service->_remmina_error(__func__, fmt, ##__VA_ARGS__) + +#define REMMINA_PLUGIN_CRITICAL(fmt, ...) \ + remmina_plugin_service->_remmina_critical(__func__, fmt, ##__VA_ARGS__) +#define REMMINA_PLUGIN_AUDIT(fmt, ...) \ + remmina_plugin_service->_remmina_audit(__func__, fmt, ##__VA_ARGS__) G_BEGIN_DECLS void remmina_plugin_www_decide_nav(WebKitPolicyDecision *decision, RemminaProtocolWidget *gp); diff --git a/src/include/remmina/plugin.h b/src/include/remmina/plugin.h index a05114671..a6ff980f3 100644 --- a/src/include/remmina/plugin.h +++ b/src/include/remmina/plugin.h @@ -221,6 +221,7 @@ typedef struct _RemminaPluginService { void (*_remmina_message)(const gchar *fmt, ...); void (*_remmina_debug)(const gchar *func, const gchar *fmt, ...); void (*_remmina_warning)(const gchar *func, const gchar *fmt, ...); + void (*_remmina_audit)(const gchar *func, const gchar *fmt, ...); void (*_remmina_error)(const gchar *func, const gchar *fmt, ...); void (*_remmina_critical)(const gchar *func, const gchar *fmt, ...); void (*log_print)(const gchar *text); diff --git a/src/remmina.c b/src/remmina.c index 3d390de32..6db94cf32 100644 --- a/src/remmina.c +++ b/src/remmina.c @@ -32,6 +32,10 @@ * */ +#define G_LOG_USE_STRUCTURED +#ifndef G_LOG_DOMAIN +#define G_LOG_DOMAIN ((gchar*)"remmina") +#endif /* G_LOG_DOMAIN */ #include <gdk/gdkx.h> #include <gio/gio.h> #include <glib/gi18n.h> diff --git a/src/remmina_file.c b/src/remmina_file.c index be8864833..0f7c393a8 100644 --- a/src/remmina_file.c +++ b/src/remmina_file.c @@ -175,6 +175,7 @@ void remmina_file_generate_filename(RemminaFile *remminafile) else remminafile->filename = NULL; g_dir_close(dir); + } void remmina_file_set_filename(RemminaFile *remminafile, const gchar *filename) diff --git a/src/remmina_file_editor.c b/src/remmina_file_editor.c index c616fd36d..096bf122f 100644 --- a/src/remmina_file_editor.c +++ b/src/remmina_file_editor.c @@ -35,9 +35,6 @@ */ #include <ctype.h> -#include <gtk/gtk.h> -#include <glib/gi18n.h> -#include <stdlib.h> #include "config.h" #ifdef HAVE_LIBAVAHI_UI #include <avahi-ui/avahi-ui.h> diff --git a/src/remmina_file_editor.h b/src/remmina_file_editor.h index 8ebe327c8..a37fc3dfc 100644 --- a/src/remmina_file_editor.h +++ b/src/remmina_file_editor.h @@ -36,6 +36,12 @@ #pragma once +#include <stdarg.h> +#include <glib/gi18n.h> +#include <gtk/gtk.h> + +#include "remmina_file.h" + G_BEGIN_DECLS #define REMMINA_TYPE_FILE_EDITOR (remmina_file_editor_get_type()) diff --git a/src/remmina_log.c b/src/remmina_log.c index 5c73e2e9a..f9b9ff397 100644 --- a/src/remmina_log.c +++ b/src/remmina_log.c @@ -37,6 +37,7 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include "remmina_public.h" +#include "remmina_pref.h" #include "remmina_log.h" #include "remmina_stats.h" #include "remmina/remmina_trace_calls.h" @@ -106,7 +107,7 @@ static void remmina_log_end(GtkWidget *widget, gpointer data) log_window = NULL; } -static void remmina_log_start_stop (GtkSwitch *logswitch, gpointer user_data) +static void remmina_log_start_stop (GtkSwitch *logswitch, gpointer user_data) { TRACE_CALL(__func__); logstart = !logstart; @@ -308,6 +309,40 @@ void _remmina_warning(const gchar *fun, const gchar *fmt, ...) IDLE_ADD(remmina_log_print_real, bufn); } +void _remmina_audit(const gchar *fun, const gchar *fmt, ...) +{ + TRACE_CALL(__func__); + va_list args; + va_start(args, fmt); + gchar *text = g_strdup_vprintf(fmt, args); + va_end(args); + + GTimeVal tv; + g_get_current_time(&tv); + gchar *isodate = g_time_val_to_iso8601(&tv); + + g_autofree gchar *buf = g_strdup(""); + + if (isodate) { + + buf = g_strconcat( + "[", isodate, "] - ", + g_get_host_name (), + " - ", + g_get_user_name (), + " - ", + text, + NULL); + + } + + g_free(text); + if (remmina_pref_get_boolean("audit")) + _remmina_message(buf); + else + _remmina_debug(fun, buf); +} + // !!! Calling this function will crash Remmina !!! // !!! purposefully and send a trap signal !!! void _remmina_error(const gchar *fun, const gchar *fmt, ...) diff --git a/src/remmina_log.h b/src/remmina_log.h index 90e7bbdf4..f12a98590 100644 --- a/src/remmina_log.h +++ b/src/remmina_log.h @@ -44,6 +44,7 @@ G_BEGIN_DECLS #define REMMINA_MESSAGE(fmt, ...) _remmina_message(fmt, ## __VA_ARGS__) #define REMMINA_DEBUG(fmt, ...) _remmina_debug(__func__, fmt, ## __VA_ARGS__) #define REMMINA_WARNING(fmt, ...) _remmina_warning(__func__, fmt, ## __VA_ARGS__) +#define REMMINA_AUDIT(fmt, ...) _remmina_audit(__func__, fmt, ## __VA_ARGS__) #define REMMINA_ERROR(fmt, ...) _remmina_error(__func__, fmt, ## __VA_ARGS__) #define REMMINA_CRITICAL(fmt, ...) _remmina_critical(__func__, fmt, ## __VA_ARGS__) @@ -54,6 +55,7 @@ void _remmina_info(const gchar *fmt, ...); void _remmina_message(const gchar *fmt, ...); void _remmina_debug(const gchar *fun, const gchar *fmt, ...); void _remmina_warning(const gchar *fun, const gchar *fmt, ...); +void _remmina_audit(const gchar *fun, const gchar *fmt, ...); void _remmina_error(const gchar *fun, const gchar *fmt, ...); void _remmina_critical(const gchar *fun, const gchar *fmt, ...); void remmina_log_printf(const gchar *fmt, ...); diff --git a/src/remmina_plugin_manager.c b/src/remmina_plugin_manager.c index e0e5f79f3..ea4cc057e 100644 --- a/src/remmina_plugin_manager.c +++ b/src/remmina_plugin_manager.c @@ -243,6 +243,7 @@ RemminaPluginService remmina_plugin_manager_service = _remmina_message, _remmina_debug, _remmina_warning, + _remmina_audit, _remmina_error, _remmina_critical, remmina_log_print, diff --git a/src/remmina_pref.c b/src/remmina_pref.c index efe637d75..330770125 100644 --- a/src/remmina_pref.c +++ b/src/remmina_pref.c @@ -310,6 +310,11 @@ void remmina_pref_init(void) else remmina_pref.lock_edit = FALSE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "audit", NULL)) + remmina_pref.audit = g_key_file_get_boolean(gkeyfile, "remmina_pref", "audit", NULL); + else + remmina_pref.audit = FALSE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "trust_all", NULL)) remmina_pref.trust_all = g_key_file_get_boolean(gkeyfile, "remmina_pref", "trust_all", NULL); else @@ -795,6 +800,7 @@ gboolean remmina_pref_save(void) g_key_file_set_boolean(gkeyfile, "remmina_pref", "lock_connect", FALSE); g_key_file_set_boolean(gkeyfile, "remmina_pref", "lock_edit", FALSE); #endif + g_key_file_set_boolean(gkeyfile, "remmina_pref", "audit", remmina_pref.audit); g_key_file_set_boolean(gkeyfile, "remmina_pref", "trust_all", remmina_pref.trust_all); g_key_file_set_integer(gkeyfile, "remmina_pref", "floating_toolbar_placement", remmina_pref.floating_toolbar_placement); g_key_file_set_integer(gkeyfile, "remmina_pref", "toolbar_placement", remmina_pref.toolbar_placement); diff --git a/src/remmina_pref.h b/src/remmina_pref.h index 6e5fc9ed7..d417f54c4 100644 --- a/src/remmina_pref.h +++ b/src/remmina_pref.h @@ -173,6 +173,7 @@ typedef struct _RemminaPref { gint unlock_timeout; gboolean lock_connect; gboolean lock_edit; + gboolean audit; gboolean trust_all; /* In RemminaPrefDialog terminal tab */ gchar * vte_font; diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c index 6d9053cff..3887ad662 100644 --- a/src/remmina_pref_dialog.c +++ b/src/remmina_pref_dialog.c @@ -241,6 +241,7 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) #endif remmina_pref.lock_connect = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_security_lock_connect)); remmina_pref.lock_edit = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_security_lock_edit)); + remmina_pref.audit = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_security_audit)); remmina_pref.trust_all = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_security_trust_all)); remmina_pref.screenshot_path = gtk_file_chooser_get_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path); remmina_pref.fullscreen_on_auto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto)); @@ -490,6 +491,13 @@ static void remmina_pref_dialog_init(void) gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_lock_edit), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_timeout), FALSE); #endif + gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_audit), remmina_pref.audit); + gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->switch_security_audit), TRUE); + if (remmina_pref.remmina_file_name != NULL) + gtk_entry_set_text(remmina_pref_dialog->entry_options_file_name, remmina_pref.remmina_file_name); + else + gtk_entry_set_text(remmina_pref_dialog->entry_options_file_name, "%G_%P_%N_%h.remmina"); + gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_trust_all), remmina_pref.trust_all); gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_options_deny_screenshot_clipboard), remmina_pref.deny_screenshot_clipboard); @@ -713,10 +721,12 @@ GtkWidget *remmina_pref_dialog_new(gint default_tab, GtkWindow *parent) remmina_pref_dialog->switch_options_deny_screenshot_clipboard = GTK_SWITCH(GET_OBJECT("switch_options_deny_screenshot_clipboard")); remmina_pref_dialog->switch_options_remember_last_view_mode = GTK_SWITCH(GET_OBJECT("switch_options_remember_last_view_mode")); remmina_pref_dialog->switch_security_use_primary_password = GTK_SWITCH(GET_OBJECT("switch_security_use_primary_password")); + remmina_pref_dialog->unlock_timeout = GTK_ENTRY(GET_OBJECT("unlock_timeout")); remmina_pref_dialog->unlock_password = GTK_ENTRY(GET_OBJECT("unlock_password")); remmina_pref_dialog->unlock_repassword = GTK_ENTRY(GET_OBJECT("unlock_repassword")); remmina_pref_dialog->switch_security_lock_connect = GTK_SWITCH(GET_OBJECT("switch_security_lock_connect")); remmina_pref_dialog->switch_security_lock_edit = GTK_SWITCH(GET_OBJECT("switch_security_lock_edit")); + remmina_pref_dialog->switch_security_audit = GTK_SWITCH(GET_OBJECT("switch_security_audit")); remmina_pref_dialog->switch_security_trust_all = GTK_SWITCH(GET_OBJECT("switch_security_trust_all")); remmina_pref_dialog->checkbutton_options_save_settings = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_save_settings")); remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_fullscreen_on_auto")); @@ -742,7 +752,6 @@ GtkWidget *remmina_pref_dialog_new(gint default_tab, GtkWindow *parent) remmina_pref_dialog->entry_grab_color = GTK_ENTRY(GET_OBJECT("entry_grab_color")); remmina_pref_dialog->switch_appearance_grab_color = GTK_SWITCH(GET_OBJECT("switch_appearance_grab_color")); remmina_pref_dialog->button_options_recent_items_clear = GTK_BUTTON(GET_OBJECT("button_options_recent_items_clear")); - remmina_pref_dialog->unlock_timeout = GTK_ENTRY(GET_OBJECT("unlock_timeout")); remmina_pref_dialog->checkbutton_applet_new_connection_on_top = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_applet_new_connection_on_top")); remmina_pref_dialog->checkbutton_applet_hide_totals = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_applet_hide_totals")); diff --git a/src/remmina_pref_dialog.h b/src/remmina_pref_dialog.h index 97163343e..74a086ef2 100644 --- a/src/remmina_pref_dialog.h +++ b/src/remmina_pref_dialog.h @@ -62,6 +62,7 @@ typedef struct _RemminaPrefDialog { GtkEntry * unlock_repassword; GtkSwitch * switch_security_lock_connect; GtkSwitch * switch_security_lock_edit; + GtkSwitch * switch_security_audit; GtkSwitch * switch_security_trust_all; GtkCheckButton * checkbutton_options_save_settings; GtkCheckButton * checkbutton_appearance_fullscreen_on_auto; diff --git a/src/remmina_ssh_plugin.c b/src/remmina_ssh_plugin.c index 7a9aa9e7f..13928df96 100644 --- a/src/remmina_ssh_plugin.c +++ b/src/remmina_ssh_plugin.c @@ -338,7 +338,7 @@ remmina_plugin_ssh_main_thread(gpointer data) continue; break; case REMMINA_SSH_AUTH_RECONNECT: - REMMINA_DEBUG("Reconnecting..."); + REMMINA_DEBUG("Reconnecting…"); if (ssh->session) { ssh_disconnect(ssh->session); ssh_free(ssh->session); |