aboutsummaryrefslogtreecommitdiffstats
path: root/src/verify.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-06-01 09:10:30 +0000
committerWerner Koch <[email protected]>2016-06-01 09:11:04 +0000
commit1cacd7d00a7b3de4a5e11ccce5ee6c50e0a5516d (patch)
tree375e6d6fd8d035923838359d84fc7fa30c842481 /src/verify.c
parentpython: use GPG_ERROR_CONFIG variable (diff)
downloadgpgme-1cacd7d00a7b3de4a5e11ccce5ee6c50e0a5516d.tar.gz
gpgme-1cacd7d00a7b3de4a5e11ccce5ee6c50e0a5516d.zip
core: Set notation flags for verify.
* src/gpgme.h.in (GPGME_STATUS_NOTATION_FLAGS): New. * src/status-table.c (status_table): Add new status. * src/verify.c (parse_notation): Handle flags. Also fix NOTATION_DATA in case gpg would not percent-escape spaces. (_gpgme_verify_status_handler): Handle flags. * tests/run-verify.c (print_result): Print notaion data. -- Note that this does only work with the soon to be released GnuPG 2.1.13.
Diffstat (limited to 'src/verify.c')
-rw-r--r--src/verify.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/src/verify.c b/src/verify.c
index e6c9665f..1ec09fe8 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -504,13 +504,14 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)
gpgme_error_t err;
gpgme_sig_notation_t *lastp = &sig->notations;
gpgme_sig_notation_t notation = sig->notations;
- char *end = strchr (args, ' ');
-
- if (end)
- *end = '\0';
+ char *p;
if (code == GPGME_STATUS_NOTATION_NAME || code == GPGME_STATUS_POLICY_URL)
{
+ p = strchr (args, ' ');
+ if (p)
+ *p = '\0';
+
/* FIXME: We could keep a pointer to the last notation in the list. */
while (notation && notation->value)
{
@@ -538,9 +539,8 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)
notation->name_len = strlen (notation->name);
- /* FIXME: For now we fake the human-readable flag. The
- critical flag can not be reported as it is not
- provided. */
+ /* Set default flags for use with older gpg versions which
+ * do not emit a NOTATIONS_FLAG line. */
notation->flags = GPGME_SIG_NOTATION_HUMAN_READABLE;
notation->human_readable = 1;
}
@@ -559,6 +559,37 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)
}
*lastp = notation;
}
+ else if (code == GPGME_STATUS_NOTATION_FLAGS)
+ {
+ char *field[2];
+
+ while (notation && notation->next)
+ {
+ lastp = &notation->next;
+ notation = notation->next;
+ }
+
+ if (!notation || !notation->name)
+ { /* There are notation flags without a previous notation name.
+ * The crypto backend misbehaves. */
+ return trace_gpg_error (GPG_ERR_INV_ENGINE);
+ }
+ if (_gpgme_split_fields (args, field, DIM (field)) < 2)
+ { /* Required args missing. */
+ return trace_gpg_error (GPG_ERR_INV_ENGINE);
+ }
+ notation->flags = 0;
+ if (atoi (field[0]))
+ {
+ notation->flags |= GPGME_SIG_NOTATION_CRITICAL;
+ notation->critical = 1;
+ }
+ if (atoi (field[1]))
+ {
+ notation->flags |= GPGME_SIG_NOTATION_HUMAN_READABLE;
+ notation->human_readable = 1;
+ }
+ }
else if (code == GPGME_STATUS_NOTATION_DATA)
{
int len = strlen (args) + 1;
@@ -918,6 +949,7 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args)
break;
case GPGME_STATUS_NOTATION_NAME:
+ case GPGME_STATUS_NOTATION_FLAGS:
case GPGME_STATUS_NOTATION_DATA:
case GPGME_STATUS_POLICY_URL:
opd->only_newsig_seen = 0;