diff options
author | Ben Kibbey <[email protected]> | 2015-07-16 01:41:15 +0000 |
---|---|---|
committer | Ben Kibbey <[email protected]> | 2015-07-17 01:10:48 +0000 |
commit | 259b61f73cb40fd3cb7da21cba4b1a69bfa2da78 (patch) | |
tree | 046ca71e0b6d5ab0834407875175ed587a23bdab /src/engine.c | |
parent | Post release updates (diff) | |
download | gpgme-259b61f73cb40fd3cb7da21cba4b1a69bfa2da78.tar.gz gpgme-259b61f73cb40fd3cb7da21cba4b1a69bfa2da78.zip |
Add per-ctx custom engine options.bjk/custom-engine-options
* src/gpgme.h.in (gpgme_ctx_set_engine_options): New prototype.
(gpgme_ctx_get_engine_options): Ditto.
* src/engine-backend.h (engine_ops): Add set_options and get_options.
* src/engine.c (gpgme_ctx_set_engine_options): New.
(gpgme_ctx_get_engine_options): Ditto.
* src/engine-gpg.c (gpg_set_options): New.
(gpg_get_options): Ditto.
* src/op-support.c (_gpgme_op_reset): Keep custom options.
* src/engine-gpg.c (_gpgme_engine_ops_gpg): Adjust for new members.
* src/engine-assuan.c (_gpgme_engine_ops_assuan): Ditto.
* src/engine-g13.c (_gpgme_engine_ops_g13): Ditto.
* src/engine-gpgconf.c (_gpgme_engine_ops_gpgconf): Ditto.
* src/engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Ditto.
* src/engine-spawn.c (_gpgme_engine_ops_spawn): Ditto.
* src/engine-uiserver.c (_gpgme_engine_ops_uiserver): Ditto.
* src/gpgme.def: Export new symbols.
* src/libgpgme.vers: Ditto.
* doc/gpgme.texi: Document these new functions.
--
Not all of gpg2's features are exposed to libgpgme and adding these
functions makes it possible to do things like specify an --s2k-count,
etc.
Diffstat (limited to 'src/engine.c')
-rw-r--r-- | src/engine.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/engine.c b/src/engine.c index ff015c00..cbd34575 100644 --- a/src/engine.c +++ b/src/engine.c @@ -445,6 +445,37 @@ gpgme_set_engine_info (gpgme_protocol_t proto, return err; } +/* Set custom command line options for the engine associated with a + context. */ +gpgme_error_t +gpgme_ctx_set_engine_options (gpgme_ctx_t ctx, const char *options) +{ + if (!ctx || !ctx->engine) + return gpg_error (GPG_ERR_INV_VALUE); + + if (!ctx->engine->ops->set_options) + return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + + return (*ctx->engine->ops->set_options) (ctx->engine->engine, options); +} + +/* Return previously set custom engine command line options. */ +gpgme_error_t +gpgme_ctx_get_engine_options (gpgme_ctx_t ctx, const char **result) +{ + if (!ctx || !ctx->engine) + return gpg_error (GPG_ERR_INV_VALUE); + + if (!result) + return gpg_error (GPG_ERR_INV_ARG); + + if (!ctx->engine->ops->get_options) + return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + + *result = (*ctx->engine->ops->get_options) (ctx->engine->engine); + return 0; +} + gpgme_error_t _gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine) |