diff options
| author | Werner Koch <[email protected]> | 2019-12-13 14:10:51 +0000 | 
|---|---|---|
| committer | Werner Koch <[email protected]> | 2019-12-13 14:11:00 +0000 | 
| commit | 5eeae535ee0df981d8ae8b758b5bb0d190c7fd89 (patch) | |
| tree | 4e81680772097106b02c7bf7d4584b7a8334f351 | |
| parent | Revert "doc: Remove UI Server documentation" (diff) | |
| download | gpgme-5eeae535ee0df981d8ae8b758b5bb0d190c7fd89.tar.gz gpgme-5eeae535ee0df981d8ae8b758b5bb0d190c7fd89.zip | |
core: Extend gpgme_user_id_t with uidhash member.
* src/gpgme.h.in (struct _gpgme_user_id): Add field 'uidhash'.
* src/key.c (gpgme_key_unref): Free it.
* src/keylist.c (keylist_colon_handler): Set it.
* tests/run-keylist.c (main): Print it.
--
The uidhash value is part of gpg's output since the year 2005.  This
now adds support to gpgme.  The application for uidhash is to select
a user id in an edit interactor: Instead of giving the number of the
user id, the uidhash value can be be used to avoid tracking the user
id numbers.
Signed-off-by: Werner Koch <[email protected]>
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | doc/gpgme.texi | 6 | ||||
| -rw-r--r-- | src/gpgme.h.in | 3 | ||||
| -rw-r--r-- | src/key.c | 1 | ||||
| -rw-r--r-- | src/keylist.c | 6 | ||||
| -rw-r--r-- | tests/run-keylist.c | 2 | 
6 files changed, 19 insertions, 0 deletions
| @@ -13,6 +13,7 @@ Noteworthy changes in version 1.14.0 (unreleased)   * Interface changes relative to the 1.13.1 release:   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + gpgme_user_id_t                         EXTENDED: New field 'uidhash'.   cpp: UserID::remark                          NEW.   cpp: UserID::remarks                         NEW.   cpp: GpgSignKeyEditInteractor::setDupeOk     NEW. diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 36c2b32b..88b5f2cd 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -3581,6 +3581,12 @@ Reserved for the origin of this user ID.  Reserved for the time of the last update of this user ID. +@item char *uidhash; +A string used by gpg to identify a user ID.  This string can be used +at certain prompts of @code{gpgme_op_edit} to select a user ID.  Users +must be prepared to see a @code{NULL} value here.  The format of the +value is not specified and may depend on the GPGME or GnuPG version. +  @end table  @end deftp diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 722ce68b..a52901bb 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -728,6 +728,9 @@ struct _gpgme_user_id    /* Time of the last refresh of this user id.  0 if unknown.  */    unsigned long last_update; + +  /* The string to exactly identify a userid.  Might be NULL.  */ +  char *uidhash;  };  typedef struct _gpgme_user_id *gpgme_user_id_t; @@ -385,6 +385,7 @@ gpgme_key_unref (gpgme_key_t key)          }        free (uid->address); +      free (uid->uidhash);        free (uid);        uid = next_uid;      } diff --git a/src/keylist.c b/src/keylist.c index a0de7666..a4de3ad5 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -831,6 +831,12 @@ keylist_colon_handler (void *priv, char *line)            if (field[1])              set_userid_flags (key, field[1]); +          if (field[7] && *field[7]) +            { +              gpgme_user_id_t uid = key->_last_uid; +              assert (uid); +              uid->uidhash = strdup (field[7]); +            }            opd->tmp_uid = key->_last_uid;            if (fields >= 20)              { diff --git a/tests/run-keylist.c b/tests/run-keylist.c index d12e3703..23c61108 100644 --- a/tests/run-keylist.c +++ b/tests/run-keylist.c @@ -330,6 +330,8 @@ main (int argc, char **argv)              printf ("    name: %s\n", uid->name);            if (uid->comment)              printf ("   cmmnt: %s\n", uid->comment); +          if (uid->uidhash) +            printf (" uidhash: %s\n", uid->uidhash);            printf ("     upd: %lu (%u)\n", uid->last_update, uid->origin);            printf ("   valid: %s\n",                    uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown": | 
