about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-09-30 06:07:32 +0200
committerMichael Biebl <biebl@debian.org>2014-09-30 06:11:37 +0200
commit346629115c5d42f5d8295494154b97db5ea0be5d (patch)
tree60532ab3905244f4a6b4e6d1e6b2048c015a9669
parent69b95405b07fc2a5833dfcbe18c9229706c2104e (diff)
Cherry-pick upstream commits to make nmtui-edit properly save and display passwords
Closes: #754382
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/0010-tui-fix-requesting-and-displaying-secrets.patch56
-rw-r--r--debian/patches/0011-tui-fix-updating-of-NmtPasswordFields-passwords-bgo-.patch30
-rw-r--r--debian/patches/series2
4 files changed, 90 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 607865b6..896149e2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ network-manager (0.9.10.0-3) UNRELEASED; urgency=medium
     supports multiarch.
   * Mark gir and dev packages as Multi-Arch: same.
   * Build against libsystemd-dev.
+  * Cherry-pick upstream commits to make nmtui-edit properly save and display
+    passwords. (Closes: #754382)
 
  -- Michael Biebl <biebl@debian.org>  Tue, 30 Sep 2014 05:08:49 +0200
 
diff --git a/debian/patches/0010-tui-fix-requesting-and-displaying-secrets.patch b/debian/patches/0010-tui-fix-requesting-and-displaying-secrets.patch
new file mode 100644
index 00000000..151b80d0
--- /dev/null
+++ b/debian/patches/0010-tui-fix-requesting-and-displaying-secrets.patch
@@ -0,0 +1,56 @@
+From: Dan Williams <dcbw@redhat.com>
+Date: Wed, 3 Sep 2014 17:12:32 -0500
+Subject: tui: fix requesting and displaying secrets
+
+nmt_sync_op_complete_pointer() completes the operation after the
+caller of this function returns.  This means that any values passed
+to this function must either be allocated from its caller, or
+referenced by the caller.
+
+nm_remote_connection_get_secrets() owns the 'secrets' hash passed
+to the callback, and it is destroyed when the callback returns.
+So nmtui's got_secrets() must copy the hash to ensure the data
+sticks around for nmt_sync_op_wait_pointer() later.
+
+(cherry picked from commit 240a9a92ae28ee3e794567d3bf00f1d7b365fa0d)
+---
+ tui/nmt-editor.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/tui/nmt-editor.c b/tui/nmt-editor.c
+index b204a5c..f03e9b1 100644
+--- a/tui/nmt-editor.c
++++ b/tui/nmt-editor.c
+@@ -171,7 +171,19 @@ got_secrets (NMRemoteConnection *connection,
+              GError             *error,
+              gpointer            op)
+ {
+-	nmt_sync_op_complete_pointer (op, secrets, error);
++	GHashTable *copy = NULL, *setting;
++	GHashTableIter iter;
++	const char *name;
++
++	if (secrets) {
++		/* 'secrets' is owned by the caller so we must copy it */
++		copy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_destroy);
++		g_hash_table_iter_init (&iter, secrets);
++		while (g_hash_table_iter_next (&iter, (gpointer) &name, (gpointer) &setting))
++			g_hash_table_insert (copy, g_strdup (name), nm_utils_gvalue_hash_dup (setting));
++	}
++
++	nmt_sync_op_complete_pointer (op, copy, error);
+ }
+ 
+ static NMConnection *
+@@ -196,8 +208,10 @@ build_edit_connection (NMConnection *orig_connection)
+ 		                                  setting_name, got_secrets, &op);
+ 		/* FIXME: error handling */
+ 		secrets = nmt_sync_op_wait_pointer (&op, NULL);
+-		if (secrets)
++		if (secrets) {
+ 			(void) nm_connection_update_secrets (edit_connection, setting_name, secrets, NULL);
++			g_hash_table_unref (secrets);
++		}
+ 	}
+ 	g_hash_table_unref (settings);
+ 
diff --git a/debian/patches/0011-tui-fix-updating-of-NmtPasswordFields-passwords-bgo-.patch b/debian/patches/0011-tui-fix-updating-of-NmtPasswordFields-passwords-bgo-.patch
new file mode 100644
index 00000000..867454a2
--- /dev/null
+++ b/debian/patches/0011-tui-fix-updating-of-NmtPasswordFields-passwords-bgo-.patch
@@ -0,0 +1,30 @@
+From: Dan Williams <dcbw@redhat.com>
+Date: Wed, 3 Sep 2014 17:43:25 -0500
+Subject: tui: fix updating of NmtPasswordFields passwords (bgo #733002)
+
+The actual entry is a sub-widget, and was getting updated when the
+user changed the password, but those changes were not being
+propagated to the NmtPasswordFields object's 'password' property.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=733002
+
+(cherry picked from commit 82b0ea87075144650979d344f34c09c7111c4a4e)
+---
+ tui/nmt-password-fields.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tui/nmt-password-fields.c b/tui/nmt-password-fields.c
+index ec8b521..be75b74 100644
+--- a/tui/nmt-password-fields.c
++++ b/tui/nmt-password-fields.c
+@@ -156,6 +156,10 @@ nmt_password_fields_constructed (GObject *object)
+ 	} else
+ 		g_clear_object (&priv->show_password);
+ 
++	g_object_bind_property (priv->entry, "text",
++	                        object, "password",
++	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
++
+ 	G_OBJECT_CLASS (nmt_password_fields_parent_class)->constructed (object);
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 93f50bb6..9a3586f7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,5 @@
 0007-core-fix-checks-for-default-routes-by-comparing-the-.patch
 0008-Use-the-correct-path-when-calling-dnssec-trigger-scr.patch
 0009-Support-building-against-libsystemd-library.patch
+0010-tui-fix-requesting-and-displaying-secrets.patch
+0011-tui-fix-updating-of-NmtPasswordFields-passwords-bgo-.patch