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.
This commit is contained in:
parent
8ad22290df
commit
349a69b5ea
15
src/export.c
15
src/export.c
@ -35,7 +35,12 @@
|
|||||||
/* Local operation data. */
|
/* Local operation data. */
|
||||||
typedef struct
|
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;
|
} *op_data_t;
|
||||||
|
|
||||||
|
|
||||||
@ -110,6 +115,10 @@ export_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
|||||||
opd->err = err;
|
opd->err = err;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GPGME_STATUS_FAILURE:
|
||||||
|
opd->failure_code = _gpgme_parse_failure (args);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
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);
|
err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, -1, NULL);
|
||||||
opd = hook;
|
opd = hook;
|
||||||
if (!err)
|
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);
|
err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, -1, NULL);
|
||||||
opd = hook;
|
opd = hook;
|
||||||
if (!err)
|
if (!err)
|
||||||
err = opd->err;
|
err = opd->err ? opd->err : opd->failure_code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user