136 lines
4.5 KiB
Diff
136 lines
4.5 KiB
Diff
From 46910e92f88f3efb065d29b8ebec8364c2e5573a Mon Sep 17 00:00:00 2001
|
|
From: Rui Matos <tiagomatos@gmail.com>
|
|
Date: Tue, 21 Oct 2014 18:20:04 +0200
|
|
Subject: [PATCH] password: Fix changing the login keyring password
|
|
|
|
We are trying to update the login keyring password using uninitialized
|
|
memory as the old password from gis_driver_get_user_permissions() but
|
|
there's no password since we only set the first one below.
|
|
|
|
In fact, the gis-keyring API doesn't even need the "old" password to
|
|
be a parameter, we can just hardcode one which makes everything
|
|
simpler and works as fine for our purpose.
|
|
|
|
https://bugzilla.gnome.org/show_bug.cgi?id=738714
|
|
---
|
|
gnome-initial-setup/gis-keyring.c | 10 ++++++----
|
|
gnome-initial-setup/gis-keyring.h | 5 ++---
|
|
gnome-initial-setup/gnome-initial-setup.c | 2 +-
|
|
gnome-initial-setup/pages/password/gis-password-page.c | 8 +-------
|
|
4 files changed, 10 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/gnome-initial-setup/gis-keyring.c b/gnome-initial-setup/gis-keyring.c
|
|
index 75f20b1..42e1a64 100644
|
|
--- a/gnome-initial-setup/gis-keyring.c
|
|
+++ b/gnome-initial-setup/gis-keyring.c
|
|
@@ -29,6 +29,8 @@
|
|
|
|
#include <libsecret/secret.h>
|
|
|
|
+#define DUMMY_PWD "gis"
|
|
+
|
|
/* We never want to see a keyring dialog, but we need to make
|
|
* sure a keyring is present.
|
|
*
|
|
@@ -38,7 +40,7 @@
|
|
*/
|
|
|
|
void
|
|
-gis_ensure_login_keyring (const gchar *pwd)
|
|
+gis_ensure_login_keyring ()
|
|
{
|
|
GSubprocess *subprocess = NULL;
|
|
GSubprocessLauncher *launcher = NULL;
|
|
@@ -53,7 +55,7 @@ gis_ensure_login_keyring (const gchar *pwd)
|
|
goto out;
|
|
}
|
|
|
|
- if (!g_subprocess_communicate_utf8 (subprocess, "gis", NULL, NULL, NULL, &error)) {
|
|
+ if (!g_subprocess_communicate_utf8 (subprocess, DUMMY_PWD, NULL, NULL, NULL, &error)) {
|
|
g_warning ("Failed to communicate with gnome-keyring-daemon: %s", error->message);
|
|
g_error_free (error);
|
|
goto out;
|
|
@@ -67,7 +69,7 @@ out:
|
|
}
|
|
|
|
void
|
|
-gis_update_login_keyring_password (const gchar *old_, const gchar *new_)
|
|
+gis_update_login_keyring_password (const gchar *new_)
|
|
{
|
|
GDBusConnection *bus = NULL;
|
|
SecretService *service = NULL;
|
|
@@ -89,7 +91,7 @@ gis_update_login_keyring_password (const gchar *old_, const gchar *new_)
|
|
goto out;
|
|
}
|
|
|
|
- old_secret = secret_value_new (old_, strlen (old_), "text/plain");
|
|
+ old_secret = secret_value_new (DUMMY_PWD, strlen (DUMMY_PWD), "text/plain");
|
|
new_secret = secret_value_new (new_, strlen (new_), "text/plain");
|
|
|
|
g_dbus_connection_call_sync (bus,
|
|
diff --git a/gnome-initial-setup/gis-keyring.h b/gnome-initial-setup/gis-keyring.h
|
|
index a33b76b..764f1e6 100644
|
|
--- a/gnome-initial-setup/gis-keyring.h
|
|
+++ b/gnome-initial-setup/gis-keyring.h
|
|
@@ -27,9 +27,8 @@
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
-void gis_ensure_login_keyring (const gchar *pwd);
|
|
-void gis_update_login_keyring_password (const gchar *old_,
|
|
- const gchar *new_);
|
|
+void gis_ensure_login_keyring ();
|
|
+void gis_update_login_keyring_password (const gchar *new_);
|
|
|
|
G_END_DECLS
|
|
|
|
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
|
|
index 45cfcb9..8488d8a 100644
|
|
--- a/gnome-initial-setup/gnome-initial-setup.c
|
|
+++ b/gnome-initial-setup/gnome-initial-setup.c
|
|
@@ -219,7 +219,7 @@ main (int argc, char *argv[])
|
|
}
|
|
#endif
|
|
|
|
- gis_ensure_login_keyring ("gis");
|
|
+ gis_ensure_login_keyring ();
|
|
|
|
driver = gis_driver_new (get_mode ());
|
|
g_signal_connect (driver, "rebuild-pages", G_CALLBACK (rebuild_pages_cb), NULL);
|
|
diff --git a/gnome-initial-setup/pages/password/gis-password-page.c b/gnome-initial-setup/pages/password/gis-password-page.c
|
|
index 33ae59b..891de63 100644
|
|
--- a/gnome-initial-setup/pages/password/gis-password-page.c
|
|
+++ b/gnome-initial-setup/pages/password/gis-password-page.c
|
|
@@ -75,7 +75,6 @@ gis_password_page_save_data (GisPage *gis_page)
|
|
GisPasswordPagePrivate *priv = gis_password_page_get_instance_private (page);
|
|
ActUser *act_user;
|
|
const gchar *password;
|
|
- const gchar *old_password;
|
|
|
|
if (gis_page->driver == NULL)
|
|
return;
|
|
@@ -85,11 +84,6 @@ gis_password_page_save_data (GisPage *gis_page)
|
|
if (act_user == NULL) /* enterprise account */
|
|
return;
|
|
|
|
- if (password)
|
|
- old_password = password;
|
|
- else
|
|
- old_password = "gis";
|
|
-
|
|
password = gtk_entry_get_text (GTK_ENTRY (priv->password_entry));
|
|
|
|
if (strlen (password) == 0)
|
|
@@ -99,7 +93,7 @@ gis_password_page_save_data (GisPage *gis_page)
|
|
|
|
gis_driver_set_user_permissions (gis_page->driver, act_user, password);
|
|
|
|
- gis_update_login_keyring_password (old_password, password);
|
|
+ gis_update_login_keyring_password (password);
|
|
}
|
|
|
|
static void
|
|
--
|
|
1.9.0
|
|
|