Accepting request 32686 from GNOME:Factory

Copy from GNOME:Factory/libgnome-keyring based on submit request 32686 from user vuntz

OBS-URL: https://build.opensuse.org/request/show/32686
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libgnome-keyring?expand=0&rev=2
This commit is contained in:
OBS User autobuild 2010-02-18 14:51:59 +00:00 committed by Git OBS Bridge
parent d2ded16e00
commit c05440e1f3
3 changed files with 100 additions and 2 deletions

View File

@ -0,0 +1,89 @@
commit cf04a806f7cbd12bfb664a481b7a551650cb85b2
Author: Stef Walter <stef@memberwebs.com>
Date: Sun Feb 14 04:23:58 2010 +0000
No assertion when password is not found.
Would crash when gnome_keyring_find_password_xx() was called and
no password was found.
Fixes bug #608709
diff --git a/library/gnome-keyring.c b/library/gnome-keyring.c
index c867787..8931fe5 100644
--- a/library/gnome-keyring.c
+++ b/library/gnome-keyring.c
@@ -4374,10 +4374,19 @@ find_password_2_reply (GkrOperation *op, GkrSession *session, gpointer user_data
static void
find_password_1_reply (GkrOperation *op, const char *path, gpointer user_data)
{
+ GkrCallback *cb;
+
+ /* All done, complete the operation here */
+ if (path == NULL) {
+ cb = gkr_operation_pop (op);
+ gkr_callback_invoke_res (cb, GNOME_KEYRING_RESULT_NO_MATCH);
+
/* We need a session to get the secret for this item */
- gkr_operation_push (op, find_password_2_reply, GKR_CALLBACK_OP_SESSION,
- g_strdup (path), g_free);
- gkr_session_negotiate (op);
+ } else {
+ gkr_operation_push (op, find_password_2_reply, GKR_CALLBACK_OP_SESSION,
+ g_strdup (path), g_free);
+ gkr_session_negotiate (op);
+ }
}
static GkrOperation*
diff --git a/library/tests/test-keyrings.c b/library/tests/test-keyrings.c
index 7f7f1fa..aeba0ff 100644
--- a/library/tests/test-keyrings.c
+++ b/library/tests/test-keyrings.c
@@ -480,6 +480,46 @@ DEFINE_TEST(find_password)
g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, find_password_result);
}
+static GnomeKeyringResult find_no_password_result;
+
+static void
+done_find_no_password (GnomeKeyringResult res, const gchar* password, gpointer unused)
+{
+ find_no_password_result = res;
+ if(res == GNOME_KEYRING_RESULT_OK)
+ g_assert (password == NULL);
+ test_mainloop_quit ();
+}
+
+DEFINE_TEST(find_no_password)
+{
+ GnomeKeyringResult res;
+ gchar *password;
+ gpointer op;
+
+ /* Synchronous, valid*/
+ res = gnome_keyring_find_password_sync (&our_schema, &password,
+ "dog", "grunt",
+ "legs", 1000,
+ NULL);
+ g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
+ g_assert (password == NULL);
+
+ /* Asynchronous, less arguments */
+ find_no_password_result = GNOME_KEYRING_RESULT_CANCELLED;
+ op = gnome_keyring_find_password (&our_schema,
+ done_find_no_password, NULL, NULL,
+ "dog", "grunt",
+ "legs", 1000,
+ NULL);
+ g_assert (op != NULL);
+ g_assert (find_no_password_result == GNOME_KEYRING_RESULT_CANCELLED);
+
+ test_mainloop_run (2000);
+
+ g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, find_no_password_result);
+}
+
static void
done_delete_password (GnomeKeyringResult res, gpointer data)
{

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Feb 16 12:11:38 CET 2010 - vuntz@opensuse.org
- Add libgnome-keyring-no-match.patch, taken from upstream to
finally make usage of gnome-keyring work.
-------------------------------------------------------------------
Tue Dec 22 22:02:39 CET 2009 - vuntz@opensuse.org

View File

@ -1,7 +1,7 @@
#
# spec file for package libgnome-keyring (Version 2.29.4)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,12 +19,14 @@
Name: libgnome-keyring
Version: 2.29.4
Release: 1
Release: 2
Url: http://www.gnome.org/
Group: Development/Libraries/GNOME
License: GPLv2+ ; LGPLv2.1+
Summary: Library to integrate with the GNOME Keyring
Source: ftp://ftp.gnome.org/pub/GNOME/sources/%{name}/2.29/%{name}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM libgnome-keyring-no-match.patch vuntz@opensuse.org -- Taken partly from upstream, to make gnome-keyring work
Patch0: libgnome-keyring-no-match.patch
BuildRequires: dbus-1-devel
BuildRequires: eggdbus-devel
BuildRequires: fdupes
@ -68,6 +70,7 @@ integrate with the GNOME Keyring system.
%lang_package
%prep
%setup -q
%patch0 -p1
%build
%configure \