Resolves: rhbz#1154206

This commit is contained in:
Rui Matos 2014-10-21 18:23:10 +02:00
parent ffbb11eff5
commit 7be2155c39
2 changed files with 141 additions and 1 deletions

View File

@ -0,0 +1,135 @@
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

View File

@ -1,11 +1,12 @@
Name: gnome-initial-setup
Version: 3.14.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Bootstrapping your OS
License: GPLv2+
URL: https://live.gnome.org/GnomeOS/Design/Whiteboards/InitialSetup
Source0: http://download.gnome.org/sources/%{name}/3.14/%{name}-%{version}.tar.xz
Patch0: 0001-password-Fix-changing-the-login-keyring-password.patch
%global nm_version 0.9.6.4
%global glib_required_version 2.36.0
@ -60,6 +61,7 @@ you through configuring it. It is integrated with gdm.
%prep
%setup -q
%patch0 -p1
%build
%configure
@ -99,6 +101,9 @@ useradd -rM -d /run/gnome-initial-setup/ -s /sbin/nologin %{name} &>/dev/null ||
%{_datadir}/polkit-1/rules.d/20-gnome-initial-setup.rules
%changelog
* Tue Oct 21 2014 Rui Matos <rmatos@redhat.com> - 3.14.1-2
- Resolves: rhbz#1154206
* Sat Oct 11 2014 Kalev Lember <kalevlember@gmail.com> - 3.14.1-1
- Update to 3.14.1