From d75b2a91517397261c2508dba058611f803c0733 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 31 Aug 2023 12:02:02 +0200 Subject: Support GPGME_ENCRYPT_ALWAYS_TRUST also for S/MIME. * src/engine-gpgsm.c (gpgsm_encrypt): Send the always-trust options. * tests/run-encrypt.c: Add option --always-trust. -- Note that the run-encrypt test tool used to assume always-trust for OpenPGP since 1.7.0 This bug has also been fixed by introducing the explicit option. GnuPG-bug-id: 6559 --- src/engine-gpgsm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 8a8beb87..24b142c5 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -1255,7 +1255,7 @@ gpgsm_reset (void *engine) /* IF we have an active connection we must send a reset because we need to reset the list of signers. Note that RESET does not - reset OPTION commands. */ + reset all OPTION commands. */ return (gpgsm->assuan_ctx ? gpgsm_assuan_simple_command (gpgsm, "RESET", NULL, NULL) : 0); @@ -1547,6 +1547,17 @@ gpgsm_encrypt (void *engine, gpgme_key_t recp[], const char *recpstring, return err; } + if ((flags & GPGME_ENCRYPT_ALWAYS_TRUST)) + { + /* Note that a RESET and the actual operation resets the + * always-trust option. To support older gnupg versions we + * ignore the unknown option error. */ + err = gpgsm_assuan_simple_command (gpgsm, + "OPTION always-trust", NULL, NULL); + if (err && gpg_err_code (err) != GPG_ERR_UNKNOWN_OPTION) + return err; + } + err = send_input_size_hint (gpgsm, plain); if (err) return err; -- cgit v1.2.3