summaryrefslogtreecommitdiff
path: root/src/export.c
diff options
context:
space:
mode:
authorIngo Klöcker <dev@ingo-kloecker.de>2022-01-03 14:49:40 +0100
committerIngo Klöcker <dev@ingo-kloecker.de>2022-01-04 09:22:25 +0100
commitc0581adabe7f5f63c0b96dac449790aa6ac4c291 (patch)
tree7b873088042811082a01e3e2ad39ebee09368c86 /src/export.c
parent326857511587fa7878757d3884f91bf7eb86771c (diff)
downloadgpgme-c0581adabe7f5f63c0b96dac449790aa6ac4c291.tar.gz
core: Check for combination of ssh mode with other mode flags
* src/export.c (check_mode): Return error if ssh mode is combined with another mode flag. -- The SSH mode flag cannot be used in combination with other flags. GnuPG-bug-id: 5757
Diffstat (limited to 'src/export.c')
-rw-r--r--src/export.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/export.c b/src/export.c
index c07433b0..637badf9 100644
--- a/src/export.c
+++ b/src/export.c
@@ -128,6 +128,16 @@ check_mode (gpgme_export_mode_t mode, gpgme_protocol_t protocol,
|GPGME_EXPORT_MODE_PKCS12)))
return gpg_error (GPG_ERR_INV_VALUE); /* Invalid flags in MODE. */
+ if ((mode & GPGME_EXPORT_MODE_SSH))
+ {
+ if ((mode & (GPGME_EXPORT_MODE_EXTERN
+ |GPGME_EXPORT_MODE_MINIMAL
+ |GPGME_EXPORT_MODE_SECRET
+ |GPGME_EXPORT_MODE_RAW
+ |GPGME_EXPORT_MODE_PKCS12)))
+ return gpg_error (GPG_ERR_INV_FLAG); /* Combination not allowed. */
+ }
+
if ((mode & GPGME_EXPORT_MODE_SECRET))
{
if ((mode & GPGME_EXPORT_MODE_EXTERN))