aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: Add 'is_mime' flags to the verify and decrypt results.Werner Koch2018-04-185-11/+32
| | | | | | | | | | | | | | | | | | | * src/op-support.c (_gpgme_parse_plaintext): Add arg r_mime. * src/decrypt.c (_gpgme_decrypt_status_handler): Ser mime flag. * src/verify.c (_gpgme_verify_status_handler): Ditto. * src/gpgme.h.in (gpgme_op_verify_result_t): Append fields 'is_mime' and '_unused'. (gpgme_op_decrypt_result_t): New field 'is_mime'. Shrink '_unused'. * tests/run-decrypt.c (print_result): Print MIME flag. * tests/run-verify.c (print_result): Ditto. -- Note that this flag (Liternal Data packet's 'm' mode) is only specified in RFC-4880bis. To use it you currently need to add "rfc4880bis" to the the gpg.conf. Signed-off-by: Werner Koch <[email protected]>
* core: Fix possible compliance mode detection error.Werner Koch2018-04-181-0/+1
| | | | | | | | | | | | | * src/verify.c (_gpgme_verify_status_handler): Insert missing break. -- Before the insertion of the compliance status checking the break in the default clause was used by the STATUS_PLAINTEXT code. That got lost. I don't see any actual harm due to different values currently in use for the compliance status. Fixes-commit: 05fa2a9c7764b28fdac35eb72631439df948ca0e Signed-off-by: Werner Koch <[email protected]>
* json: Improve help meta command in gpgme-json.Werner Koch2018-04-181-7/+17
| | | | | | * src/gpgme-json.c (process_meta_commands): Add ",help CMD". Signed-off-by: Werner Koch <[email protected]>
* json: Add command "getmore" to gpgme-json.Werner Koch2018-04-181-46/+228
| | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (MIN_REPLY_CHUNK_SIZE): New const. (DEF_REPLY_CHUNK_SIZE): New const. (MAX_REPLY_CHUNK_SIZE): New const. (pending_data): New var. (add_base64_to_object): Chnage to take a plain data pointer. (get_chunksize): New. (make_data_object): New. (op_encrypt): Get chunksize and use make_data_object. (op_getmore): New. (process_request): Release pending data for all commands but "getmore" and "help". -- Native messaging has a limit on the data it may receive in one request. Thus the caller needs to watch for the "more" flag and request the remaining data using "getmore" in a loop. Signed-off-by: Werner Koch <[email protected]>
* json: Add meta command ,read to gpgme-json.Werner Koch2018-04-181-1/+58
| | | | | | | | * src/gpgme-json.c: Include stat.h. (get_file): New. (process_meta_commands): Implement ",read". Signed-off-by: Werner Koch <[email protected]>
* core: Extend decryption result with symkey_algo.Werner Koch2018-04-174-11/+114
| | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_decrypt_result_t): Add field 'symkey_algo'. * src/decrypt.c (release_op_data): Free SYMKEY_ALGO. (gpgme_op_decrypt_result): Make sure SYMKEY_ALGO is not NULL. (parse_decryption_info): New. (_gpgme_decrypt_status_handler): Parse DECRYPTION_INFO status. * src/conversion.c (_gpgme_cipher_algo_name): New. (_gpgme_cipher_mode_name): New. * tests/run-decrypt.c (print_result): Print SYMKEY_ALGO * src/util.h (_gpgme_map_gnupg_error): Remove obsolete prototype. -- Signed-off-by: Werner Koch <[email protected]>
* core: New keyword --file for OpenPGP recpstring.Werner Koch2018-04-171-3/+17
| | | | | | | | | | * src/engine-gpg.c (append_args_from_recipients_string): Add new flags. -- Now you can use gpgme to encrypt without first importing a key. Signed-off-by: Werner Koch <[email protected]>
* core: For OpenPGP let offline mode disable dirmngr.Werner Koch2018-04-171-5/+22
| | | | | | | | | | * src/engine-gpg.c (struct engine_gpg): New flag.offline. (gpg_set_engine_flags): Set it. Also fix setting of no_symkey_cache. (build_argv): Pass --disable-dirmngr in offline mode. -- GnuPG-bug-id: 3831 Signed-off-by: Werner Koch <[email protected]>
* core: Allow for --hidden keyword in OpenPGP recpstrings.Werner Koch2018-04-171-3/+9
| | | | | | | | | * src/engine-gpg.c (append_args_from_recipients_string): Add special keywords. -- GnuPG-bug-id: 3775 Signed-off-by: Werner Koch <[email protected]>
* core: New encryption flag GPGME_ENCRYPT_WANT_ADDRESS.Werner Koch2018-04-173-9/+80
| | | | | | | | | | | | * src/gpgme.h.in (GPGME_ENCRYPT_WANT_ADDRESS): New flag. * src/engine-gpg.c (add_arg_recipient): New. (add_arg_recipient_string): New. (append_args_from_recipients): Call new helper function. (append_args_from_recipients_string): Ditto. * src/gpgme-json.c (op_encrypt): Add flag "want-address". -- Signed-off-by: Werner Koch <[email protected]>
* core: Add extended versions of the encrypt functions.Werner Koch2018-04-1712-131/+405
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_encrypt_ext_start) New. (gpgme_op_encrypt_ext): New. (gpgme_op_encrypt_sign_ext_start): New. (gpgme_op_encrypt_sign_ext): New. * src/libgpgme.vers, tests/run-encrypt.c: Add them. * src/encrypt.c (encrypt_start): Add arg recpstring. (gpgme_op_encrypt): Factor code out to ... (gpgme_op_encrypt_ext): new function with new arg recpstring. (gpgme_op_encrypt_start): Factor code out to ... (gpgme_op_encrypt_ext_start): new function with new arg recpstring. * src/encrypt-sign.c (encrypt_sign_start): Add arg recpstring. (gpgme_op_encrypt_sign): Factor code out to ... (gpgme_op_encrypt_sign_ext): new function with new arg recpstring. (gpgme_op_encrypt_sign_start): Factor code out to ... (gpgme_op_encrypt_sign_ext_start): new function with new arg recpstring. * src/engine-backend.h (struct engine_ops): Change fields encrypt and encrypt_sign. * src/engine.c (_gpgme_engine_op_encrypt): Add arg recpstring and pass to engine. (_gpgme_engine_op_encrypt_sign): Ditto. * src/engine-gpg.c (append_args_from_recipients_string): New. (gpg_encrypt): Add arg recpstring and call new function as needed. (gpg_encrypt_sign): Ditto. * src/engine-gpgsm.c (set_recipients_from_string): New. (gpgsm_encrypt): Add arg recpstring and call new function as needed. * src/engine-uiserver.c (set_recipients_from_string): New. (uiserver_encrypt): Add arg recpstring and call new function as needed. * tests/run-encrypt.c (xstrdup): New. (main): Add option --keystring. * src/gpgme-json.c (get_keys): Simplify. (op_encrypt): Modify to make use of the extended encrypt function. -- This new feature can be used to avoid the need for a key lookup and thus several extra calls to the backend. Note that run-test uses a semicolon as delimiter because that make testing the feature on the command line much easier. Signed-off-by: Werner Koch <[email protected]>
* core: Tweak STATUS_FAILURE handling.Werner Koch2018-04-121-1/+9
| | | | | | | | | * src/op-support.c (_gpgme_parse_failure): Ignore failures with location "gpg-exit". * tests/gpg/t-verify.c (main): Adjust for the now working checking of the second key. Signed-off-by: Werner Koch <[email protected]>
* core: For a failed verification return the sig's fingerprint.Werner Koch2018-04-121-2/+19
| | | | | | | | | | | * src/verify.c (parse_new_sig): Parse the new ERRSIG fpr. -- This works only when the signatures features an ISSUER_FPR sub-packet and with GnuPG >= 2.2.7. If that is not the case the keyid is kept in the FPR field. Signed-off-by: Werner Koch <[email protected]>
* core: Add new context flag "no-symkey-cache".Werner Koch2018-04-123-1/+33
| | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_ctx_flag): Set flag. (gpgme_get_ctx_flag): Get flag. * src/context.h (struct gpgme_context): Add field no_symkey_cache. * src/engine-gpg.c (struct engine_gpg): Ditto. (gpg_set_engine_flags): Set flag. (build_argv): Pass option --no-symkey-cache to gpg. * tests/run-decrypt.c (print_result): Fix segv for symmetric messages. (main): New option --no-symkey-cache. * tests/run-encrypt.c (main): New option --no-symkey-cache. Signed-off-by: Werner Koch <[email protected]>
* json: Build only a dummy if libgpg-error is < 1.28Werner Koch2018-03-291-0/+5
| | | | Signed-off-by: Werner Koch <[email protected]>
* json: Remove the "message" object thingy again.Werner Koch2018-03-281-21/+9
| | | | | | | | | | * src/gpgme-json.c (process_request): Remove 'nm_mode'. -- This was an error in the javascript testing code. Thus the Mozilla specs are correct that the request is send verbatim. Signed-off-by: Werner Koch <[email protected]>
* json: Make native messaging work.Werner Koch2018-03-281-13/+64
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (opt_debug): New. (process_request): Add optional arg nm_mode. In this mode take the request from a "message" object. (native_messaging_repl): Add debug output and call process_request in NM_MODE. (main): Add option --debug. Parse envvar GPGME_JSON_DEBUG as an alternative way to enable this. Use a default log file. -- Note that the default log file is ~/.gnupg/S.gpgme-json.log . Thus to debug a javascript application you should start watchgnupg --time-only --force ~/.gnupg/S.gpgme-json.log in a separate tty and then use GPGME_JSON_DEBUG=1 firefox & to run firefox. Signed-off-by: Werner Koch <[email protected]>
* core: Initialize key return value in gpgme_get_keyAndre Heinecke2018-03-271-0/+2
| | | | | | | | | | | | | | | | | * src/keylist.c (gpgme_get_key): Set r_key to NULL. -- The c++ bindings and others assumed that r_key is set to NULL on error. This is the behavior gpgme_op_keylist_next also has. Even if it is not specified what happens to r_key on error setting it to NULL should not hurt and is more expected behavior. This directly fixes an uninitialized memory access error in the c++ bindings / Kleopatra: GnuPG-Bug-Id: T3865 And will fix some additional random crashes in Kleopatra and GpgOL.
* core: Need to increase an array in the gpg engine.Werner Koch2018-03-231-1/+1
| | | | | | | * src/engine-gpg.c (build_argv): Allcate one slot more for ARGV. -- Fixes-commit: b9000bc293164ff62efa7e91e5cf6d5fc19d482f
* json: Use a request origin of "browser".Werner Koch2018-03-231-0/+1
| | | | | | * src/gpgme-json.c (_create_new_context): Set flag. Signed-off-by: Werner Koch <[email protected]>
* core: New gpgme_set_ctx_flag "request-origin".Werner Koch2018-03-2313-7/+149
| | | | | | | | | | | | | | | | | | | | | | | | * src/context.h (gpgme_context): Add 'request_origin'. * src/gpgme.c (gpgme_release): Free that field. (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Add "request-origin". * src/engine-backend.h (engine_ops): Add 'set_engine_ops' func ptr and adjust all users. * src/engine.c (_gpgme_engine_set_engine_flags): New. * src/op-support.c (_gpgme_op_reset): Call that func. * src/engine-gpg.c (struct engine_gpg): Add 'request_origin'. (gpg_set_engine_flags): New. (_gpgme_engine_ops_gpg): Hook it. (build_argv): Use command line option --request-origin. * src/engine-gpgsm.c (struct engine_gpgsm): Add 'request_origin'. (gpgsm_set_engine_flags): New. (_gpgme_engine_ops_gpgsm): Hook it. (start): Send OPTION "request-origin". * src/engine-assuan.c (struct engine_llass): Add 'request_origin'. (gpgsm_set_engine_flags): New. (_gpgme_engine_ops_assuan): Hook it. (start): Send OPTION "pretend-request-origin". Signed-off-by: Werner Koch <[email protected]>
* build: Allow building with released libgpg-error.Werner Koch2018-03-231-0/+4
| | | | | | | * src/gpgme-json.c (add_base64_to_object): Return an error if building with an older libgpg-error. Signed-off-by: Werner Koch <[email protected]>
* Merge branch 'json-tool'Werner Koch2018-03-235-2/+3195
|\
| * json: Finish op:encrypt.Werner Koch2018-03-231-12/+171
| | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (add_base64_to_object): New. (data_from_base64_string): New. (op_encrypt): Employ them. (process_request): Print unformated json. -- Signed-off-by: Werner Koch <[email protected]>
| * json: Add a new function to cJSON.Werner Koch2018-03-232-0/+13
| | | | | | | | * src/cJSON.c (cJSON_CreateStringConvey): New.
| * json: Use gpgrt_argparse instead of argsparse.cWerner Koch2018-03-212-10/+21
| | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c: Remove header argparse.h. Define GPGRT_ENABLE_ARGPARSE_MACROS. (interactive_repl): Replace strusage by gpgrt_strusage. (my_strusage): Add SPDX level. (main): Switch to gpgrt_argparse stuff but keep very limited functionality when building with an older libgpg-error. Signed-off-by: Werner Koch <[email protected]>
| * json: Implement op:encryptWerner Koch2018-03-201-61/+393
| | | | | | | | Signed-off-by: Werner Koch <[email protected]>
| * Merge branch 'master' into json-toolWerner Koch2018-03-203-7/+17
| |\
| * | json: Add framework for the gpgme-json toolWerner Koch2018-03-162-2/+832
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c: New. * src/Makefile.am (bin_PROGRAMS): Add gpgme-json. (gpgme_json_SOURCES, gpgme_json_LDADD): New. Signed-off-by: Werner Koch <[email protected]>
| * | core: Adjust cJSON code for use in GPGME.Werner Koch2018-03-162-36/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/cJSON.c: Remove util.h. Use gpgrt alloc functions. (cJSON_Delete): Do not clobber ERRNO. (cJSON_AddItemToObject): Return OBJECT or NULL. (cJSON_AddNullToObject): New. (cJSON_AddTrueToObject): New. (cJSON_AddFalseToObject): New. (cJSON_AddBoolToObject): New. (cJSON_AddNumberToObject): New. (cJSON_AddStringToObject): New. * src/cJSON.h (cJSON__h): Replace macro by cJSON_h for C compliance. (cJSON_AddNullToObject): Remove macro. (cJSON_AddTrueToObject): Remove macro. (cJSON_AddFalseToObject): Remove macro. (cJSON_AddBoolToObject): Remove macro. (cJSON_AddNumberToObject): Remove macro. (cJSON_AddStringToObject): Remove macro. -- The gpgrt malloc functions are used so that we can easily mix memory returned by gpgrt (e.g. es_read_line) with memory returned from the JSON function. In general that is not needed but on Windows it makes a difference if the gpgme DLL is linked to a different C runtime than the application. The macros have been replaced to allow error checking (i.e out of core) for these functions. More error checking should be implemented instead of silently creating objects which are not as requested. Signed-off-by: Werner Koch <[email protected]>
| * | core: Import cJSON code from the payproc project.Werner Koch2018-03-143-0/+1734
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/cJSON.c: New. * src/cJSON.h: New. * src/cJSON.readme: New. -- This is a copy of the code from the payproc commit af5d6b4f820ee19e246a2cab6f56465fe91f1233. The code was originally added to payproc with the commit below. Signed-off-by: Werner Koch <[email protected]> =============================================== commit 7ae7ef29bc5ec19e005e6a5a739233d655f3f05f Author: Werner Koch <[email protected]> AuthorDate: Wed Apr 2 09:01:42 2014 +0200 Commit: Werner Koch <[email protected]> CommitDate: Wed Apr 2 09:12:02 2014 +0200 Simplify cJSON and add new macros. * src/cJSON.h: Re-indented. (cjson_t): New. (cjson_is_): New macros. * src/cJSON.c: Re-indented. Include errno.h and our util.h. (ep): Remove global var. (cJSON_GetErrorPtr): Remove. (cJSON_strcasecmp): Cast args for use with tolower. (cJSON_malloc, cJSON_free): Remove. Change callers to use xtrymalloc and xfree. (cJSON_InitHooks): Remove. (cJSON_strdup): Remove. Change callers to use xtrystrdup. (cJSON_New_Item): Simplify. (cJSON_ParseWithOpts, cJSON_Parse): Add arg R_ERROFF. (parse_string, parse_value, parse_array, parse_object): Add arg EP. -- cJSON has been taken from cjson-code-58.zip. The README file has been renamed to cJSON.readme and the files have been changed to GNU coding standards. Because that parser is small enough to be source copied it does not make sense to treat it as a library and I changed the memory allocation functions to the usual xmalloc ones. The only external dependency now is out util.h which declares those functions. The lowercase cjson_t better fits into our coding style as well as the new macros. Thanks to Dave Gamble for this nice parser. ===============================================
* | | Merge branch 'ben/docs/2018-03' of ssh+git://playfair.gnupg.org/git/gpgme ↵Ben McGinnes2018-03-211-1/+1
|\ \ \ | |_|/ |/| | | | | into ben/docs/2018-03
| * | IDENTIFYBen McGinnes2018-03-041-1/+1
| |/ | | | | | | * Fixed sp error in docstring.
* | core: Do not clobber R_KEY in gpgme_get_key on error.Werner Koch2018-03-201-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | * src/keylist.c (gpgme_get_key): Assign a value to the return parameter only on success. -- This problem could be triggered by an ambiguous key. The problem is that the key returned in that case is for one not expected and worse it has not been ref-ed. Signed-off-by: Werner Koch <[email protected]>
* | core: Fix ABI regression in recent commit.Werner Koch2018-03-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (_gpgme_op_import_result): Move new field 'skipped_v3_keys' to the end. -- The ABI break has not made it into a release. Also document the new field. Fixes-commit: a630a1e3e74c926163864b013cb164b4cd1866fc Signed-off-by: Werner Koch <[email protected]>
* | core: Parse skipped_v3_keysAndre Heinecke2018-03-152-2/+10
|/ | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_import_result_t): Extend with skipped_v3_keys. * src/import.c (gpgme_op_import_result): Extend debug with new field. (parse_import_res): Parse skipped_v3_keys. * tests/gpg/t-support.h, tests/run-support.h (print_import_result): Print skipped_v3_keys. -- This makes it possible to handle this in a GUI in a future version. GnuPG-Bug-Id: T3776
* core: Support non-thread-safe getenv.NIIBE Yutaka2018-02-271-20/+36
| | | | | | | * src/get-env.c (_gpgme_getenv): Use gpgrt_lock_lock and gpgrt_lock_unlock to protect call of getnev. Signed-off-by: NIIBE Yutaka <[email protected]>
* core, w32: Enable spawning GUI applicationsAndre Heinecke2018-02-094-4/+6
| | | | | | | | | | | * src/engine-spawn.c (engspawn_start): Translate spawn flag to IOSPAWN flag. * src/gpgme-w32spawn.c (my_spawn): Handle the new flag. * src/gpgme.h.in (GPGME_SPAWN_SHOW_WINDOW): New. * src/priv-io.h (IOSPAWN_FLAG_SHOW_WINDOW): New. -- Used by GpgOL
* core, w32: Fix flags passing to gpgme-w32-spawnAndre Heinecke2018-02-091-2/+2
| | | | | | | | | * src/w32-io.c (_gpgme_io_spawn): Don't hardcode flags value. -- IOSPAWN_FLAG_ALLOW_SET_FG is 2 and was translated to 1. This might fix the pinentry foreground handling pass through.
* Fix compile error message.NIIBE Yutaka2018-01-291-2/+1
| | | | | | * src/get-env.c (_gpgme_getenv): Fix error message. Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Implement _gpgme_getenv for NetBSD.NIIBE Yutaka2018-01-291-1/+40
| | | | | | | | | * src/get-env.c [HAVE_GETENV_R] (_gpgme_getenv): New. -- GnuPG-bug-id: 3056 Signed-off-by: NIIBE Yutaka <[email protected]>
* Require libgpg-error 1.24 and libassuan 2.4.2Werner Koch2017-12-121-4/+0
| | | | | | | | | | | * src/util.h (GPG_ERR_FALSE): Remove due to newer libgpg-error. -- We require these over one year old versions to better allign with GnuPG's demand. Note that the required libassuan is acgtually 2 years old. Signed-off-by: Werner Koch <[email protected]>
* core,w32: Fix popping up of console windows due to gpgconf.Werner Koch2017-12-111-1/+0
| | | | | | | | | | | | | | * src/gpgme-w32spawn.c (my_spawn): Create w/o DETACHED_PROCESS. -- The spawn helper is actually called with DETACHED_PROCESS and should not need to do a DETACHED_PROCESS of its own. Interestingly this patch removes the popups. See Andre's report GnuPG-bug-id: 3515 Signed-off-by: Werner Koch <[email protected]>
* Spelling fixes for comments and docAndre Heinecke2017-12-085-5/+5
| | | | | | | -- Patch provided by ka7 in dev.gnupg.org Differential D423
* core: Also check for a failed selftest in gpgm_data_new.Werner Koch2017-12-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | * src/data.c (_gpgme_data_new): Check for failed selftest. * tests/run-support.h (make_filename): Print a message on mallooc failure. (init_gpgme_basic): New. * tests/run-identify.c (main): Call init_gpgme_basic becuase we do not need to setup a protocol. * tests/t-data.c: Define PGM and include run-support.h. (make_filename): Remove. (main): Call init_gpgme_basic. -- Note: This patch may break applications which used gpgme_data but no gpgme_new without having called the required gpgme_check_version. GPGME can be used without a protocol for example to work with the data object abstraction. Thus a call to gpgme_data_new also needs to check the result of the core selftests - including on whether gpgme_check_version has been called. Signed-off-by: Werner Koch <[email protected]>
* Fix uid parsing for ldap keyserverAndre Heinecke2017-12-011-3/+14
| | | | | | | | | | | * src/engine-gpg.c (gpg_keylist_preprocess): Check field count for uid and add fallback. -- This fixes accessing unintialized memory and resulting crashes in gpgrt_asprintf. GnuPG-Bug-Id: T3550
* core: use getdents64 syscall on linux instead of getdents.Daniel Kahn Gillmor2017-10-121-7/+8
| | | | | | | | | | | | * src/posix-io.c (get_max_fds): use getdents64 instead of getdents. -- getdents64 was introduced in linux 2.4, so it should be widely available. some Linux architectures which post-date 2.4 (e.g. arm64) appear to not have getdents at all, so it's probably better to use the more modern interface. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* core: Allow disabling the use of SYS_getdents for Linux.Werner Koch2017-10-041-6/+8
| | | | | | | | * configure.ac (USE_LINUX_GETDENTS): New ac_define. Add option --disable-linux-getdents. * src/posix-io.c: Make use of USE_LINUX_GETDENTS. Signed-off-by: Werner Koch <[email protected]>
* core: Restore get_max_fds optimization on LinuxColin Watson2017-10-041-33/+66
| | | | | | | | | | | | | | | | | * src/posix-io.c (get_max_fds): Restore Linux optimization, this time using open/getdents/close rather than opendir/readdir/closedir. -- opendir/readdir/closedir may allocate/free memory, and aren't required to do so in an async-signal-safe way. On the other hand, opening /proc/self/fd directly and iterating over it using getdents is safe. (getdents is not strictly speaking documented to be async-signal-safe because it's not in POSIX. However, the Linux implementation is essentially just a souped-up read. Python >= 3.2.3 makes the same assumption.) Signed-off-by: Colin Watson <[email protected]>
* core: New context flag "auto-key-retrieve"Werner Koch2017-08-2410-9/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "auto-key-retrieve". * src/context.h (gpgme_context): New field auto_key_retrieve. * src/engine-backend.h (struct engine_ops): Add arg auto_key_retrieve to field 'decrypt'. * src/engine-gpg.c (gpg_decrypt): Add arg auto_key_retrieve and pass option --auto-key-retrieve to gpg. Adjust all callers. (gpg_verify): Ditto. * src/engine-gpgsm.c (gpgsm_decrypt): Add dummy arg auto_key_retrieve. * src/engine-uiserver.c (uiserver_decrypt): Ditto. * tests/run-verify.c (main): Add option --auto-key-retrieve. -- This makes the --auto-key-retrieve option available in the GPGME API. Test plan: Run GPGME_DEBUG=9:out tests/run-verify SIGNEDFILE with and without its new option --auto-key-retrieve and check in the trace stored in "out" whether --auto-key-retrieve was passed to gpg. Signed-off-by: Werner Koch <[email protected]>