From: Marcus Brinkmann Date: Thu, 31 Jul 2003 16:01:13 +0000 (+0000) Subject: doc/ X-Git-Tag: gpgme-1.2.0@1385~560 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3d4d551ae138e5202869db015032779a774b500f;p=gpgme.git doc/ 2003-07-31 Marcus Brinkmann * gpgme.texi (Listing Keys): Document GPG_ERR_AMBIGUOUS_NAME for gpgme_get_key. gpgme/ 2003-07-31 Marcus Brinkmann * keylist.c (gpgme_get_key): Check if there is more than one key listed, and return GPG_ERR_AMBIGUOUS_NAME in that case. --- diff --git a/trunk/NEWS b/trunk/NEWS index 25f40cf..0a76003 100644 --- a/trunk/NEWS +++ b/trunk/NEWS @@ -1,3 +1,15 @@ +Noteworthy changes in version 0.4.3 (unreleased) +------------------------------------------------ + + * gpgme_get_key fails with GPG_ERR_AMBIGUOUS_NAME if the key ID + provided was not unique, instead returning the first matching key. + + * Interface changes relative to the 0.4.3 release: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +gpgme_get_key CHANGED: Fails correctly if key ID not unique. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Noteworthy changes in version 0.4.2 (2003-07-30) ------------------------------------------------ diff --git a/trunk/doc/ChangeLog b/trunk/doc/ChangeLog index 115ae61..60336a8 100644 --- a/trunk/doc/ChangeLog +++ b/trunk/doc/ChangeLog @@ -1,3 +1,8 @@ +2003-07-31 Marcus Brinkmann + + * gpgme.texi (Listing Keys): Document GPG_ERR_AMBIGUOUS_NAME for + gpgme_get_key. + 2003-07-29 Marcus Brinkmann * Makefile.am (EXTRA_DIST): Remove variable. diff --git a/trunk/doc/gpgme.texi b/trunk/doc/gpgme.texi index 916c68e..4a97e8d 100644 --- a/trunk/doc/gpgme.texi +++ b/trunk/doc/gpgme.texi @@ -1144,7 +1144,8 @@ were configured to exclude support for this engine, or because the engine is not installed properly. @item GPG_ERR_AMBIGUOUS_NAME -This value indicates that a user ID did not specify a unique key. +This value indicates that a user ID or other specifier did not specify +a unique key. @item GPG_ERR_WRONG_KEY_USAGE This value indicates that a key is not used appropriately. @@ -2377,8 +2378,9 @@ the error code @code{GPG_ERR_NO_ERROR} and *@var{r_key} will be set to The function returns the error code @code{GPG_ERR_INV_VALUE} if @var{ctx} or @var{r_key} is not a valid pointer or @var{fpr} is not a -fingerprint or key ID, and @code{GPG_ERR_ENOMEM} if at some time -during the operation there was not enough memory available. +fingerprint or key ID, @code{GPG_ERR_AMBIGUOUS_NAME} if the key ID was +not a unique specifier for a key, and @code{GPG_ERR_ENOMEM} if at some +time during the operation there was not enough memory available. @end deftypefun diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 4d6ff1b..7108693 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,8 @@ 2003-07-31 Marcus Brinkmann + * keylist.c (gpgme_get_key): Check if there is more than one key + listed, and return GPG_ERR_AMBIGUOUS_NAME in that case. + * util.h (_gpgme_decode_c_string): Change type of LEN argument to size_t. (_gpgme_decode_percent_string): Likewise. diff --git a/trunk/gpgme/keylist.c b/trunk/gpgme/keylist.c index 6bd6833..c47f386 100644 --- a/trunk/gpgme/keylist.c +++ b/trunk/gpgme/keylist.c @@ -832,6 +832,7 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key, { gpgme_ctx_t listctx; gpgme_error_t err; + gpgme_key_t key; if (!ctx || !r_key) return gpg_error (GPG_ERR_INV_VALUE); @@ -849,6 +850,21 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key, err = gpgme_op_keylist_start (listctx, fpr, secret); if (!err) err = gpgme_op_keylist_next (listctx, r_key); + if (!err) + { + err = gpgme_op_keylist_next (listctx, &key); + if (gpgme_err_code (err) == GPG_ERR_EOF) + err = gpg_error (GPG_ERR_NO_ERROR); + else + { + if (!err) + { + gpgme_key_unref (key); + err = gpg_error (GPG_ERR_AMBIGUOUS_NAME); + } + gpgme_key_unref (*r_key); + } + } gpgme_release (listctx); return err; }