After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 447315 - Do not return denied error in case no item are found
Do not return denied error in case no item are found
Status: RESOLVED FIXED
Product: libgnome-keyring
Classification: Core
Component: General
2.19.x
Other Linux
: Normal minor
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2007-06-13 21:03 UTC by Sylvain Pasche
Modified: 2019-02-22 11:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sylvain Pasche 2007-06-13 21:03:00 UTC
Right now, the gnome_keyring_find_items* functions return GNOME_KEYRING_RESULT_DENIED when no items are found.

I think it would be more consistent to return a GNOME_KEYRING_RESULT_OK error code in this case, and let consumers check the length of the returned array (empty if nothing is found). The denied error code should be used in case access is really denied.

Testcase:

cd library
./test-keyring f bar
 found items: res: 1 (GNOME_KEYRING_RESULT_DENIED) nr items: 0

./test-keyring c foo bar
./test-keyring f bar
  [...]
  found items: res: 0 (GNOME_KEYRING_RESULT_OK) nr items: 1
  [...]
Comment 1 Sylvain Pasche 2007-06-13 21:36:05 UTC
Correction: the items are returned as a list (a NULL check would have to be done instead).

Comment 2 Stef Walter 2007-06-14 15:56:34 UTC
Thanks for catching that. Fixed. Also added a unit test so we can verify this behavior in the future. 

2007-06-14  Stef Walter  <stef@memberwebs.com>

	* daemon/gnome-keyring-daemon-io.c
	* daemon/gnome-keyring-daemon.c:
	* daemon/gnome-keyring-daemon.h:
	* tests/unit-test-keyrings.c: Make a find operation that does not 
	match any results, return OK instead of DENIED. Fixes bug #447315