diff options
Diffstat (limited to 'src/engine-gpg.c')
-rw-r--r-- | src/engine-gpg.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 9a9a26e..b51ea17 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1961,6 +1961,27 @@ append_args_from_sig_notations (engine_gpg_t gpg, gpgme_ctx_t ctx /* FIXME */, static gpgme_error_t +append_args_from_cert_expire (engine_gpg_t gpg, gpgme_ctx_t ctx) +{ + gpgme_error_t err; + + if (ctx->cert_expire) + { + /* Override ask-cert-expire set in the configuration, so that the specified + * default is actually used. */ + err = add_arg (gpg, "--no-ask-cert-expire"); + if (!err) + err = add_arg (gpg, "--default-cert-expire"); + if (!err) + err = add_arg (gpg, ctx->cert_expire); + } + else + err = 0; + return err; +} + + +static gpgme_error_t gpg_edit (void *engine, int type, gpgme_key_t key, gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */) { @@ -1976,6 +1997,8 @@ gpg_edit (void *engine, int type, gpgme_key_t key, gpgme_data_t out, if (!err) err = append_args_from_sig_notations (gpg, ctx, NOTATION_FLAG_CERT); if (!err) + err = append_args_from_cert_expire (gpg, ctx); + if (!err) err = add_arg (gpg, type == 0 ? "--edit-key" : "--card-edit"); if (!err) err = add_data (gpg, out, 1, 1); @@ -2336,13 +2359,8 @@ export_common (engine_gpg_t gpg, gpgme_export_mode_t mode, if ((mode & GPGME_EXPORT_MODE_MINIMAL)) { - if ((mode & GPGME_EXPORT_MODE_NOUID)) - err = add_arg (gpg, "--export-options=export-minimal,export-drop-uids"); - else - err = add_arg (gpg, "--export-options=export-minimal"); + err = add_arg (gpg, "--export-options=export-minimal"); } - else if ((mode & GPGME_EXPORT_MODE_NOUID)) - err = add_arg (gpg, "--export-options=export-drop-uids"); if (err) ; @@ -2358,8 +2376,6 @@ export_common (engine_gpg_t gpg, gpgme_export_mode_t mode, else if ((mode & GPGME_EXPORT_MODE_EXTERN)) { err = add_arg (gpg, "--send-keys"); - if (!err && (mode & GPGME_EXPORT_MODE_NOUID)) - err = add_arg (gpg, "--keyserver-options=export-drop-uids"); } else { @@ -3171,6 +3187,13 @@ gpg_keysign (void *engine, gpgme_key_t key, const char *userid, else err = add_arg (gpg, "--quick-sign-key"); + /* The force flag as only an effect with recent gpg versions; if the + * gpg version is too old, the signature will simply not be created. + * I think this is better than bailing out. */ + if (!err && (flags & GPGME_KEYSIGN_FORCE) + && have_gpg_version (gpg, "2.2.28")) + err = add_arg (gpg, "--force-sign-key"); + if (!err) err = append_args_from_signers (gpg, ctx); |