aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* src: Fix trace string.Justus Winter2016-05-251-1/+1
| | | | | | * src/data-compat.c (gpgme_data_new_from_file): Fix trace string. Signed-off-by: Justus Winter <[email protected]>
* api: Return Tofu info for signatures.Werner Koch2016-05-213-1/+259
| | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_tofu_policy_t): New. (gpgme_status_code_t): Add status codes for TOFU. (struct _gpgme_tofu_info, gpgme_tofu_info_t): New. (struct _gpgme_signature): Add field 'tofu'. * src/status-table.c (status_table): Add new codes. * src/verify.c: Include limits.h. (release_tofu_info): New. (release_op_data): Call that. (parse_tofu_user): New. (parse_tofu_stats): New. (parse_tofu_stats_long): New. (_gpgme_verify_status_handler): Handle TOFU status lines. * tests/run-verify.c (print_description): New. (print_result): print tofu info. Signed-off-by: Werner Koch <[email protected]>
* api: Add new context flag "raw-description".Werner Koch2016-05-212-2/+16
| | | | | | | * src/context.h (struct gpgme_context): Add field raw_description. * src/gpgme.c (gpgme_set_ctx_flag): New flag. Signed-off-by: Werner Koch <[email protected]>
* core: New functions to help parsing of status lines.Werner Koch2016-05-212-0/+56
| | | | | | | | * src/conversion.c (_gpgme_split_fields): New. (_gpgme_strtoul_field): New. -- Signed-off-by: Werner Koch <[email protected]>
* api: Add new function gpgme_set_ctx_flag.Werner Koch2016-05-1920-51/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_set_ctx_flag): New prototype. * src/gpgme.c (gpgme_set_ctx_flag): New. * src/gpgme.def, src/libgpgme.vers: Add new function. * src/context.h (struct gpgme_context): Add FULL_STATUS. * src/decrypt.c (_gpgme_decrypt_status_handler): Do not call the status callback if FULL_STATUS is set. * src/genkey.c (genkey_status_handler): Ditto. * src/passphrase.c (_gpgme_passphrase_status_handler): Ditto. * src/sign.c (_gpgme_sign_status_handler): Ditto. * src/engine-backend.h (struct engine_ops): Add SET_STATUS_CB and add adjust all definitions of that variable. * src/engine.c (_gpgme_engine_set_status_cb): New. * src/op-support.c (_gpgme_op_reset): Call this function. * src/engine-gpg.c (struct engine_gpg): Add fields MON_CB and MON_CB_VALUE. (gpg_set_status_cb): New. (_gpgme_engine_ops_gpg): Register that function. (read_status): Call the monitor callback. * src/engine-gpgsm.c (struct engine_gpgsm): Add fields MON_CB and MON_CB_VALUE. (_gpgme_engine_ops_gpgsm): Register that function. (gpgsm_assuan_simple_command): Change first arg to be an engine context and adjust call callers. Call the monitor callback. * src/engine-uiserver.c (struct engine_uiserver): Add fields MON_CB and MON_CB_VALUE. (_gpgme_engine_ops_uiserver): Register that function. (uiserver_assuan_simple_command): Change first arg to be an engine context and adjust call callers. Call the monitor callback. * tests/run-verify.c (status_cb): New. (print_result): Print algo names. (main): Add option --status. -- This new feature is mainly intended for bug tracking. Having access to the raw status lines might also be useful for applications, though. Signed-off-by: Werner Koch <[email protected]>
* api: Remove arbitrary restriction from gpgme_op_verify.Werner Koch2016-05-191-2/+0
| | | | | | | | | | | | | * src/verify.c (verify_start): Do not return GPG_ERR_INV_VALUES when when SIGNED_TEXT is not given. -- The original idea behind this restriction probably was that it is useless to verify a non-detached signatures without also returning the signed text. However, it is sometimes useful to just check the signature, for example to see who signed it. Signed-off-by: Werner Koch <[email protected]>
* Fix typo in compatibility declarationAndre Heinecke2016-05-181-1/+1
| | | | | | | | * src/op-support.c (GPG_ERR_SUBKEYS_EXP_REV): Change to GPG_ERR_SUBKEYS_EXP_OR_REV. -- This fixes the build with libgpg-error < 1.23
* Return dedicated error code for all subkeys expired or revoked.Werner Koch2016-05-176-15/+123
| | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_STATUS_KEY_CONSIDERED): New. (GPGME_SIGSUM_TOFU_CONFLICT): New. * src/status-table.c (KEY_CONSIDERED): New. * src/op-support.c (_gpgme_parse_inv_recp): Add argc KC_FPR and KC_FLAGS. Use calloc. Detect all expired or revoked subkeys. (_gpgme_parse_key_considered): New. * src/sign.c (op_data_t): Add fields KC_FPR and KC_FLAGS. (release_op_data): Free KC_FPR. (_gpgme_sign_status_handler): Handle STATUS_KEY_CONSIDERED. * src/encrypt.c (op_data_t): Add fields KC_FPR and KC_FLAGS. (release_op_data): Free KC_FPR. (_gpgme_encrypt_status_handler): Handle STATUS_KEY_CONSIDERED. Signed-off-by: Werner Koch <[email protected]>
* Merge branch 'gpgmepp'Andre Heinecke2016-05-105-1938/+2
|\
| * Remove obsolete w32-qt codeAndre Heinecke2016-03-085-1938/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (w32-qt): Remove option and Qt checks. * src/Makefile.am: Remove BUILD_W32_QT handling. * src/kdpipeiodevice.cpp, src/kdpipeiodevice.h, src/kdpipeiodevice.moc, src/w32-qt-io.cpp: Removed. -- This code was intended for Kleopatra but Kleopatra is not using it anymore. QGpgme/dataprovider is a better replacement for this.
* | Allow cc to detect missing cases in a switch.Werner Koch2016-05-101-2/+2
|/ | | | | | | * src/delete.c (delete_status_handler): Remove default case from a switch so that cc can check the use of all enum values. Signed-off-by: Werner Koch <[email protected]>
* Fix possible _SC_OPEN_MAX max problem on AIX.Werner Koch2016-01-151-0/+13
| | | | | | | | * src/posix-io.c [HAVE_STDINT_H]: Include stdint.h. (get_max_fds): Limit returned value for too high values. -- Signed-off-by: Werner Koch <[email protected]>
* w32: Avoid conflict with Mingw-w64 version 4.0.4-1Werner Koch2015-12-091-2/+2
| | | | | | | | | | | * src/w32-util.c (mkstemp): Rename to my_mkstemp. Change caller. -- For some reason the linker seems to use the mkstemp now provided by mingw instead of our static symbol. Strange. Reported-by: Andrej Kacian <[email protected]> Signed-off-by: Werner Koch <[email protected]>
* Return on user cancellation of delete operationDaiki Ueno2015-12-041-0/+32
| | | | | | | * src/delete.c (delete_status_handler): Return on ERROR status, if the error location is set to "delete_key.secret" and the code is either CANCELED or FULLY_CANCELED, which indicates a situation that the user selected "No" on the confirmation dialog.
* Fix typos found by codespell.Justus Winter2015-12-027-12/+12
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* Make use of user passphrase handler during passwd.Ben Kibbey2015-10-291-0/+8
| | | | | | | | * src/passwd.c (passwd_start): set engine passphrase command handler. -- This allows for inquiring a passphrase when changing a passphrase rather than requiring a pinentry.
* w32: Add extra diagnostic about possible missing gpgme-w32spawn.exe.Werner Koch2015-10-281-2/+7
| | | | | | * src/w32-io.c (_gpgme_io_spawn): Add a new diagnostic. Signed-off-by: Werner Koch <[email protected]>
* w32: Improve locating gpgconf on 64 bit systems.Werner Koch2015-10-281-2/+7
| | | | | | | * src/w32-util.c (find_program_at_standard_place): Fallback to CSIDL_PROGRAM_FILESX86. Signed-off-by: Werner Koch <[email protected]>
* w32: Add new global flag "w32-inst-dir".Werner Koch2015-10-284-1/+41
| | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_global_flag): Add flag "w32-inst-dir"; * src/posix-util.c (_gpgme_set_override_inst_dir): New stub. * src/w32-util.c (override_inst_dir): New var. (_gpgme_get_inst_dir): Return this var is set. (_gpgme_set_override_inst_dir): New. -- See https://lists.gnupg.org/pipermail/gnupg-devel/2015-September/030267.html for background. Signed-off-by: Werner Koch <[email protected]>
* cleanup: Fix type mismatch around gpgme_error_t.NIIBE Yutaka2015-10-162-2/+2
| | | | | | * src/data-compat.c (gpgme_error_to_errno): Use gpg_err_code to get error code from gpgme_error_t. * src/gpgme.c (gpgme_new): Don't use gpgme_error.
* gpgme-tool: Switch to argparse.c for option parsing.Werner Koch2015-08-314-491/+1862
| | | | | | | | | | | | | | * src/argparse.c, src/argparse.h: New. Taken from current gnupg. * src/Makefile.am (gpgme_tool_SOURCES): New. * src/gpgme-tool.c: Remove all argp.h stuff. (my_strusage): New. (main): Change to use argparse. -- As a GnuPG related tool the user should get the same experience in option parsing as with gpg et al. Thus we use the same parser. Signed-off-by: Werner Koch <[email protected]>
* Add gpgme_pubkey_algo_stringWerner Koch2015-08-306-29/+70
| | | | | | | | | | * src/gpgme.h.in (GPGME_PK_EDDSA): New. (gpgme_pubkey_algo_string): New. * src/conversion.c (_gpgme_map_pk_algo): Add new algo. * src/gpgme.c (gpgme_pubkey_algo_string): New. (gpgme_pubkey_algo_name): Reformat. Signed-off-by: Werner Koch <[email protected]>
* Make use of GPGRT macros is available.Werner Koch2015-08-261-12/+17
| | | | | | * src/gpgme.h.in (_GPGME_INLINE): Define using GPGRT_INLINE if possible. Fix problem with -Wundef by adding an extra "defined()". (_GPGME_GCC_VERSION): Define using GPGRT_ macro if possible.
* Avoid -Wundef warnings if gpgme.h is used by g++.Werner Koch2015-08-251-20/+24
| | | | | | | * src/gpgme.h.in (_GPGME_INLINE): Move definition into the extern-C-scope. Signed-off-by: Werner Koch <[email protected]>
* Relax ttyname_r error checksDaiki Ueno2015-08-255-29/+24
| | | | | | | | | | | | | | | | | * src/engine-assuan.c (llass_new): Don't treat ttyname_r error as fatal. * src/engine-g13.c (g13_new): Likewise. * src/engine-gpg.c (gpg_new): Likewise. * src/engine-gpgsm.c (gpgsm_new): Likewise. * src/engine-uiserver.c (uiserver_new): Likewise. -- Even though isatty() returns 1, ttyname_r() may fail in many ways, e.g., when /dev/pts is not accessible under chroot. Since all our uses of ttyname_r() require that the function works, we can treat the failure as if isatty() fails. Signed-off-by: Daiki Ueno <[email protected]>
* Cleanup layout of gpgme.hWerner Koch2015-08-252-167/+225
| | | | | | * src/gpgme.h.in: Reorder prototypes. Chnage some comments. Signed-off-by: Werner Koch <[email protected]>
* Improve error return by checking the FAILURE status.Werner Koch2015-08-2511-2/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_STATUS_FAILURE): New. * src/status-table.c (FAILURE): New. * src/op-support.c (_gpgme_parse_failure): New. * src/passphrase.c (_gpgme_passphrase_status_handler): Forward FAILURE status line to the status callback. * src/decrypt.c (op_data_t): Add field failure_code. (_gpgme_decrypt_status_handler): Parse that code and act upon it on EOF. * src/encrypt.c (op_data_t): Add field failure_code. (_gpgme_encrypt_status_handler): Parse that code and act upon it on EOF. * src/genkey.c (op_data_t): Add field failure_code. (genkey_status_handler): Parse that code and act upon it on EOF. * src/passwd.c (op_data_t): Add field failure_code. (passwd_status_handler): Parse that code and act upon it on EOF. * src/sign.c (op_data_t): Add field failure_code. (_gpgme_sign_status_handler): Parse that code and act upon it on EOF. * src/verify.c (op_data_t): Add field failure_code. (_gpgme_verify_status_handler): Parse that code and act upon it on EOF. -- This requires GnuPG 2.1.8 to actually make a difference. Signed-off-by: Werner Koch <[email protected]>
* Call status_cb for an ERROR status seen in the passphrase handler.Werner Koch2015-08-241-0/+12
| | | | | | | | | | * src/passphrase.c (_gpgme_passphrase_status_handler): Call status_cb. -- Frankly, we should have a more generic way of feeding the status_cb handler than our current ad-hoc method. Signed-off-by: Werner Koch <[email protected]>
* w32: Look for gpgconf in the new GnuPG 2.1 install dir.Werner Koch2015-08-241-6/+13
| | | | | | | * src/w32-util.c (_gpgme_get_gpgconf_path): Try another location of gpgconf.exe. Signed-off-by: Werner Koch <[email protected]>
* w32: Expect gpgme-w32spawn.exe only in the gpgme installation dir.Werner Koch2015-08-241-58/+65
| | | | | | | | | | | | | | | * src/w32-util.c (find_program_at_standard_place): Remove. (_gpgme_get_gpg_path): Make the search order more explicit. (_gpgme_get_gpgconf_path): Ditto. (_gpgme_get_w32spawn_path): Search only in the inst_dir. -- This tries to avoid possible unclear bug reports by removing the fallback to the current gpg4win installation directory for the gpgme helper. It is expected that users of gpgme installing their own gpgme version also install the matching helper. Signed-off-by: Werner Koch <[email protected]>
* w32: Print the installation directory in debug mode.Werner Koch2015-08-242-1/+15
| | | | | | | | | | * src/debug.c (debug_init) [W32]: Show libgpgme installation dir. -- I expect that gpgme will be distributed by applications and thus it will be helpful to see in the debug log which gpgme is actually used. Signed-off-by: Werner Koch <[email protected]>
* Add an export secret key feature.Werner Koch2015-08-245-16/+71
| | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_EXPORT_MODE_SECRET): New. (GPGME_EXPORT_MODE_RAW): New. (GPGME_EXPORT_MODE_PKCS12): New. * src/export.c (export_start, export_ext_start): Allow new flags. * src/engine-gpg.c (export_common): Support secret key export. * src/engine-gpgsm.c (gpgsm_export, gpgsm_export_ext): Ditto. * src/gpgme-tool.c (cmd_export): Add options --secret, --raw, and --pkcs12. * tests/run-export.c (main): Likewise. -- Note that exporting secret X.509 keys requires GnuPG 2.1.8. Signed-off-by: Werner Koch <[email protected]>
* Parse INQUIRE_MAXLEN in the passphrase callback.Ben Kibbey2015-08-161-3/+15
| | | | | | | | | | | * src/passphrase.c (_gpgme_passphrase_status_handler): Parse GPGME_STATUS_INQUIRE_MAXLEN. * src/passphrase.c (_gpgme_passphrase_command_handler): Send the INQUIRE_MAXLEN status message. -- Fixes passing this status message along when decrypting symmetric data from gpg.
* Fix gpgme_{get,set}_status_cb to match documentation.Ben Kibbey2015-08-151-1/+11
| | | | | | * doc/gpgme.texi: Minor fixes. * src/gpgme.c (gpgme_get_status_cb): Set return variables to NULL and check for a valid ctx pointer.
* Parse the INQUIRE_MAXLEN status message.Ben Kibbey2015-08-155-1/+27
| | | | | | | | | | | | * src/gpgme.h.in: (gpgme_status_code_t): Add INQUIRE_MAXLEN. * src/status-table.c (status_table_s): Ditto. * src/genkey.c (genkey_status_handler): Parse INQUIRE_MAXLEN. * src/decrypt.c (_gpgme_decrypt_status_handler): Ditto. * src/sign.c (_gpgme_sign_status_handler): Ditto. This status message informs the client of the maximum length of an inquired line. It is sent from gpg and forwarded to the client via gpgme_status_cb_t.
* Add gpgme_set/get_status_cb().Ben Kibbey2015-08-155-0/+56
| | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_set_status_cb): New. (gpgme_get_status_cb): New. (gpgme_status_cb_t): New. * src/gpgme.c (gpgme_set_status_cb): New. (gpgme_get_status_cb): New. * src/context.h (status_cb): New. (status_cb_value): New. * src/gpgme.def: Export new symbols. * src/libgpgme.vers: Ditto. * doc/gpgme.texi: Document these new functions. -- This callback function is used to forward status messages from gpg back to the client.
* Make use of user passphrase handler during genkey.Ben Kibbey2015-08-151-0/+8
| | | | | | | | | * src/genkey.c (genkey_start): set engine passphrase command handler. -- This allows for inquiring a new passphrase during key generation rather than requiring a pinentry. Needs a patch to gnupg to make use of --command-fd with --gen-key.
* Also check the return code in gpg_sign().Ben Kibbey2015-08-121-1/+1
| | | | * src/engine-gpg.c (gpg_sign): Check return value from start().
* Check the return value when starting gpg.Ben Kibbey2015-08-111-3/+3
| | | | | * src/engine-gpg.c (gpg_decrypt, gpg_delete, gpg_passwd): Check return value of start().
* Add offline mode support for CMS keylistingAndre Heinecke2015-07-3111-15/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/gpgme.texi: Document offline mode. * src/context.h (gpgme_context): Add offline. * src/engine-backend.h (keylist, keylist_ext): Add engine_flags. * src/engine.c, src/engine.h (_gpgme_engine_op_keylist): Ditto. (_gpgme_engine_op_keylist_ext): Ditto. * src/engine.h (GPGME_ENGINE_FLAG_OFFLINE): New. * src/engine-gpg.c (gpg_keylist, gpg_keylist_ext): Ditto. * src/engine-gpgsm.c (gpgsm_keylist): Handle engine_flags. (gpgsm_keylist_ext): Ditto. * src/gpgme.c (gpgme_set_offline, gpgme_get_offline): New. * src/gpgme.def (gpgme_set_offline, gpgme_get_offline): New. * src/gpgme.h.in (gpgme_set_offline, gpgme_get_offline): New. * src/libgpgme.vers (gpgme_set_offline, gpgme_get_offline): New. * src/keylist.c (gpgme_op_keylist_start): Set offline flag. (gpgme_op_keylist_ext_start): Ditto. * tests/run-keylist.c (show_usage, main): Add offline argument. -- The offline engine option was introduced with gpgsm 2.1.6 it is mainly useful for a full keylisting that includes the certificate validation but does not depend on external information that could take an indefinite amount of time to collect. Signed-off-by: Andre Heinecke <[email protected]>
* Add option --lib-version to gpgme-tool.Werner Koch2015-07-231-4/+23
| | | | | | * src/gpgme-tool.c (options, parse_options): Add --lib-version (CMD_LIBVERSION): New. (main): Implement.
* Fix regression with gpgsm 2.0 due to "OPTION with-secret".Werner Koch2015-06-081-16/+30
| | | | | | | | | | | | | | | | | | | * src/engine-gpgsm.c (gpgsm_assuan_simple_command): Do not terminate on a status lines. -- This bug has been with us since the support for gpgsm: If there is no status line handler but a status line is received anyway the command handling loop terminates and thus the command/answer order gets out of sync. In the case of the bug report this is triggered by sending an option which starts the agent and that starting emits a "PROGRESS" status line. The solution is not to stop reading after a status line but record a possible error code and return that only after OK or ERR. GnuPG-bug-id: 1795 Signed-off-by: Werner Koch <[email protected]>
* Fix compiler warnings about unused value in TRACE macros.Werner Koch2015-06-082-37/+45
| | | | | | | | | | | | | | * src/debug.h: Change macros to not have a literal 0 as last expression of the comma operator. * src/debug.c (_gpgme_debug_frame_end): Return 0. (_gpgme_debug): Return 0. -- Instead of using foo(), 0 for the trace macros we let foo() return 0 instead. Signed-off-by: Werner Koch <[email protected]>
* Set GPGME_SIGSUM_KEY_REVOKED also for gpg.Matthew Barnes2015-06-051-0/+7
| | | | | | | | | | | | * src/verify.c (calc_sig_summary): Handle GPG_ERR_CERT_REVOKED. -- parse_new_sig() handles a revoked key by setting sig->status to GPG_ERR_CERT_REVOKED, but then later calc_sig_summary() expects that code in sig->validity_reason. Additional comments added by wk.
* Fix segv for userids with a backslash.Werner Koch2015-06-051-0/+1
| | | | | | | | | | | * src/engine-gpg.c (gpg_keylist_preprocess): Increment SRC for a backslash. -- This bug is not exploitable because this bug fills up .data with backslashes and thus causes the segv. Signed-off-by: Werner Koch <[email protected]>
* w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.Werner Koch2015-04-131-4/+8
| | | | | | | | | | | | | | | | | | * src/Makefile.am (extra_ltoptions): New. (libgpgme_la_LDFLAGS): Use it. (libgpgme_pthread_la_LDFLAGS): Ditto. (libgpgme_glib_la_LDFLAGS): Ditto. -- Since gcc 4.8 there is a regression in Mingw64 in that plain C programs may link to libgcc_s.a which has a dependency on libgcc_s_sjlj.dll. This is for example triggered by using long long arithmetic on a 32 bit Windows (e.g symbol __udivdi3). Note that we don't use this patch for the Qt version which, as C++ programs, actually requires that DLL, Signed-off-by: Werner Koch <[email protected]>
* Fix potential crash in trace macro.Werner Koch2015-03-163-5/+3
| | | | | | | | | * src/signers.c (gpgme_signers_add): Avoid deref of a NULL KEY in the trace macro. * src/engine-spawn.c (engspawn_release): Remove always true condition. * src/engine-gpg.c (gpg_release): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Fix one byte too short malloc.Werner Koch2015-03-161-1/+1
| | | | | | | | | | | | | | * src/engine-spawn.c (add_data): Fix malloc -- Bummer. Why did I subtracted one from the size? Did I assume a dynamically allocated structure with a string field which was not going to be used? Very strange. Not a real problem though because malloc will anyway round up the allocation to at least the next word size. Detected by Stack 0.3.
* Return an error for some export key operations.Werner Koch2014-12-082-4/+127
| | | | | | | | | | | | | | | | * src/context.h (OPDATA_EXPORT): New. * src/export.c (op_data_t): New. (release_op_data): New. (parse_error): New. (export_status_handler): New. (export_start, export_ext_start): Prepare op_data. (gpgme_op_export_ext, gpgme_op_export_keys): Return an error from the status handler. -- To support an error return also for the async functions we need to extend the API. Until we have done that this new features helps at least in some cases; in particular for --send-keys.
* Update the previous commitWerner Koch2014-11-211-58/+54
| | | | | | | | | | | * src/sign.c (gpgme_op_sign_result): Reformat and take care of failed malloc. -- Although _gpgme_debug_trace() is current always true, the code should be run always and not just in trace mode. Also added error checking to malloc and strdup. And while at replace some while by for loop for easier readability.