- Add NO_MATCH error patch from svn. Will fix apps that can't handle empty

list matches
This commit is contained in:
Alexander Larsson 2007-10-04 06:48:12 +00:00
parent 943ca97c72
commit 9c64b5b498
2 changed files with 97 additions and 1 deletions

View File

@ -0,0 +1,90 @@
Index: tests/unit-test-keyrings.c
===================================================================
--- tests/unit-test-keyrings.c (revision 842)
+++ tests/unit-test-keyrings.c (revision 843)
@@ -249,8 +249,8 @@
}
/*
- * A find that does not match should return zero results, not some error message:
- * http://bugzilla.gnome.org/show_bug.cgi?id=447315
+ * A find that does not match should return 'Not Found':
+ * http://bugzilla.gnome.org/show_bug.cgi?id=476682
*/
void unit_test_find_invalid (CuTest* cu)
{
@@ -263,8 +263,7 @@
/* Now try to find it */
res = gnome_keyring_find_items_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET, attrs, &found);
- CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_OK, res);
- CuAssert(cu, "Shouldn't have matched any items", g_list_length (found) == 0);
+ CuAssertIntEquals(cu, GNOME_KEYRING_RESULT_NO_MATCH, res);
}
void unit_test_lock_keyrings (CuTest* cu)
Index: daemon/gkr-daemon-ops.c
===================================================================
--- daemon/gkr-daemon-ops.c (revision 842)
+++ daemon/gkr-daemon-ops.c (revision 843)
@@ -1784,8 +1784,12 @@
if (ctx.nfound > 0 && ctx.items == NULL)
gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED);
- /* Zero or more items matched and given access to */
- else
+ /* Zero items matched */
+ else if (ctx.nfound == 0)
+ gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_MATCH);
+
+ /* More than one item found and given access to */
+ else
gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK);
ctx.items = g_list_sort_with_data (ctx.items, sort_found, ctx.attributes);
Index: library/gnome-keyring-utils.c
===================================================================
--- library/gnome-keyring-utils.c (revision 842)
+++ library/gnome-keyring-utils.c (revision 843)
@@ -111,14 +111,25 @@
return _("Access Denied");
case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON:
return _("The gnome-keyring-daemon application is not running.");
- case GNOME_KEYRING_RESULT_NO_SUCH_KEYRING:
- return _("The keyring has already been unlocked.");
case GNOME_KEYRING_RESULT_IO_ERROR:
return _("Error communicating with gnome-keyring-daemon");
case GNOME_KEYRING_RESULT_ALREADY_EXISTS:
return _("A keyring with that name already exists");
case GNOME_KEYRING_RESULT_BAD_ARGUMENTS:
return _("Programmer error: The application sent invalid data.");
+
+ /*
+ * TODO: These needs to be better messages, and translated in next
+ * release. This was added late because poorly written programs
+ * were assuming incorrect things about our result codes, and ABI
+ * compatibility and all that.
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=476682
+ */
+ case GNOME_KEYRING_RESULT_NO_MATCH:
+ return "No Results";
+ case GNOME_KEYRING_RESULT_NO_SUCH_KEYRING:
+ return "No such keyring exists";
/*
* This would be a dumb message to display to the user, we never return
Index: library/gnome-keyring-result.h
===================================================================
--- library/gnome-keyring-result.h (revision 842)
+++ library/gnome-keyring-result.h (revision 843)
@@ -33,7 +33,8 @@
GNOME_KEYRING_RESULT_BAD_ARGUMENTS,
GNOME_KEYRING_RESULT_IO_ERROR,
GNOME_KEYRING_RESULT_CANCELLED,
- GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS
+ GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS,
+ GNOME_KEYRING_RESULT_NO_MATCH
} GnomeKeyringResult;
#define GNOME_KEYRING_RESULT_ALREADY_EXISTS \

View File

@ -3,7 +3,7 @@
Summary: A framework for managing user passwords and other secrets
Name: gnome-keyring
Version: 2.20
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+ and LGPLv2+
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/gnome-keyring/2.20/gnome-keyring-%{version}.tar.bz2
@ -22,6 +22,7 @@ BuildRequires: perl(XML::Parser)
# Backport from svn
Patch1: gnome-keyring-2.20-add_new_keyrings.patch
Patch2: gnome-keyring-2.20-no-unset-default.patch
Patch3: gnome-keyring-2.20-no_match.patch
%description
gnome-keyring manages passwords and other types of secrets
@ -63,6 +64,7 @@ and start the keyring daemon.
%patch1 -p0 -b .add_new_keyrings
%patch2 -p1 -b .no_unset_default
%patch3 -p0 -b .no_match
%build
aclocal
@ -109,6 +111,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Thu Oct 4 2007 Alexander Larsson <alexl@redhat.com> - 2.20-3
- Add NO_MATCH error patch from svn. Will fix apps that
can't handle empty list matches
* Mon Oct 3 2007 Alexander Larsson <alexl@redhat.com> - 2.20-2
- Backport fix from svn where newly created keyrings weren't
found