diff options
author | Ingo Klöcker <[email protected]> | 2022-01-03 13:55:49 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2022-01-04 08:22:46 +0000 |
commit | c710af223cc2476d5f4d46c00d8e0521f6c13211 (patch) | |
tree | 8cd0b202d266adba7b3f69c70a559b9e1d3ad00e /src/engine-gpgsm.c | |
parent | core: Check for combination of ssh mode with other mode flags (diff) | |
download | gpgme-c710af223cc2476d5f4d46c00d8e0521f6c13211.tar.gz gpgme-c710af223cc2476d5f4d46c00d8e0521f6c13211.zip |
core: Check for unsupported export mode flags
src/engine-gpgsm.c (gpgsm_export, gpgsm_export_ext): Return error if an
unsupported mode flag is set.
--
The minimal mode flag has no effect for X.509 certificates, but we still
treat it as supported (as documented in the API documentation).
GnuPG-bug-id: 5757
Diffstat (limited to 'src/engine-gpgsm.c')
-rw-r--r-- | src/engine-gpgsm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 0347f640..182f6a39 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -1512,6 +1512,12 @@ gpgsm_export (void *engine, const char *pattern, gpgme_export_mode_t mode, if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); + if ((mode & ~(GPGME_EXPORT_MODE_SECRET + |GPGME_EXPORT_MODE_MINIMAL + |GPGME_EXPORT_MODE_RAW + |GPGME_EXPORT_MODE_PKCS12))) + return gpg_error (GPG_ERR_NOT_SUPPORTED); + if (!pattern) pattern = ""; @@ -1559,6 +1565,12 @@ gpgsm_export_ext (void *engine, const char *pattern[], gpgme_export_mode_t mode, if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); + if ((mode & ~(GPGME_EXPORT_MODE_SECRET + |GPGME_EXPORT_MODE_MINIMAL + |GPGME_EXPORT_MODE_RAW + |GPGME_EXPORT_MODE_PKCS12))) + return gpg_error (GPG_ERR_NOT_SUPPORTED); + if (pattern && *pattern) { const char **pat = pattern; |