Compare commits

...

1 Commits

Author SHA1 Message Date
Werner Koch
e35400bd69
core: Check STATUS_FAILURE in export operations.
* src/export.c (op_data_t): Add failure_code.
(export_status_handler): Set it.
(gpgme_op_export_ext, gpgme_op_export_keys): Also check the failure
code.
--

That is just in case we missed an error code.  For example with older
gpg versions (e.g. 2.3.8) and exporting to a keyserver.
2023-09-20 12:05:41 +02:00

View File

@ -35,7 +35,12 @@
/* Local operation data. */
typedef struct
{
gpg_error_t err; /* Error encountered during the export. */
/* The error code from a FAILURE status line or 0. */
gpg_error_t failure_code;
/* Error encountered during the export. */
gpg_error_t err;
} *op_data_t;
@ -110,6 +115,10 @@ export_status_handler (void *priv, gpgme_status_code_t code, char *args)
opd->err = err;
break;
case GPGME_STATUS_FAILURE:
opd->failure_code = _gpgme_parse_failure (args);
break;
default:
break;
}
@ -356,7 +365,7 @@ gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, -1, NULL);
opd = hook;
if (!err)
err = opd->err;
err = opd->err ? opd->err : opd->failure_code;
}
}
@ -501,7 +510,7 @@ gpgme_op_export_keys (gpgme_ctx_t ctx,
err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, -1, NULL);
opd = hook;
if (!err)
err = opd->err;
err = opd->err ? opd->err : opd->failure_code;
}
}