Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntenore Gatta (tmow) <antenore@simbiosi.org>2022-01-15 02:32:16 +0300
committerAntenore Gatta (tmow) <antenore@simbiosi.org>2022-01-15 02:32:16 +0300
commit1a1d23cf533c0964967928ec9a1352ae328fe2e1 (patch)
tree02e40431262d39b6888811b3b23bbd892779604c
parent9f0784aad43a1ea42ca511407516ac10c1c83241 (diff)
Refactoring security tab, solves #2676
-rw-r--r--data/ui/remmina_preferences.glade632
-rw-r--r--src/remmina_file.c1
-rw-r--r--src/remmina_pref.c2
-rw-r--r--src/remmina_pref.h1
-rw-r--r--src/remmina_pref_dialog.c72
-rw-r--r--src/remmina_pref_dialog.h2
-rw-r--r--src/remmina_unlock.c2
7 files changed, 258 insertions, 454 deletions
diff --git a/data/ui/remmina_preferences.glade b/data/ui/remmina_preferences.glade
index b09999319..be4cdc0f3 100644
--- a/data/ui/remmina_preferences.glade
+++ b/data/ui/remmina_preferences.glade
@@ -717,35 +717,35 @@
</packing>
</child>
<child>
- <object class="GtkSwitch" id="switch_appearance_grab_color">
+ <object class="GtkEntry" id="entry_grab_color">
<property name="visible">True</property>
<property name="can-focus">True</property>
- <property name="tooltip-text" translatable="yes">Enable/Disable “Grab all keyboard events” status colour</property>
- <property name="halign">start</property>
+ <property name="tooltip-text" translatable="yes">Hexadecimal- or colour names (red, #ff0000).
+It changes the background colour of connection names in the Remmina connection toolbar (when in fullscreen).</property>
<property name="margin-start">6</property>
- <property name="margin-end">6</property>
+ <property name="margin-end">18</property>
<property name="margin-top">18</property>
- <signal name="notify::active" handler="remmina_prefdiag_on_grab_color_activated" swapped="no"/>
+ <property name="width-chars">8</property>
+ <property name="placeholder-text">#00FF00</property>
</object>
<packing>
- <property name="left-attach">1</property>
+ <property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="entry_grab_color">
+ <object class="GtkSwitch" id="switch_appearance_grab_color">
<property name="visible">True</property>
<property name="can-focus">True</property>
- <property name="tooltip-text" translatable="yes">Hexadecimal- or colour names (red, #ff0000).
-It changes the background colour of connection names in the Remmina connection toolbar (when in fullscreen).</property>
+ <property name="tooltip-text" translatable="yes">Enable/Disable “Grab all keyboard events” status colour</property>
+ <property name="halign">start</property>
<property name="margin-start">6</property>
- <property name="margin-end">18</property>
+ <property name="margin-end">6</property>
<property name="margin-top">18</property>
- <property name="width-chars">8</property>
- <property name="placeholder-text">#00FF00</property>
+ <signal name="notify::active" handler="remmina_prefdiag_on_grab_color_activated" swapped="no"/>
</object>
<packing>
- <property name="left-attach">2</property>
+ <property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -1601,402 +1601,228 @@ It changes the background colour of connection names in the Remmina connection t
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
- <object class="GtkBox">
+ <!-- n-columns=2 n-rows=7 -->
+ <object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label-xalign">0</property>
- <property name="shadow-type">out</property>
- <child>
- <object class="GtkAlignment">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="left-padding">12</property>
- <child>
- <!-- n-columns=2 n-rows=7 -->
- <object class="GtkGrid" id="grid_security">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="row-spacing">5</property>
- <property name="column-spacing">7</property>
- <child>
- <object class="GtkLabel" id="label_security_use_primary_password">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="tooltip-text" translatable="yes">Set and use a secret key to protect Remmina from unothorized use.</property>
- <property name="halign">start</property>
- <property name="margin-start">18</property>
- <property name="margin-top">9</property>
- <property name="label" translatable="yes">Use Remmina password</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="switch_security_use_primary_password">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="tooltip-text" translatable="yes">Use secret key authentication for some widgets</property>
- <property name="halign">start</property>
- <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="GtkLabel" id="label_security_lock_interval">
- <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">Automatic lock interval</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="unlock_timeout">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="tooltip-text" translatable="yes">Number of seconds to keep password valid for</property>
- <property name="halign">start</property>
- <property name="margin-start">6</property>
- <property name="margin-end">18</property>
- <property name="width-chars">24</property>
- <property name="text">300</property>
- <property name="input-purpose">number</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_security_primary_password">
- <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">Enter new password</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="unlock_password">
- <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="visibility">False</property>
- <property name="invisible-char">•</property>
- <property name="width-chars">24</property>
- <property name="input-purpose">password</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_security_repeat_password">
- <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">Re-enter password</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="unlock_repassword">
- <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="visibility">False</property>
- <property name="invisible-char">•</property>
- <property name="width-chars">24</property>
- <property name="input-purpose">password</property>
- <signal name="changed" handler="remmina_prefdiag_unlock_repwd_on_changed" swapped="no"/>
- <style>
- <class name="unlock_repassword"/>
- </style>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_security_lock_edit">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="tooltip-text" translatable="yes">Creation, editing, copying, and deletions require the Remmina password</property>
- <property name="halign">start</property>
- <property name="margin-start">18</property>
- <property name="label" translatable="yes" comments="Creation, editing, copying, and deletions require the primary password">Require to modify</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="switch_security_lock_connect">
- <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>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="switch_security_lock_edit">
- <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>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_security_lock_connection">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="tooltip-text" translatable="yes">Enter your Remmina password to connect</property>
- <property name="halign">start</property>
- <property name="margin-start">18</property>
- <property name="label" translatable="yes">Require to connect</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <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">Encryption method</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="comboboxtext_security_enc_method">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="tooltip-text" translatable="yes">These are the encryption methods used by Remmina to store passwords.
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <child>
+ <object class="GtkLabel" id="label_security_use_primary_password">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="tooltip-text" translatable="yes">Set and use a secret key to protect Remmina from unothorized use.</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">18</property>
+ <property name="margin-top">9</property>
+ <property name="label" translatable="yes">Remmina password</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_security_use_primary_password">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="tooltip-text" translatable="yes">Use secret key authentication for some widgets</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">18</property>
+ <property name="margin-top">9</property>
+ <signal name="notify::active" handler="remmina_prefdiag_on_use_password_activated" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_security_lock_interval">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">18</property>
+ <property name="label" translatable="yes">Valid for</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">18</property>
+ <property name="label" translatable="yes">Encryption</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_security_lock_connection">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="tooltip-text" translatable="yes">Enter your Remmina password to connect</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">18</property>
+ <property name="label" translatable="yes">Require to connect</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_security_lock_edit">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="tooltip-text" translatable="yes">Creation, editing, copying, and deletions require the Remmina password</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">18</property>
+ <property name="label" translatable="yes" comments="Creation, editing, copying, and deletions require the primary password">Require to modify</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_security_enable_audit">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">18</property>
+ <property name="margin-top">9</property>
+ <property name="label" translatable="yes">Auditing log</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_security_trust_fingerprints">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="tooltip-text" translatable="yes">Automatically accept all fingerprints and certificates</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">18</property>
+ <property name="margin-top">9</property>
+ <property name="label" translatable="yes">Trust all certificates</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="unlock_timeout">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="tooltip-text" translatable="yes">Number of seconds to keep password valid for</property>
+ <property name="valign">center</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">18</property>
+ <property name="width-chars">24</property>
+ <property name="text">300</property>
+ <property name="input-purpose">number</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="comboboxtext_security_enc_method">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="tooltip-text" translatable="yes">These are the encryption methods used by Remmina to store passwords.
Except the "Weak" method, all the others are reccomended, Keystore is the default, as it integrates with KDE/Plasma and GNOME.
"Intermediate" doesn't use as much memory or processsing power, and "Sensitive" is more secure but uses 1 Gib of RAM and many CPU cycles. </property>
- <property name="halign">start</property>
- <property name="margin-start">6</property>
- <property name="margin-end">18</property>
- <property name="margin-bottom">9</property>
- <items>
- <item id="0" translatable="yes">Keystore (KWallet, GNOME Keyring)</item>
- <item id="1" translatable="yes">Intermediate (+64 Mib RAM)</item>
- <item id="2" translatable="yes">Strong (+256 Mib, &lt;1s i7 CPU)</item>
- <item id="3" translatable="yes">Sensitive (+1 Gib, &lt;4s i7 CPU)</item>
- <item id="4" translatable="yes">Weak (guessable)</item>
- <item id="5" translatable="yes">None (cleartext)</item>
- </items>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">6</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="margin-start">9</property>
- <property name="margin-top">18</property>
- <property name="label" translatable="yes">Logins and Passwords</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label-xalign">0</property>
- <property name="shadow-type">out</property>
- <child>
- <object class="GtkAlignment">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="left-padding">12</property>
- <child>
- <!-- n-columns=2 n-rows=1 -->
- <object class="GtkGrid" id="grid_security_audit">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <child>
- <object class="GtkLabel" id="label_security_enable_audit">
- <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-top">9</property>
- <property name="margin-bottom">9</property>
- <property name="label" translatable="yes">Logging</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="switch_security_audit">
- <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-top">9</property>
- <property name="margin-bottom">9</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="margin-start">9</property>
- <property name="label" translatable="yes">Auditing</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label-xalign">0</property>
- <property name="shadow-type">out</property>
- <child>
- <object class="GtkAlignment">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="left-padding">12</property>
- <child>
- <!-- n-columns=2 n-rows=1 -->
- <object class="GtkGrid" id="grid_security_certs">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <child>
- <object class="GtkLabel" id="label_security_trust_fingerprints">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="tooltip-text" translatable="yes">Automatically accept all fingerprints and certificates</property>
- <property name="halign">start</property>
- <property name="margin-left">18</property>
- <property name="margin-start">18</property>
- <property name="margin-top">9</property>
- <property name="margin-bottom">18</property>
- <property name="label" translatable="yes">Trust all</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="switch_security_trust_all">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="tooltip-text" translatable="yes">Use secret key authentication for some widgets</property>
- <property name="halign">start</property>
- <property name="margin-left">6</property>
- <property name="margin-right">18</property>
- <property name="margin-start">6</property>
- <property name="margin-end">18</property>
- <property name="margin-top">9</property>
- <property name="margin-bottom">18</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="margin-start">9</property>
- <property name="label" translatable="yes">Certificates and fingerprints</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
+ <property name="valign">center</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">18</property>
+ <items>
+ <item id="1" translatable="yes">Intermediate (+64 Mib RAM)</item>
+ <item id="2" translatable="yes">Strong (+256 Mib, &lt;1s i7 CPU)</item>
+ <item id="3" translatable="yes">Sensitive (+1 Gib, &lt;4s i7 CPU)</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_security_lock_connect">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">18</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_security_lock_edit">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">18</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_security_audit">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">18</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_security_trust_all">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">18</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">6</property>
</packing>
</child>
</object>
diff --git a/src/remmina_file.c b/src/remmina_file.c
index b27056ab3..9dc38a516 100644
--- a/src/remmina_file.c
+++ b/src/remmina_file.c
@@ -349,7 +349,6 @@ remmina_file_load(const gchar *filename)
GKeyFile *gkeyfile;
RemminaFile *remminafile;
gchar *key;
- gint i;
gchar *s;
RemminaProtocolPlugin *protocol_plugin;
RemminaSecretPlugin *secret_plugin;
diff --git a/src/remmina_pref.c b/src/remmina_pref.c
index acf2eb694..845f69097 100644
--- a/src/remmina_pref.c
+++ b/src/remmina_pref.c
@@ -313,7 +313,7 @@ void remmina_pref_init(void)
if (g_key_file_has_key(gkeyfile, "remmina_pref", "enc_mode", NULL))
remmina_pref.enc_mode = g_key_file_get_integer(gkeyfile, "remmina_pref", "enc_mode", NULL);
else
- remmina_pref.enc_mode = 0;
+ remmina_pref.enc_mode = 1;
if (g_key_file_has_key(gkeyfile, "remmina_pref", "audit", NULL))
remmina_pref.audit = g_key_file_get_boolean(gkeyfile, "remmina_pref", "audit", NULL);
diff --git a/src/remmina_pref.h b/src/remmina_pref.h
index 198197b80..7e90d01b9 100644
--- a/src/remmina_pref.h
+++ b/src/remmina_pref.h
@@ -86,6 +86,7 @@ enum {
REMMINA_TAB_NONE = 3
};
+/* Remember to add the id 0, 4 and 5 in the remmina pref editor */
enum {
RM_ENC_MODE_SECRET = 0, /* Using libsecret */
RM_ENC_MODE_SODIUM_INTERACTIVE = 1, /* Using libsodium */
diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c
index 3a2f7d385..bfb7b9390 100644
--- a/src/remmina_pref_dialog.c
+++ b/src/remmina_pref_dialog.c
@@ -44,6 +44,7 @@
#include "remmina_log.h"
#include "remmina_file_manager.h"
#include "remmina_sodium.h"
+#include "remmina_passwd.h"
#include "remmina_public.h"
#include "remmina_string_list.h"
#include "remmina_widget_pool.h"
@@ -167,40 +168,32 @@ void remmina_prefdiag_on_grab_color_activated(GtkSwitch *widget, gpointer user_d
gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->entry_grab_color), gtk_switch_get_active(widget));
}
-
-void remmina_prefdiag_unlock_repwd_on_changed(GtkEditable *editable, RemminaPrefDialog *dialog)
+/* connect to notify::active or toggled (in this case ::toggled */
+void remmina_prefdiag_on_use_password_activated(GtkSwitch *sw, gpointer user_data)
{
TRACE_CALL(__func__);
- GtkCssProvider *provider;
- const gchar *color;
- const gchar *password;
- const gchar *repassword;
-
- provider = gtk_css_provider_new();
-
- password = gtk_entry_get_text(remmina_pref_dialog->unlock_password);
- repassword = gtk_entry_get_text(remmina_pref_dialog->unlock_repassword);
- if (g_strcmp0(password, repassword) == 0)
- color = g_strdup("green");
- else
- color = g_strdup("red");
-
- if (repassword == NULL || repassword[0] == '\0')
- color = g_strdup("inherit");
-
- gtk_css_provider_load_from_data(provider,
- g_strdup_printf(
- ".unlock_repassword {\n"
- " color: %s;\n"
- "}\n"
- , color)
- , -1, NULL);
- gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
- GTK_STYLE_PROVIDER(provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- gtk_widget_queue_draw(GTK_WIDGET(remmina_pref_dialog->unlock_repassword));
- g_object_unref(provider);
+ //REMMINA_DEBUG ("Use Primary Password %d", gtk_switch_get_active(sw));
+ if (gtk_switch_get_active(sw)) {
+ //REMMINA_DEBUG ("use_password activated");
+ gchar *unlock_password = NULL;
+ unlock_password = g_strdup(remmina_pref_get_value("unlock_password"));
+ //REMMINA_DEBUG ("Password from preferences is: %s", unlock_password);
+ if (unlock_password == NULL || unlock_password[0] == '\0') {
+ if (remmina_passwd (GTK_WINDOW(remmina_pref_dialog->dialog), &unlock_password)) {
+ //REMMINA_DEBUG ("Password is: %s", unlock_password);
+ remmina_pref_set_value("unlock_password", g_strdup(unlock_password));
+ remmina_pref.unlock_password = g_strdup(unlock_password);
+ } else {
+ remmina_pref.unlock_password = "";
+ remmina_pref_set_value("unlock_password", "");
+ }
+ }
+ g_free(unlock_password), unlock_password = NULL;
+ } else {
+ //REMMINA_DEBUG ("use_password deactivated");
+ remmina_pref.unlock_password = "";
+ remmina_pref_set_value("unlock_password", "");
+ }
}
void remmina_pref_dialog_on_action_close(GSimpleAction *action, GVariant *param, gpointer data)
@@ -234,11 +227,6 @@ 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_primary_password = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_security_use_primary_password));
-#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));
-#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.enc_mode = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_security_enc_method);
@@ -471,13 +459,7 @@ static void remmina_pref_dialog_init(void)
gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_options_remember_last_view_mode), remmina_pref.save_view_mode);
#if SODIUM_VERSION_INT >= 90200
gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_use_primary_password), remmina_pref.use_primary_password);
- if (remmina_pref.unlock_password != NULL)
- gtk_entry_set_text(remmina_pref_dialog->unlock_password, remmina_pref.unlock_password);
- else
- gtk_entry_set_text(remmina_pref_dialog->unlock_password, "");
gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->switch_security_use_primary_password), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_password), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_repassword), TRUE);
gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_lock_connect), remmina_pref.lock_connect);
gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_lock_edit), remmina_pref.lock_edit);
gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_timeout), TRUE);
@@ -486,8 +468,6 @@ static void remmina_pref_dialog_init(void)
gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->switch_security_use_primary_password), FALSE);
// TRANSLATORS: Do not translate libsodium, is the name of a library
gtk_widget_set_tooltip_text(GTK_WIDGET(remmina_pref_dialog->switch_security_use_primary_password), _("libsodium >= 1.9.0 is required to use Primary Password"));
- gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_password), FALSE);
- gtk_widget_set_sensitive(GTK_WIDGET(remmina_pref_dialog->unlock_repassword), FALSE);
gtk_switch_set_active(GTK_SWITCH(remmina_pref_dialog->switch_security_lock_connect), FALSE);
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);
@@ -724,8 +704,6 @@ GtkWidget *remmina_pref_dialog_new(gint default_tab, GtkWindow *parent)
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->comboboxtext_security_enc_method = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_security_enc_method"));
diff --git a/src/remmina_pref_dialog.h b/src/remmina_pref_dialog.h
index 583fdd864..346a8f9d0 100644
--- a/src/remmina_pref_dialog.h
+++ b/src/remmina_pref_dialog.h
@@ -58,8 +58,6 @@ typedef struct _RemminaPrefDialog {
GtkSwitch * switch_options_remember_last_view_mode;
GtkSwitch * switch_security_use_primary_password;
GtkEntry * unlock_timeout;
- GtkEntry * unlock_password;
- GtkEntry * unlock_repassword;
GtkSwitch * switch_security_lock_connect;
GtkSwitch * switch_security_lock_edit;
GtkSwitch * switch_security_audit;
diff --git a/src/remmina_unlock.c b/src/remmina_unlock.c
index dcdc15d8f..8e878ae32 100644
--- a/src/remmina_unlock.c
+++ b/src/remmina_unlock.c
@@ -180,6 +180,8 @@ gint remmina_unlock_new(GtkWindow *parent)
/* Connect signals */
gtk_builder_connect_signals(remmina_unlock_dialog->builder, NULL);
+ g_object_set_data_full (G_OBJECT(remmina_unlock_dialog->dialog), "builder", remmina_unlock_dialog->builder, g_object_unref);
+
gchar *unlock_password = NULL;
unlock_password = g_strdup(remmina_pref_get_value("unlock_password"));
//REMMINA_DEBUG ("Password from preferences is: %s", unlock_password);