gnome-keyring/gnome-keyring-2.20-no_match.patch

91 lines
3.4 KiB
Diff
Raw Normal View History

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 \