From 3c1c9ed5721d2cb2c5c4adc0b7ff5b52eeb0eabf Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 3 Jan 2006 18:31:48 +0000 Subject: [PATCH] Added PKA stuff --- NEWS | 4 ++-- configure.ac | 2 +- gpgme/ChangeLog | 8 +++++++- gpgme/gpgme.h | 9 ++++++--- gpgme/verify.c | 16 ++++++++++++---- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 670166f..9df539a 100644 --- a/NEWS +++ b/NEWS @@ -21,8 +21,7 @@ Noteworthy changes in version 1.1.1 (unreleased) * New status codes GPGME_PKA_TRUST_GOOD and GPGME_PKA_TRUST_BAD. They are analyzed by the verify handlers and made available in the - new PKA_TRUST field of the signature result structure. - + new PKA_TRUST and PKA_ADDRESS fields of the signature result structure. * Interface changes relative to the 1.1.0 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -32,6 +31,7 @@ gpgme_free NEW GPGME_STATUS_PKA_TRUST_BAD NEW GPGME_STATUS_PKA_TRUST_GOOD NEW gpgme_signature_t EXTENDED: New field pka_trust. +gpgme_signature_t EXTENDED: New field pka_address. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/configure.ac b/configure.ac index a713b4d..f8cfa0f 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ min_automake_version="1.9.3" # Version number: Remember to change it immediately *after* a release. # Make sure to run "svn up" before a "make dist". -AC_INIT(gpgme, 1.2.0-cvs, [bug-gpgme@gnupg.org]) +AC_INIT(gpgme, 1.1.1-cvs, [bug-gpgme@gnupg.org]) # LT Version numbers, remember to change them just *before* a release. # (Code changed: REVISION++) # (Interfaces added/removed/changed: CURRENT++, REVISION=0) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 3ca9302..ed7377d 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -8,11 +8,17 @@ * w32-glib-io.c (find_channel): Set channel to unbuffered. (_gpgme_io_select): Fix debug output. +2005-12-23 Werner Koch + + * gpgme.h (struct _gpgme_signature): Append field PKA_ADDRESS. + * verify.c (release_op_data, _gpgme_verify_status_handler): Set + this field. + 2005-12-20 Werner Koch * gpgme.h (gpgme_status_code_t): Added GPGME_STATUS_PKA_TRUST_BAD and GPGME_STATUS_PKA_TRUST_GOOD. - (gpgme_signature_t): New field pka_trust. + (struct _gpgme_signature): New field pka_trust. * verify.c (_gpgme_verify_status_handler): Set pka_trust. 2005-12-06 Werner Koch diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 4fb4154..e056735 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -72,7 +72,7 @@ extern "C" { AM_PATH_GPGME macro) check that this header matches the installed library. Warning: Do not edit the next line. configure will do that for you! */ -#define GPGME_VERSION "1.2.0-cvs" +#define GPGME_VERSION "1.1.1-cvs" @@ -1020,11 +1020,11 @@ gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh); gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh, gpgme_data_encoding_t enc); -/* Get the filename associated with the data object with handle DH, or +/* Get the file name associated with the data object with handle DH, or NULL if there is none. */ char *gpgme_data_get_file_name (gpgme_data_t dh); -/* Set the filename associated with the data object with handle DH to +/* Set the file name associated with the data object with handle DH to FILE_NAME. */ gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh, const char *file_name); @@ -1334,6 +1334,9 @@ struct _gpgme_signature /* The hash algorithm used to create the signature. */ gpgme_hash_algo_t hash_algo; + + /* The mailbox from the PKA information or NULL. */ + char *pka_address; }; typedef struct _gpgme_signature *gpgme_signature_t; diff --git a/gpgme/verify.c b/gpgme/verify.c index 7792f35..8596bbc 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -64,6 +64,8 @@ release_op_data (void *hook) if (sig->fpr) free (sig->fpr); + if (sig->pka_address) + free (sig->pka_address); free (sig); sig = next; } @@ -588,6 +590,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) void *hook; op_data_t opd; gpgme_signature_t sig; + char *end; err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, &hook, -1, NULL); opd = hook; @@ -654,10 +657,15 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_PKA_TRUST_BAD: case GPGME_STATUS_PKA_TRUST_GOOD: opd->only_newsig_seen = 0; - if (sig && !sig->pka_trust) - sig->pka_trust = code == GPGME_STATUS_PKA_TRUST_GOOD? 2 : 1; - /* FIXME: We should set the mailbox which is the argument to - these status codes into a new field. */ + /* Check that we only get one of these status codes per + signature; if not the crypto backend misbehaves. */ + if (!sig || sig->pka_trust || sig->pka_address) + return gpg_error (GPG_ERR_INV_ENGINE); + sig->pka_trust = code == GPGME_STATUS_PKA_TRUST_GOOD? 2 : 1; + end = strchr (args, ' '); + if (end) + *end = 0; + sig->pka_address = strdup (args); break; case GPGME_STATUS_ERROR: -- 2.26.2