aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: New function gpgme_op_revsig.Ingo Klöcker2020-10-2916-1/+300
| | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_revsig_start, gpgme_op_revsig): New. (GPGME_REVSIG_LFSEP): New. * src/context.h (ctx_op_data_id_t): Add OPDATA_REVSIG. * src/revsig.c: New. * src/Makefile.am (main_sources): Add revsig. * src/libgpgme.vers, src/gpgme.def: Add gpgme_op_revsig and gpgme_op_revsig_start. * src/engine.h, src/engine.c: (_gpgme_engine_op_revsig): New. * src/engine-backend.h (engine_ops): Add 'revsig' and adjust all engine initializers. * src/engine-gpg.c (gpg_revsig): New. (_gpgme_engine_ops_gpg): Set revsig to gpg_revsig. * doc/gpgme.texi: Document new functions. * tests/run-keysign.c: Add option --revoke. -- This extends GPGME to support the --quick-revoke-sig command added by GnuPG 2.2.24. This allows revoking key signatures. GnuPG-bug-id: 5094
* gpgsm: Fix leaked fd.NIIBE Yutaka2020-10-011-1/+1
| | | | | | | | | | | * src/engine-gpgsm.c (gpgsm_new): Close gpgsm->diag_cb.server_fd. -- GnuPG-bug-id: 5074 Reported by: VladislavGrudinin Fixes-commit: dd21ec997cf4b6ba18538c63c728478110ad1f60 Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Fully implement the inquire callback for assuan_transactWerner Koch2020-09-091-8/+17
| | | | | | | | | | | | | | | | | | | * src/engine-assuan.c (inquire_cb): Implement returning data. * tests/opassuan/t-command.c (inq_cb): Send some test data. -- The old code only allowed to send an empty response which was good enough for scdaemon's KNOWNCARDP inquire but not to send actual data. A quick test using a test smartcard might be ./t-command 'scd setattr --inquire PRIVATE-DO-1' and then reading the data back using gpg-connect-agent 'scd getattr PRIVATE-DO-1' /bye Signed-off-by: Werner Koch <[email protected]>
* core: Add error handling to setexpireIngo Klöcker2020-08-144-53/+195
| | | | | | | | | | | | | | | | | | | * src/genkey.c (setexpire, gpgme_op_setexpire_start, gpgme_op_setexpire): Move to ... * src/setexpire.c: New. * src/Makefile.am (main_sources): Add that file. * src/context.h (ctx_op_data_id_t): Add OPDATA_SETEXPIRE. * lang/qt/tests/t-various.cpp (testSetExpire): Test error handling. -- Errors (and failures) emitted via status-fd need to be handled explicitly, i.e. we need to provide an appropriate status handler with corresponding op_data_t. Additionally, we need to set a passphrase command handler if a passphrase callback is set in the context, e.g. during tests. GnuPG-bug-id: 4395
* core: New function gpgme_op_setexpire.Ingo Klöcker2020-08-0414-0/+147
| | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_setexpire_start, gpgme_op_setexpire): New. * src/libgpgme.vers, src/gpgme.def: Add new functions. * src/genkey.c (setexpire): New. (gpgme_op_setexpire_start, gpgme_op_setexpire): New. * src/engine.h, src/engine.c: (_gpgme_engine_op_setexpire): New. * src/engine-backend.h (engine_ops): Add 'setexpire' and adjust all engine initializers. * src/engine-gpg.c (gpg_setexpire): New. (_gpgme_engine_ops_gpg): Set setexpire to gpg_setexpire. * doc/gpgme.texi: Document new functions. * tests/run-genkey.c: Add option --setexpire. -- This extends GPGME to support the --quick-set-expire command added by GnuPG 2.1.22. This allows changing subkeys expiry date without going through the editinteractor interface. Co-authored-by: Andre Heinecke <[email protected]> GnuPG-bug-id: 4999
* core: Also allow GPGME_EXPORT_MODE_SSH for gpgme_op_export.Werner Koch2020-07-161-0/+1
| | | | | | | | | * src/export.c (export_start): Allow that mode. -- The test tools uses gpgme_op-export_ext and thus did not caught it. Signed-off-by: Werner Koch <[email protected]>
* core: New export mode to export as OpenSSH public key.Werner Koch2020-07-163-1/+12
| | | | | | | | | | | | * src/gpgme.h.in (GPGME_EXPORT_MODE_SSH): New. * src/export.c (export_ext_start): Allow for new mode. * src/engine-gpg.c (export_common): Implement. * tests/run-export.c (status_cb): New. (main): New options --status and --ssh. -- GnuPG-bug-id: 4310 Signed-off-by: Werner Koch <[email protected]>
* core: Deprecate the non-working trustlist functions.Werner Koch2020-07-1510-82/+13
| | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in: Clarify that the trustlist function should not be used. * src/engine.c (_gpgme_engine_op_trustlist): Always return an error. * src/engine-backend.h (struct engine_ops): Remove trustlist member. * src/engine-gpg.c (gpg_trustlist): Remove. (struct engine_ops): Remove that member. Also in all other engines. * tests/gpg/t-trustlist.c: Remove. * lang/python/tests/t-trustlist.py: Remove. -- This never worked in reality because the required feature has been removed from GnuPG version 1.3.2 soon after introduction of this feature in gpgme - 17 years ago. It was anyway marked as experimental. We keep the API and ABI, though. GnuPG-bug-id: 4834 Signed-off-by: Werner Koch <[email protected]>
* core: New keylist mode GPGME_KEYLIST_MODE_WITH_KEYGRIP.Werner Koch2020-07-153-1/+13
| | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_KEYGRIP): New. * src/gpgme-json.c (op_keylist): New flag "keygrip". * src/engine-gpg.c (gpg_keylist_build_options): Pass the options. * lang/cpp/src/global.h (WithKeygrip): New. * lang/cpp/src/context.cpp: Add check. * lang/cpp/src/key.cpp (Key::update): Handle WithKeygrip. * lang/cpp/src/verificationresult.cpp: Ditto. * lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Ditto. -- GnuPG-bug-id: 4939 Signed-off-by: Werner Koch <[email protected]>
* core: Fix setting of the chain_model signature result.Werner Koch2020-06-051-1/+1
| | | | | | | | | | | | | * src/verify.c (parse_trust): Fix detection of "chain" keyword. -- Fixes-commit: da6f3dc0c53f11f7432b3c258702db07d6c37f9a from 2007 shortly after introducing this. I doubt that this info has ever been used (it is for qualified signatures, which are only supported using the legacy German RegTP rules for them which were soon overturned by the commercial CAs). Signed-off-by: Werner Koch <[email protected]>
* w32: Explicitly link ws2_32Andre Heinecke2020-05-081-2/+3
| | | | | | | | | * src/Makefile.am (gpgme_w32_extra_libs): New. (libgpgme_la_LIBADD, libgpgme_glib_la_LIBADD): Use it. -- Since w32-io.c directly uses functions from ws2_32 it should not rely on libgpg-error to pull in this dependency.
* core: Make sure the keygrip is available in WITH_SECRET mode.Werner Koch2020-05-081-1/+4
| | | | | | | | | | | | | * src/engine-gpg.c (gpg_keylist_build_options): Send --with-keygrip if --with-secret is used. -- Since GnuPG 2.2.19 the keygrip was not anymore send if only --with-secret was used in a public key listing. Given that --with-secret requires computation of the keygrip anyway, there is no point in not requesting the keyrip in this case. GnuPG-bug-id: 4820
* build: Fix library dependency.NIIBE Yutaka2020-03-271-1/+1
| | | | | | | | | | | * src/Makefile.am (gpgme_tool_LDADD): Add @GPG_ERROR_LIBS@. -- Since gpgme-tool uses gpg_strerror, it should be linked to -lgpg-error. Signed-off-by: NIIBE Yutaka <[email protected]>
* core: New context flags "include-key-block" and "auto-key-import".Werner Koch2020-03-173-0/+44
| | | | | | | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_ctx_flag): Add flags "include-key-block" and "auto-key-import". (gpgme_get_ctx_flag): Ditto. * src/context.h (struct gpgme_context): Add flags include_key_block and auto_key_import. * src/engine-gpg.c (struct engine_gpg): Likewise. (gpg_set_engine_flags): Set the flags for gpg versions >= 2.2.20. (gpg_decrypt): Set option according to the new flags. (gpg_encrypt): Ditto. (gpg_encrypt_sign): Ditto. (gpg_sign): Ditto. (gpg_verify): Ditto. tests/run-verify: Add option --auto-key-import. tests/run-sign: add option --include-key-block. -- GnuPG-bug-id: 4856 Signed-off-by: Werner Koch <[email protected]>
* core: Add MacOS fallbacks to look for binariesAndre Heinecke2020-01-171-20/+49
| | | | | | | | | | | | | | | * src/posix-util.c (find_executable): New. (walk_path_str): Factored out from walk_path. (walk_path): Replaced by find_executable. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use find_executable. -- This should help to locate GnuPG on MacOS systems where it is not part of the PATH environment variable and should reduce the need to have fixed path known at GPGME compile time. mailvelope/issue699
* core: Extend gpgme_user_id_t with uidhash member.Werner Koch2019-12-133-0/+10
| | | | | | | | | | | | | | | | * src/gpgme.h.in (struct _gpgme_user_id): Add field 'uidhash'. * src/key.c (gpgme_key_unref): Free it. * src/keylist.c (keylist_colon_handler): Set it. * tests/run-keylist.c (main): Print it. -- The uidhash value is part of gpg's output since the year 2005. This now adds support to gpgme. The application for uidhash is to select a user id in an edit interactor: Instead of giving the number of the user id, the uidhash value can be be used to avoid tracking the user id numbers. Signed-off-by: Werner Koch <[email protected]>
* gpg: Avoid error diagnostics with --override-session-key when verifyingDaniel Kahn Gillmor2019-12-061-3/+6
| | | | | | | | | | | | | | | | * src/engine-gpg.c (gpg_decrypt): only send --no-keyring when we are not verifying. -- Without this change, the signature verification would fail. This problem was introduced in bded8ebc59c7fdad2617f4c9232a58047656834c in an attempt to avoid an error when *not* verifying. Clearly more test suite coverage is needed to avoid introducing this sort of problem in the future. GnuPG-bug-id: 3464 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpgme-tool: Fix help text for INCLUDE_CERTS.Daniel Kahn Gillmor2019-12-031-1/+1
| | | | | | * src/gpgme-tool.c (hlp_include_certs): added missing newline. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* core,w32: Silence compiler warnings.Werner Koch2019-11-271-2/+3
| | | | | | | * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Add some casts. -- Signed-off-by: Werner Koch <[email protected]>
* core: Fix parsing of userid sigs after a subpkgAndre Heinecke2019-10-291-2/+3
| | | | | | | | | | * src/keylist.c (keylist_colon_handler): Do not clear out the tmp_uid when a subpacket line is encountered. -- When the uid is cleared no more signatures following the subpacket are parsed, so we now no longer clear it when a subpacket is encountered.
* core: Add cert-notation support and extended-editAndre Heinecke2019-10-293-5/+33
| | | | | | | | | | | | | | | | | | | | | * src/context.h (gpgme_context): Add new flag for extended-edit. * src/engine-gpg.c (append_args_from_sig_notations): Add flags to control the kind of notations. (gpg_edit): Respect extended-edit and notations. (gpg_encrypt_sign, gpg_sign): Update call to append_args_from_sig_notations. * src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Support extended-edit. * NEWS, doc/gpgme.texi: Mention extended-edit. -- This provides a way to get the extended key-edit interface without breaking bad state machines that rely on the current command flow. A use case for this is to enable multiple local signatures, which can be used together with annotations for: GnuPG-Bug-Id: T4734
* core,w32: Initialize dbg_help for socket debuggingAndre Heinecke2019-10-281-1/+1
| | | | | | | | * src/w32-io.c (_gpgme_io_select): Initialize dbg_help. -- This fixes a crash on Windows because dbg_help might be used unitialized.
* core: Fix arg counting in enginge-gpgAndre Heinecke2019-07-161-4/+26
| | | | | | | | | | | | | | | | * src/engine-gpg.c (build_argv): Properly check for all arguments and allocate memory for them. -- This fixes a potential buffer overflow which could be created by using unusual and partially contradictory options. Like offline and auto-key-locate together while using ignore-mdc-error. As the list of arguments should not be user controlled the impact of this is very low. To ensure that this does not happen in the future an assert is also added with this patch.
* core: At debug levels up to 9 print only an ascii dump.Werner Koch2019-06-131-27/+59
| | | | | | | | | | | | * src/debug.c (_gpgme_debug_buffer): Switch between two output formats. -- The new format is much more practical than the bunch of hex digits followed by just 16 ascii chars. To get the old behaviour use a debug level of 10. Signed-off-by: Werner Koch <[email protected]>
* core: Add commented debug helper to posix-io.c.Werner Koch2019-06-061-21/+71
| | | | | | | | | | * src/posix-io.c (_gpgme_is_fd_valid): New out-commented function. -- This code is sometimes useful to track down invalid file descriptors. We keep it commented in the code. Signed-off-by: Werner Koch <[email protected]>
* core: Fix error return value of _gpgme_run_io_cb.Werner Koch2019-06-061-5/+8
| | | | | | | | | * src/wait.c (_gpgme_run_io_cb): Fix return code. -- The function needs to return an gpg_error_t and not ERRNO. Signed-off-by: Werner Koch <[email protected]>
* core: Prettify _gpgme_io_select debug output again and fix TRACE_SYSRES.Werner Koch2019-06-052-6/+18
| | | | | | | | | | | | * src/debug.c (_gpgme_debug): Take better care of NULL userinfo. (_gpgme_debug_end): Rework. (_trace_sysres): Print ERRNO and not the supplied RES. -- The TRACE_SYSRES patch fixes Regression-due-to: 7a1e7006d06fdbab86ea79a197c316744b09d933 Signed-off-by: Werner Koch <[email protected]>
* core: Improve the debug messages even more.Werner Koch2019-06-0518-140/+116
| | | | | | | | | | | | | | | * src/debug.c (_gpgme_debug): Add arg LINE. Chnage all callers. (_gpgme_debug_begin): Remove. * src/debug.h (TRACE_SEQ): Use the LINE arg of _gpgme_debug. -- This includes chnages to always print fds in decimal as weel as tweaking the TARCE_SEQ function to make use of the new machinery. The standard 'tag' can now always be NULL and no tag information will be printed. Signed-off-by: Werner Koch <[email protected]>
* core: Avoid explicit locks in the debug code.Werner Koch2019-06-051-46/+46
| | | | | | | | | | | | | | | | | * src/debug.c (debug_lock): Remove. Also remove all users. (_gpgme_debug): Use gpgrt_bsprintf to prepare the output and finally print using standard fprintf. Reformat to prefix to be narrower. -- Note that the locks are now implicitly done using the systems stdio. The threadid is now printed with 4 digits in hex and thus without the angle brackets and the 0x. However it is still a hex number even if it may look like an octal number. The hex letters are uppercase to make searching in locks easier iff the threadid happens to have a letter in it. Signed-off-by: Werner Koch <[email protected]>
* json: Print "nan", "-inf", "inf" if needed.Werner Koch2019-06-041-1/+7
| | | | | | | | * src/cJSON.c (print_number): Print NaN and INF. -- GnuPG-bug-id: 4328 Signed-off-by: Werner Koch <[email protected]>
* json: Improve handling of large exponents in the JSON parsor.Werner Koch2019-06-041-7/+33
| | | | | | | | | * src/cJSON.c: Include stdint.h. (parse_number): Avoid overflob in SUBSCALE and cap integer values. -- GnuPG-bug-id: 4330 Signed-off-by: Werner Koch <[email protected]>
* core: Implement recpstring option parsing for gpgsm.Werner Koch2019-06-042-16/+26
| | | | | | | | | | | | | | * src/engine-gpg.c (append_args_from_recipients_string): Detect bad options. * src/engine-gpgsm.c (set_recipients_from_string): Implement option parsing. -- The only option we actually implement is "--" but the code layout is now very simlar to engine-gpg and can easily be extended if ever needed. Signed-off-by: Werner Koch <[email protected]>
* core: Make gpgme_op_encrypt_ext work for CMS.Werner Koch2019-06-041-1/+1
| | | | | | | | | | | | | * src/engine-gpgsm.c (gpgsm_encrypt): Fix argument check. -- It is pretty obvious thar the string based new encrypt function has never been tested for S/MIME. The fix was easy. A followup patch will extend it to allow for keywords in the future. GnuPG-bug-id: 4556 Fixes-commit: a1f76b3b54b75a150fe272b804d85ffd40a507a6 Signed-off-by: Werner Koch <[email protected]>
* core: Fix duplication of close_notify_handler for gpgsm.NIIBE Yutaka2019-04-191-2/+0
| | | | | | | | | | | | | * src/engine-gpgsm.c [!USE_DESCRIPTOR_PASSING] (gpgsm_new): Remove last call to _gpgme_io_set_close_notify. -- It is called just after the code in question for all cases. GnuPG-bug-id: 4456 Fixes-commit: dd21ec997cf4b6ba18538c63c728478110ad1f60 Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Fix error return.NIIBE Yutaka2019-04-191-0/+1
| | | | | | * src/engine.c (_gpgme_set_engine_info): Add error return. Signed-off-by: NIIBE Yutaka <[email protected]>
* core,w32: Fix minor potential memleakAndre Heinecke2019-04-091-0/+2
| | | | | * src/w32-util.c (_gpgme_create_process_utf8): Free converted startup info strings.
* core,w32: Fix new w32-util functionsAndre Heinecke2019-04-091-3/+25
| | | | | | | | | | | | | | * src/w32-util.c (_gpgme_access): Respect mode parameter. (_gpgme_create_process_utf8): Convert startupinfo, too. -- This both did not show up in testing as we only use mode F_OK and STARTUPINFOA is basically the same as STARTUPINFOW. Fixes commit: a82e3a0ae57a48ba173e282a050680751006c074 GnuPG-Bug-Id: T4453
* core,w32: Improve handling of Unicode pathsAndre Heinecke2019-04-095-19/+128
| | | | | | | | | | | | | | | | | | | | | | * src/dirinfo.c (get_gpgconf_item): Use _gpgme_access. * src/posix-util.c (_gpgme_access): Add forward to normal access. * src/sys-util.h (_gpgme_access): New for posix and w32. * src/w32-io.c (_gpgme_io_spawn): Use _gpgme_crate_process_utf8. * src/w32-util.c (utf8_to_wchar, utf8_to_wchar0): The usual w32 conv. (find_program_in_dir): Use _gpgme_access. (find_program_at_standard_place): Use wchar API and convert to UTF-8. (_gpgme_access): Convert UTF-8 to wchar and use wchar API. (_gpgme_create_process_utf8): Convert UTF-8 to wchar and use wchar API. -- While we should not say that we have full support for unicode path installations of GnuPG, this ensures that GPGME works if GPGME itself is installed in a unicode path. e.g.: Libreoffice supports this. GnuPG-Bug-Id: T4453 Based on a patch provided by Egor Pugin. Thanks.
* core,w32: Show w32-spawn warning only onceAndre Heinecke2019-04-091-14/+19
| | | | | | | | | | * src/w32-io.c (_gpgme_io_spawn): Show MessageBox only once. -- This prevents multiple message boxes from showing when the GPGME installation is unworkable. GnuPG-Bug-Id: T4453
* core, w32: Fix format string errors on windowsAndre Heinecke2019-03-271-1/+8
| | | | | | | | | * src/debug.c (_gpgme_debug): Use gpgrt_vasprintf instead of vfprintf to have a more portable format. -- This fixes crashes on Windows because "%zu" is used which is not natively supported on Windows but which gpgrt supports.
* core: Fix assuan logger-fd hack for windowsAndre Heinecke2019-03-271-1/+1
| | | | * src/assuan-support.c (my_spawn): Zero is a perfectly fine fd.
* core,w32,glib: Fix build of w32-glib-io.cAndre Heinecke2019-03-261-7/+10
| | | | | * src/w32-glib-io.c (_gpgme_io_pipe, _gpgme_io_connect): Do not use TRACE_SUC in a return statement.
* core: Fix a strtoul to strtolAndre Heinecke2019-03-261-1/+1
| | | | | | | | | | * src/assuan-support.c (my_spawn): Fix using strtoul for a long. -- This was commented on in129def87b262 and is correct. It is signed here to better handle cases where an invalid handle value (-1) would be passed.
* core, w32: Add hack to translate diag logger-fdAndre Heinecke2019-03-251-5/+53
| | | | | | | | | | | | | | | | | * src/assuan-support.c (my_spawn): Add hack to mark the logger fd for w32spawn translation. -- The w32 spawn code needs to modify argv with an updated fd that matches the real id in the spawned process. It uses spawn_fd_item_s.arg_loc for that. We hack it here so that the arg_loc is set for gpgsm's logger-fd without changing the assuan API. GnuPG-Bug-Id: T4426
* core: Support GPGME_AUDITLOG_DIAG for gpgsm.Werner Koch2019-03-191-18/+114
| | | | | | | | | | | | | | | | * src/engine-gpgsm.c (struct engine_gpgsm): Add fields diag_cb and diagnostics. (close_notify_handler): Close the diag fd on status fd close. Handle diag close. (gpgsm_cancel): Handle diag. (gpgsm_release): Free DIAGNOSTICS. (gpgsm_new): Support the diag feature. (start): Set a handler for the diag fd. (gpgsm_getauditlog): Support GPGME_AUDITLOG_DIAG. -- Co-authored-by: Andre Heinecke <[email protected]> Signed-off-by: Werner Koch <[email protected]>
* json: Fix cosmetic error in the repl.Werner Koch2019-02-281-1/+1
| | | | | | | * src/gpgme-json.c (native_messaging_repl): Use correct var with sizeof. -- Signed-off-by: Werner Koch <[email protected]>
* json: Limit recursion depthAndre Heinecke2019-02-271-13/+41
| | | | | | | | | | | | | * src/cJSON.c (MAX_DEPTH): New. Maximum recursion depth. (parse_value, parse_array, parse_object): Carry and check depth argument. (cJSON_ParseWithOpts): Initialize depth. -- This fixes a stack overflow if we get weird recursive json data. GnuPG-Bug-Id: T4331
* core,w32: Fix missing sentinel in dir name builder.Werner Koch2019-02-191-1/+1
| | | | | | | | | | | | | * src/w32-util.c (_gpgme_get_gpgconf_path): Add NULL top strconcat. -- Fortunately this is called early and the stack like cleared out so that we have not seen wrong behaviour until now. We should really fix all these annoying HANDLE/int cast warnings and alike so that real bugs are not drowned by them. GnuPG-bug-id: 4369 Signed-off-by: Werner Koch <[email protected]>
* json: Better use gpgme_freeWerner Koch2019-01-251-1/+1
| | | | | | | | | | | * src/gpgme-json.c (subkey_to_json): here -- Avoid Windows ugliness of allowing different CRTs in the same process. Fixes-commit: 7f2423371964263784252cf839269023b6573bd2 Signed-off-by: Werner Koch <[email protected]>
* json: Fix minor memory leaks.Werner Koch2019-01-251-6/+14
| | | | | | | | | | * src/gpgme-json.c (interactive_repl): Fix memleak. (subkey_to_json): Ditto (op_config): Delay init of j_comps to avoid a leak on error. -- GnuPG-bug-id: 4341, 4342, 4343 Signed-off-by: Werner Koch <[email protected]>