diff options
author | Giovanni Panozzo <giovanni@panozzo.it> | 2022-09-06 22:03:43 +0300 |
---|---|---|
committer | Giovanni Panozzo <giovanni@panozzo.it> | 2022-09-06 22:03:43 +0300 |
commit | a9d0c5f6df5b144cdcb89fa9c5bdedc04562f750 (patch) | |
tree | 36758de9eb2e1e04e39ab56dc5c67a64cb597702 | |
parent | 6483c7441185c6f043b3f9af959fc6dcd7766359 (diff) | |
parent | b2ee894931c150cd2565cde1dc0c1f2542fc923f (diff) |
Merge branch 'Change-Password-Including-Gateway-2' into 'master'
Change password including gateway
See merge request Remmina/Remmina!2427
-rw-r--r-- | data/ui/remmina_mpc.glade | 438 | ||||
-rw-r--r-- | src/remmina_main.c | 10 | ||||
-rw-r--r-- | src/remmina_mpchange.c | 96 | ||||
-rw-r--r-- | src/remmina_mpchange.h | 2 |
4 files changed, 410 insertions, 136 deletions
diff --git a/data/ui/remmina_mpc.glade b/data/ui/remmina_mpc.glade index 7490bea19..203d76c2f 100644 --- a/data/ui/remmina_mpc.glade +++ b/data/ui/remmina_mpc.glade @@ -1,39 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.40.0 --> <interface> <requires lib="gtk+" version="3.20"/> <object class="GtkDialog" id="MPCDialog"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="modal">True</property> - <property name="type_hint">dialog</property> - <child type="titlebar"> - <object class="GtkLabel" id="titleLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">baseline</property> - <property name="label" translatable="yes"><span weight='bold' size='larger'>Multi Password Changer</span></property> - <property name="use_markup">True</property> - <property name="ellipsize">start</property> - </object> - </child> - <action-widgets> - <action-widget response="0">btnCancelChange</action-widget> - </action-widgets> + <property name="type-hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="orientation">vertical</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="can-focus">False</property> + <property name="layout-style">end</property> <child> <object class="GtkButton" id="btnDoChange"> <property name="label" translatable="yes">Change</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="receives-default">True</property> </object> <packing> <property name="expand">True</property> @@ -45,10 +32,10 @@ <object class="GtkButton" id="btnCancelChange"> <property name="label" translatable="yes">Cancel</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> </object> <packing> <property name="expand">True</property> @@ -60,134 +47,126 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkSeparator" id="separator1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="position">5</property> </packing> </child> <child> - <object class="GtkSeparator" id="separator2"> + <object class="GtkSeparator"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">0</property> </packing> </child> <child> <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkFrame"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0.5</property> - <property name="shadow_type">none</property> + <property name="can-focus">False</property> + <property name="label-xalign">0.5</property> + <property name="shadow-type">none</property> <child> <object class="GtkAlignment"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="left_padding">12</property> + <property name="can-focus">False</property> + <property name="left-padding">12</property> <child> + <!-- n-columns=2 n-rows=3 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">8</property> + <property name="can-focus">False</property> + <property name="margin-top">8</property> + <property name="column-homogeneous">True</property> <child> - <object class="GtkLabel" id="label1"> + <object class="GtkLabel" id="label6"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="valign">center</property> - <property name="margin_right">8</property> + <property name="margin-right">8</property> <property name="label" translatable="yes">Group</property> <property name="justify">right</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkSearchEntry" id="groupEntry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="primary_icon_name">edit-find-symbolic</property> - <property name="primary_icon_activatable">False</property> - <property name="primary_icon_sensitive">False</property> + <property name="primary-icon-name">edit-find-symbolic</property> + <property name="primary-icon-activatable">False</property> + <property name="primary-icon-sensitive">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> - <object class="GtkLabel" id="label2"> + <object class="GtkLabel" id="label7"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> <property name="valign">center</property> - <property name="margin_right">8</property> + <property name="margin-right">8</property> <property name="label" translatable="yes">Username</property> <property name="justify">right</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkSearchEntry" id="usernameEntry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="primary_icon_name">edit-find-symbolic</property> - <property name="primary_icon_activatable">False</property> - <property name="primary_icon_sensitive">False</property> + <property name="primary-icon-name">edit-find-symbolic</property> + <property name="primary-icon-activatable">False</property> + <property name="primary-icon-sensitive">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> <child> - <object class="GtkLabel" id="label5"> + <object class="GtkLabel" id="label8"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> - <property name="margin_right">8</property> + <property name="valign">center</property> + <property name="margin-right">8</property> <property name="label" translatable="yes">Domain</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="left-attach">0</property> + <property name="top-attach">2</property> </packing> </child> <child> <object class="GtkSearchEntry" id="domainEntry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> - <property name="primary_icon_name">edit-find-symbolic</property> - <property name="primary_icon_activatable">False</property> - <property name="primary_icon_sensitive">False</property> + <property name="primary-icon-name">edit-find-symbolic</property> + <property name="primary-icon-activatable">False</property> + <property name="primary-icon-sensitive">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left-attach">1</property> + <property name="top-attach">2</property> </packing> </child> </object> @@ -197,7 +176,7 @@ <child type="label"> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes">Selection criteria</property> <attributes> <attribute name="weight" value="bold"/> @@ -214,74 +193,268 @@ <child> <object class="GtkFrame"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0.5</property> - <property name="shadow_type">none</property> + <property name="can-focus">False</property> + <property name="label-xalign">0.5</property> + <property name="shadow-type">none</property> <child> <object class="GtkAlignment"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="left_padding">12</property> + <property name="can-focus">False</property> + <property name="left-padding">12</property> <child> + <!-- n-columns=2 n-rows=2 --> <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_top">8</property> + <property name="can-focus">False</property> + <property name="margin-top">8</property> + <property name="column-homogeneous">True</property> <child> - <object class="GtkLabel" id="label3"> + <object class="GtkLabel" id="label12"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> - <property name="margin_right">8</property> + <property name="valign">center</property> + <property name="margin-right">8</property> <property name="label" translatable="yes">Password</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> <child> <object class="GtkEntry" id="password1Entry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> - <object class="GtkLabel" id="label4"> + <object class="GtkLabel" id="label13"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">end</property> - <property name="margin_right">8</property> + <property name="valign">center</property> + <property name="margin-right">8</property> <property name="label" translatable="yes">Confirm password</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="left-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> <object class="GtkEntry" id="password2Entry"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="visibility">False</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</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="label" translatable="yes">Set new password</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <child> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label-xalign">0.5</property> + <property name="shadow-type">none</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=2 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-top">8</property> + <property name="column-homogeneous">True</property> + <child> + <object class="GtkLabel" id="label21"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">end</property> + <property name="valign">center</property> + <property name="margin-right">8</property> + <property name="label" translatable="yes">Gateway Username</property> + <property name="justify">right</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkSearchEntry" id="gatewayUsernameEntry"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="primary-icon-name">edit-find-symbolic</property> + <property name="primary-icon-activatable">False</property> + <property name="primary-icon-sensitive">False</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label24"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">end</property> + <property name="valign">center</property> + <property name="margin-right">8</property> + <property name="label" translatable="yes">Gateway Domain</property> + <property name="justify">right</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkSearchEntry" id="gatewayDomainEntry"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="primary-icon-name">edit-find-symbolic</property> + <property name="primary-icon-activatable">False</property> + <property name="primary-icon-sensitive">False</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </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.5</property> + <property name="shadow-type">none</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=2 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-top">8</property> + <property name="column-homogeneous">True</property> + <child> + <object class="GtkLabel" id="label33"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">end</property> + <property name="margin-right">8</property> + <property name="label" translatable="yes">Gateway Password</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="gatewayPassword1Entry"> + <property name="visible">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left-attach">1</property> + <property name="top-attach">0</property> </packing> </child> <child> - <placeholder/> + <object class="GtkLabel" id="label34"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">end</property> + <property name="margin-right">8</property> + <property name="label" translatable="yes">Confirm Gateway Password</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> </child> <child> - <placeholder/> + <object class="GtkEntry" id="gatewayPassword2Entry"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="visibility">False</property> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> </child> </object> </child> @@ -290,8 +463,7 @@ <child type="label"> <object class="GtkLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Set new password</property> + <property name="can-focus">False</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -308,21 +480,21 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> <object class="GtkScrolledWindow" id="scrolledwindow1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="shadow_type">in</property> - <property name="min_content_width">130</property> - <property name="min_content_height">254</property> + <property name="can-focus">True</property> + <property name="shadow-type">in</property> + <property name="min-content-width">130</property> + <property name="min-content-height">254</property> <child> <object class="GtkTreeView" id="profchangelist"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="enable_grid_lines">both</property> + <property name="can-focus">True</property> + <property name="enable-grid-lines">both</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="treeview-selection3"/> </child> @@ -371,25 +543,36 @@ </child> </object> </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn5"> + <property name="title" translatable="yes" context="Multi password changer table">Gateway Domain\Username</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext4"/> + <attributes> + <attribute name="text">4</attribute> + </attributes> + </child> + </object> + </child> </object> </child> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">7</property> </packing> </child> <child> <object class="GtkLabel" id="statusLabel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="ellipsize">end</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">6</property> + <property name="position">7</property> </packing> </child> </object> @@ -397,5 +580,18 @@ <action-widgets> <action-widget response="0">btnCancelChange</action-widget> </action-widgets> + <child type="titlebar"> + <object class="GtkLabel" id="titleLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">baseline</property> + <property name="label" translatable="yes"><span weight='bold' size='larger'>Multi Password Changer</span></property> + <property name="use-markup">True</property> + <property name="ellipsize">start</property> + </object> + </child> + <action-widgets> + <action-widget response="0">btnCancelChange</action-widget> + </action-widgets> </object> -</interface> +</interface>
\ No newline at end of file diff --git a/src/remmina_main.c b/src/remmina_main.c index 1ef407335..c1b052b34 100644 --- a/src/remmina_main.c +++ b/src/remmina_main.c @@ -806,8 +806,10 @@ void remmina_main_on_action_application_mpchange(GSimpleAction *action, GVariant const gchar *username; const gchar *domain; const gchar *group; + const gchar *gatewayusername; + const gchar *gatewaydomain; - username = domain = group = ""; + username = domain = group = gatewayusername = gatewaydomain = ""; remminafile = NULL; @@ -822,10 +824,12 @@ void remmina_main_on_action_application_mpchange(GSimpleAction *action, GVariant username = remmina_file_get_string(remminafile, "username"); domain = remmina_file_get_string(remminafile, "domain"); group = remmina_file_get_string(remminafile, "group"); + gatewayusername = remmina_file_get_string(remminafile, "gateway_username"); + gatewaydomain = remmina_file_get_string(remminafile, "gateway_domain"); } } - remmina_mpchange_schedule(TRUE, group, domain, username, ""); + remmina_mpchange_schedule(TRUE, group, domain, username, "", gatewayusername, gatewaydomain, ""); if (remminafile != NULL) remmina_file_free(remminafile); @@ -1664,4 +1668,4 @@ void remmina_main_show_warning_dialog(const gchar *message) { gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } -} +}
\ No newline at end of file diff --git a/src/remmina_mpchange.c b/src/remmina_mpchange.c index 6f777b584..3a03f93e4 100644 --- a/src/remmina_mpchange.c +++ b/src/remmina_mpchange.c @@ -54,9 +54,12 @@ struct mpchanger_params { gchar *domain; // New domain gchar *password; // New password gchar *group; + gchar *gatewayusername; + gchar *gatewaydomain; + gchar *gatewaypassword; - GtkEntry *eGroup, *eUsername, *eDomain; - GtkEntry *ePassword1, *ePassword2; + GtkEntry *eGroup, *eUsername, *eDomain, *ePassword1, *ePassword2; + GtkEntry *eGatewayUsername, *eGatewayDomain, *eGatewayPassword1, *eGatewayPassword2; GtkListStore* store; GtkDialog* dialog; GtkTreeView* table; @@ -74,6 +77,7 @@ enum { COL_NAME, COL_GROUP, COL_USERNAME, + COL_GATEWAY_USERNAME, COL_FILENAME, NUM_COLS }; @@ -101,9 +105,10 @@ static void remmina_mpchange_file_list_callback(RemminaFile *remminafile, gpoint GtkListStore* store; GtkTreeIter iter; int matchcount; - const gchar *username, *domain, *group; + const gchar *username, *domain, *group, *gatewayusername, *gatewaydomain; gchar* s; + gchar* t; struct mpchanger_params* mpcp; mpcp = (struct mpchanger_params*)user_data; @@ -113,6 +118,8 @@ static void remmina_mpchange_file_list_callback(RemminaFile *remminafile, gpoint username = remmina_file_get_string(remminafile, "username"); domain = remmina_file_get_string(remminafile, "domain"); group = remmina_file_get_string(remminafile, "group"); + gatewayusername = remmina_file_get_string(remminafile, "gateway_username"); + gatewaydomain = remmina_file_get_string(remminafile, "gateway_domain"); if (username == NULL) username = ""; @@ -123,6 +130,12 @@ static void remmina_mpchange_file_list_callback(RemminaFile *remminafile, gpoint if (group == NULL) group = ""; + if (gatewayusername == NULL) + gatewayusername = ""; + + if (gatewaydomain == NULL) + gatewaydomain = ""; + matchcount = 0; if (!remmina_mpchange_fieldcompare(mpcp->username, username, &matchcount)) return; @@ -130,18 +143,24 @@ static void remmina_mpchange_file_list_callback(RemminaFile *remminafile, gpoint return; if (!remmina_mpchange_fieldcompare(mpcp->group, group, &matchcount)) return; + if (!remmina_mpchange_fieldcompare(mpcp->gatewayusername, gatewayusername, &matchcount)) + return; + if (!remmina_mpchange_fieldcompare(mpcp->gatewaydomain, gatewaydomain, &matchcount)) + return; gtk_list_store_append(store, &iter); s = g_strdup_printf("%s\\%s", domain, username); - + t = g_strdup_printf("%s\\%s", gatewaydomain, gatewayusername); gtk_list_store_set(store, &iter, - COL_F, matchcount >= 3 ? TRUE : FALSE, + COL_F, matchcount >= 5 ? TRUE : FALSE, COL_NAME, remmina_file_get_string(remminafile, "name"), COL_GROUP, group, COL_USERNAME, s, + COL_GATEWAY_USERNAME, t, COL_FILENAME, remminafile->filename, -1); g_free(s); + g_free(t); } @@ -167,7 +186,12 @@ static void remmina_mpchange_dochange(gchar* fname, struct mpchanger_params* mpc remminafile = remmina_file_load(fname); if (remminafile) { - remmina_file_store_secret_plugin_password(remminafile, "password", mpcp->password); + if(mpcp->password[0] != 0){ + remmina_file_store_secret_plugin_password(remminafile, "password", mpcp->password); + } + if(mpcp->gatewaypassword[0] != 0){ + remmina_file_store_secret_plugin_password(remminafile, "gateway_password", mpcp->gatewaypassword); + } remmina_file_free(remminafile); mpcp->changed_passwords_count++; } @@ -181,6 +205,10 @@ static void enable_inputs(struct mpchanger_params* mpcp, gboolean ena) gtk_widget_set_sensitive(GTK_WIDGET(mpcp->eDomain), ena); gtk_widget_set_sensitive(GTK_WIDGET(mpcp->ePassword1), ena); gtk_widget_set_sensitive(GTK_WIDGET(mpcp->ePassword2), ena); + gtk_widget_set_sensitive(GTK_WIDGET(mpcp->eGatewayUsername), ena); + gtk_widget_set_sensitive(GTK_WIDGET(mpcp->eGatewayDomain), ena); + gtk_widget_set_sensitive(GTK_WIDGET(mpcp->eGatewayPassword1), ena); + gtk_widget_set_sensitive(GTK_WIDGET(mpcp->eGatewayPassword2), ena); gtk_widget_set_sensitive(GTK_WIDGET(mpcp->btnDoChange), ena); gtk_widget_set_sensitive(GTK_WIDGET(mpcp->table), ena); } @@ -212,7 +240,7 @@ static void remmina_mpchange_dochange_clicked(GtkButton *btn, gpointer user_data { TRACE_CALL(__func__); struct mpchanger_params* mpcp = (struct mpchanger_params*)user_data; - const gchar *passwd1, *passwd2; + const gchar *passwd1, *passwd2, *gatewaypasswd1, *gatewaypasswd2; if (mpcp->searchentrychange_timeout_source_id) { g_source_remove(mpcp->searchentrychange_timeout_source_id); @@ -236,11 +264,28 @@ static void remmina_mpchange_dochange_clicked(GtkButton *btn, gpointer user_data gtk_widget_destroy(msgDialog); return; } + gatewaypasswd1 = gtk_entry_get_text(mpcp->eGatewayPassword1); + gatewaypasswd2 = gtk_entry_get_text(mpcp->eGatewayPassword2); + if (g_strcmp0(gatewaypasswd1, gatewaypasswd2) != 0) { + GtkWidget *msgDialog; + msgDialog = gtk_message_dialog_new(GTK_WINDOW(mpcp->dialog), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("The Gateway passwords do not match")); + gtk_dialog_run(GTK_DIALOG(msgDialog)); + gtk_widget_destroy(msgDialog); + return; + } g_free(mpcp->password); mpcp->password = g_strdup(passwd1); mpcp->changed_passwords_count = 0; + g_free(mpcp->gatewaypassword); + mpcp->gatewaypassword = g_strdup(gatewaypasswd1); + mpcp->changed_passwords_count = 0; + gtk_label_set_text(mpcp->statusLabel, _("Resetting passwords, please wait…")); enable_inputs(mpcp, FALSE); @@ -271,12 +316,20 @@ static gboolean remmina_mpchange_searchfield_changed_to(gpointer user_data) g_free(mpcp->username); mpcp->username = g_strdup(s); + s = gtk_entry_get_text(mpcp->eGatewayDomain); + g_free(mpcp->gatewaydomain); + mpcp->gatewaydomain = g_strdup(s); + + s = gtk_entry_get_text(mpcp->eGatewayUsername); + g_free(mpcp->gatewayusername); + mpcp->gatewayusername = g_strdup(s); + if (mpcp->store != NULL) { gtk_tree_view_set_model(mpcp->table, NULL); } - mpcp->store = gtk_list_store_new(NUM_COLS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + mpcp->store = gtk_list_store_new(NUM_COLS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); - if (mpcp->group[0] != 0 || mpcp->domain[0] != 0 || mpcp->username[0] != 0) + if (mpcp->group[0] != 0 || mpcp->domain[0] != 0 || mpcp->username[0] != 0 || mpcp->gatewayusername[0] != 0 || mpcp->gatewaydomain[0] != 0) remmina_file_manager_iterate((GFunc)remmina_mpchange_file_list_callback, (gpointer)mpcp); gtk_tree_view_set_model(mpcp->table, GTK_TREE_MODEL(mpcp->store)); @@ -361,17 +414,33 @@ static gboolean remmina_file_multipasswd_changer_mt(gpointer d) gtk_entry_set_text(mpcp->eUsername, mpcp->username); g_signal_connect(G_OBJECT(mpcp->eUsername), "changed", G_CALLBACK(remmina_mpchange_searchfield_changed), (gpointer)mpcp); + mpcp->eGatewayUsername = GTK_ENTRY(GET_DIALOG_OBJECT("gatewayUsernameEntry")); + gtk_entry_set_text(mpcp->eGatewayUsername, mpcp->gatewayusername); + g_signal_connect(G_OBJECT(mpcp->eGatewayUsername), "changed", G_CALLBACK(remmina_mpchange_searchfield_changed), (gpointer)mpcp); + mpcp->eDomain = GTK_ENTRY(GET_DIALOG_OBJECT("domainEntry")); gtk_entry_set_text(mpcp->eDomain, mpcp->domain); g_signal_connect(G_OBJECT(mpcp->eDomain), "changed", G_CALLBACK(remmina_mpchange_searchfield_changed), (gpointer)mpcp); + mpcp->eGatewayDomain = GTK_ENTRY(GET_DIALOG_OBJECT("gatewayDomainEntry")); + gtk_entry_set_text(mpcp->eGatewayDomain, mpcp->gatewaydomain); + g_signal_connect(G_OBJECT(mpcp->eGatewayDomain), "changed", G_CALLBACK(remmina_mpchange_searchfield_changed), (gpointer)mpcp); + mpcp->ePassword1 = GTK_ENTRY(GET_DIALOG_OBJECT("password1Entry")); gtk_entry_set_text(mpcp->ePassword1, mpcp->password); + mpcp->eGatewayPassword1 = GTK_ENTRY(GET_DIALOG_OBJECT("gatewayPassword1Entry")); + gtk_entry_set_text(mpcp->eGatewayPassword1, mpcp->gatewaypassword); + mpcp->ePassword2 = GTK_ENTRY(GET_DIALOG_OBJECT("password2Entry")); gtk_entry_set_text(mpcp->ePassword2, mpcp->password); + mpcp->eGatewayPassword2 = GTK_ENTRY(GET_DIALOG_OBJECT("gatewayPassword2Entry")); + gtk_entry_set_text(mpcp->eGatewayPassword2, mpcp->gatewaypassword); + mpcp->statusLabel = GTK_LABEL(GET_DIALOG_OBJECT("statusLabel")); + + mpcp->store = NULL; @@ -416,13 +485,16 @@ static gboolean remmina_file_multipasswd_changer_mt(gpointer d) g_free(mpcp->password); g_free(mpcp->domain); g_free(mpcp->group); + g_free(mpcp->gatewayusername); + g_free(mpcp->gatewaypassword); + g_free(mpcp->gatewaydomain); g_free(mpcp); return FALSE; } void -remmina_mpchange_schedule(gboolean has_domain, const gchar *group, const gchar *domain, const gchar *username, const gchar *password) +remmina_mpchange_schedule(gboolean has_domain, const gchar *group, const gchar *domain, const gchar *username, const gchar *password, const gchar *gatewayusername, const gchar *gatewaydomain, const gchar *gatewaypassword) { // We could also be called in a subthread after a successful connection // (not currently implemented) @@ -437,7 +509,9 @@ remmina_mpchange_schedule(gboolean has_domain, const gchar *group, const gchar * mpcp->password = g_strdup(password); mpcp->domain = g_strdup(domain); mpcp->group = g_strdup(group); + mpcp->gatewayusername = g_strdup(gatewayusername); + mpcp->gatewaypassword = g_strdup(gatewaypassword); + mpcp->gatewaydomain = g_strdup(gatewaydomain); gdk_threads_add_idle(remmina_file_multipasswd_changer_mt, (gpointer)mpcp); } - diff --git a/src/remmina_mpchange.h b/src/remmina_mpchange.h index e148246df..1be3cad59 100644 --- a/src/remmina_mpchange.h +++ b/src/remmina_mpchange.h @@ -42,4 +42,4 @@ G_BEGIN_DECLS /* Schedule the multipassword change confirmation dialog to be executed ASAP */ -void remmina_mpchange_schedule(gboolean has_domain, const gchar *group, const gchar *domain, const gchar *username, const gchar *password); +void remmina_mpchange_schedule(gboolean has_domain, const gchar *group, const gchar *domain, const gchar *username, const gchar *password, const gchar *gatewayusername, const gchar *gatewaydomain, const gchar *gatewaypassword);
\ No newline at end of file |