aboutsummaryrefslogtreecommitdiffstats
path: root/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-03-26core: Fix a strtoul to strtolAndre Heinecke1-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.
2019-03-25core, w32: Add hack to translate diag logger-fdAndre Heinecke1-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
2019-03-19core: Support GPGME_AUDITLOG_DIAG for gpgsm.Werner Koch1-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]>
2019-02-28json: Fix cosmetic error in the repl.Werner Koch1-1/+1
* src/gpgme-json.c (native_messaging_repl): Use correct var with sizeof. -- Signed-off-by: Werner Koch <[email protected]>
2019-02-27json: Limit recursion depthAndre Heinecke1-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
2019-02-19core,w32: Fix missing sentinel in dir name builder.Werner Koch1-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]>
2019-01-25json: Better use gpgme_freeWerner Koch1-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]>
2019-01-25json: Fix minor memory leaks.Werner Koch1-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]>
2018-12-17core: Silence newer compiler warnings.Werner Koch3-1/+5
* configure.ac: Add -Wno-format-truncation and -Wno-sizeof-pointer-div. * src/b64dec.c (_gpgme_b64dec_proc): Add fallthrough annotation. * src/cJSON.c (parse_string): Ditto. * src/gpgme-json.c (main): Ditto. -- gcc 8 enables a couple of new warnings. Some of them are useless for us. In particular: util.h:42:26: warning: division 'sizeof (char *) / sizeof (char)' does not compute the number of array elements [-Wsizeof-pointer-div] #define DIM(v) (sizeof(v)/sizeof((v)[0])) ^ trustlist.c:101:22: note: in expansion of macro 'DIM' if (strlen (p) == DIM(item->keyid) - 1) Which is a real standard way to use DIM, here the right hand side is equivalent to sizeof but nevertheless it is correct. Yes sir, we know C. The format string warnings I have seen were assuming that the time structure returns valued out of scope - but if the system is that broken, the s_n_printf catches this. Signed-off-by: Werner Koch <[email protected]>
2018-12-07core: Fix ERR_INV_ARG check in genkey_startAndre Heinecke1-1/+1
* src/genkey.c (gpgme_op_genkey_start): Fix check for parms. -- This fixes a regression introduced by: 174af15725d4989a840ff3098996cc8a0568f724 So that the error was triggered by usual args. GnuPG-Bug-Id: T4265
2018-12-03doc: Minor comment cleanups.Werner Koch1-0/+2
-- Signed-off-by: Werner Koch <[email protected]>
2018-11-19core: Fix format string errors in w32-io.c and use of TRACE_SUC.Werner Koch1-19/+23
* src/w32-io.c: Fix use of TRACE_SUC. Fix some format strung errors. Signed-off-by: Werner Koch <[email protected]>
2018-11-16core: Protect the trace macros for fun and profit.Werner Koch11-77/+114
* src/debug.h: Protect macros using. (_trace_err, _trace_sysres, _trace_syserr): New helper inline functions. Signed-off-by: Werner Koch <[email protected]>
2018-11-16core: Fix a LF problem in the new debug fucntion.Werner Koch1-3/+6
* src/debug.c (_gpgme_debug): Print a LF for an empty FORMAT unless we are in legacy mode.
2018-11-16core: Fix format string errors in trace macrosWerner Koch11-29/+30
-- Signed-off-by: Werner Koch <[email protected]>
2018-11-16core: Remove old debug helper functionWerner Koch6-95/+59
* src/debug.c (_gpgme_debug): Remove. (_gpgme_debugf): Rename to _gpgme_debug. Signed-off-by: Werner Koch <[email protected]>
2018-11-16core: Simplify the trace maros by using variadics.Werner Koch45-570/+550
* src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros and remove the TRACE_BEG1 et al. Change all users to always pass a format string. (TRACE): Ditto. * src/debug.c (_gpgme_debugf): New. * configure.ac <GCC>: Add -Wno-format-zero-length. -- This makes it easier for use to enable format checks. The zero-length format is required to allow for an empty format due to the comman problematic of __VA_ARGS__. Signed-off-by: Werner Koch <[email protected]>
2018-11-16Add SPDX identifiers to most source filesWerner Koch75-1125/+1171
-- Signed-off-by: Werner Koch <[email protected]>
2018-11-12build: Make gpgme.m4 use gpgrt-config with *.pc.NIIBE Yutaka1-10/+48
* src/gpgme.m4 (_AM_PATH_GPGME_CONFIG): Use gpgrt-config with gpgme.pc when possible. (AM_PATH_GPGME_GLIB): Likewise with gpgme-glib.pc. -- Keeping AM_PATH_GPGME_PTHREAD, as is, untouched. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-11-12build: Provide gpgme-glib.pc too.NIIBE Yutaka3-3/+17
* src/gpgme-glib.pc.in: New. * src/gpgme.pc.in (avail_lang): Remove. -- Provide gpgme-glib.pc for gpgme-glib library. The avial_lang information is no use because *.pc is for C. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-11-12build: Provide gpgme.pc, generated by configure.NIIBE Yutaka3-6/+27
* configure.ac: Generate src/gpgme.pc. * src/Makefile.am (pkgconfigdir, pkgconfig_DATA): New. (EXTRA_DIST): Add gpgme.pc.in. * src/gpgme.pc.in: New. * src/gpgme-config.in: Use variables. -- Some usages of gpgme-config is not compatible to pkg-config style; The --glib option and --thread option which affect the output by --cflags or --libs are not supported by gpgme.pc. gpgme-config's embedding information for gpg-error and libassuan at the build time of gpgme is considered inflexible than pkg-config style. It is now handled by dependency of gpgme.pc (Requires field). To use gpgme.pc, newer libgpg-error (>= 1.33) and libassuan (>= 2.5.3) are required, which provide gpg-error.pc and libassuan.pc respectively. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-11-08spelling: fix misspellingsDaniel Kahn Gillmor15-57/+57
Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-11-05gpg: Avoid error diagnostics with --override-session-key.Werner Koch1-1/+8
* src/engine-gpg.c (gpg_decrypt): Add --no-keyring. -- GnuPG-bug-id: 3464 Signed-off-by: Werner Koch <[email protected]>
2018-11-02w32: Fix a few compiler warnings.Werner Koch2-15/+15
* src/debug.h (TRACE_SYSERR_NR): New. * src/w32-io.c: Fix compiler warnings. Signed-off-by: Werner Koch <[email protected]>
2018-11-02w32: Log all errors from CloseHandle and WFSO in w32-io.Werner Koch1-49/+70
* src/w32-io.c (close_handle, _close_handle): New macro and function; use in place of all CloseHandle calls. (wait_for_single_object, _wait_for_single_object): Likewise. Signed-off-by: Werner Koch <[email protected]>
2018-11-02w32: Don't use CloseHandle on an arbitrary integer.Werner Koch1-1/+1
* src/assuan-support.c (my_waitpid): Do not close the PID = it is not a handle. -- At some time in the distant past we might have used the process object as pid which obviously required a close. However this was changed and so what we did here was to close an arbitrary handle (one which matches the pid). GnuPG-bug-id: 4237 Signed-off-by: Werner Koch <[email protected]>
2018-11-02w32: Revamp the closing of system objects.Werner Koch1-119/+261
* src/w32-io.c (hddesc_t): New. (reader_context_s, writer_context_s): Replace file_sock and file_hd by the hddesc_t hdd. (fd_table): Ditto. Add want_reader and want_writer. (hddesc_lock): New lock variable. (new_hddesc, ref_hddesc): New. (release_hddesc): New. (reader, writer): Call release_hddesc. (create_reader, create_writer): Change for new hddesc scheme. (destroy_reader, destroy_writer): Replace closing by a call to release_hddesc. (_gpgme_io_pipe): Change for new hddesc scheme. (_gpgme_io_close): Ditto. (_gpgme_io_dup): Ditto. Use want_reader and want_writer. (_gpgme_io_socket): Change for new hddesc scheme. -- GnuPG-bug-id: 4237 Signed-off-by: Werner Koch <[email protected]>
2018-11-02core: Print a dump of the I/O data only at level 8.Werner Koch3-7/+18
* src/debug.h (TRACE_SUC3): New. (TRACE_LOGBUFX): New. * src/posix-io.c: Use TRACE_LOGBUFX instead of TRACE_LOGBUF. * src/w32-glib-io.c: Ditto. -- This will also be changed for w32-io as part of another commit. Signed-off-by: Werner Koch <[email protected]>
2018-11-02w32: Fix and improve CancelSynchronousIo use.Werner Koch1-4/+6
* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Fix name of DLL and print trace info only on error. -- Fixes-commit: 63ba09b541dabbe838253926896e721cb9be564a Signed-off-by: Werner Koch <[email protected]>
2018-11-01w32: Use CancelSynchronousIo in destroy_reader.Werner Koch3-4/+41
* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): New. * src/w32-io.c (destroy_reader): Use it here. -- This has not been tested but should on Vista and later help to fix a possible hang. Signed-off-by: Werner Koch <[email protected]>
2018-11-01w32: Merge all the object tables of w32-io into one.Werner Koch1-264/+245
* src/w32-io.c (fd_table_size): New. Used in most places instead of the MAX_SLAFD constant. (reader_table, writer_table, notify_table): Merge them into ... (fd_table): this table. Chnage all affected code to take just one lock. Signed-off-by: Werner Koch <[email protected]>
2018-10-31w32: Remove unused arg from two functions.Werner Koch1-32/+47
* src/w32-io.c (find_reader, find_writer): Remove unused start_it arg. It is always passed as true. Change callers. Signed-off-by: Werner Koch <[email protected]>
2018-10-31w32: Remove all support for WindowsCEWerner Koch14-1103/+12
* configure.ac: Remove WindwosCE support. * contrib/: Remove all; it was only used for WindowsCE. * src/w32-ce.c, src/w32-ce.h: Remove files. * src/Makefile.am (system_components): Remove these files. * src/ath.c, src/ath.h: Remove W32CE support. * src/data-compat.c (gpgme_data_new_from_filepart): Ditto. (gpgme_data_new_from_file): Ditto. * src/debug.c (debug_init, _gpgme_debug): Ditto. * src/gpgme-tool.c (gpgme_server): Ditto. (main): Ditto. * src/priv-io.h: Do not include w32-ce.h. * src/util.h: Remove WindowsCE support. * src/w32-io.c: Ditto. * src/w32-util.c: Ditto. * src/debug.h (TRACE_SUC4): New. -- There is no more hardware to test our code, the support for Windows CE terminated along time ago. Note that our code worked only with the old WindowsCE with that overall system limit of 31 processes. Signed-off-by: Werner Koch <[email protected]>
2018-10-31w32: Remove cruft in w32-io from WindowsME times.Werner Koch1-29/+0
* src/w32-io.c (set_synchronize): Remove. (create_reader, create_writer): No need for set_synchronize. -- The set_synchronize dates back to 2001 at a time when I wrote the Windows support on WindowsME and Windows2000. Maybe this was required then due to bugs in that old NT or partly NT based Windows versions. Signed-off-by: Werner Koch <[email protected]>
2018-10-30w32: Fix previous commit.Werner Koch1-3/+2
* src/w32-io.c (_gpgme_io_spawn): Move freeing of TMP_NAME behind its use in an error handling. Signed-off-by: Werner Koch <[email protected]>
2018-10-29core,w32: Fix memleak of tmp_name in w32-ioAndre Heinecke1-0/+7
* src/w32-io.c (_gpgme_io_spawn): Free tmp_name. -- GnuPG-Bug-Id: T4238
2018-10-29core: Do not crash if CMS plaintext is ignoredAndre Heinecke1-3/+11
* src/engine-gpgsm.c (gpgsm_verify): Fix handling both plaintext and signed_text as NULL. -- Previously if plaintext was NULL and signed_text was NULL it would set MESSAGE_FD to NULL which resulted in a crash. Ignoring the plaintext of an opaque signature might make sense in some cases and engine-gpg handles it.
2018-10-18core: Fix segv in genkey when no endtag is provided.Werner Koch1-2/+6
* src/genkey.c (get_key_parameter): Provide a fallback ENDTAG. -- It would actually be more correct to return an error in this case but it is possible tha there are users who did not provide an endtag and out of luck they also didn't trigger a segv. GnuPG-bug-id: 4192 Signed-off-by: Werner Koch <[email protected]>
2018-10-18core: Return an error if NULL is provided for genkey's parms.Werner Koch2-3/+6
* src/debug.c (_gpgme_debug_buffer): Bail out of BUF is NULL. * src/genkey.c (gpgme_op_genkey): Do no deref a NULL in TRACE_LOGBUF. (gpgme_op_genkey_start): Ditto. Return an error if PARMS is NULL. -- This robustness patch should solve one part of GnuPG-bug-id: 4192 Signed-off-by: Werner Koch <[email protected]>
2018-10-18doc: convert more links to equivalent https:// URLsDaniel Kahn Gillmor1-1/+1
-- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-10-18doc: convert more http:// links to https://Daniel Kahn Gillmor2-4/+4
-- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-10-18doc: use https:// for www.gnu.orgDaniel Kahn Gillmor4-4/+4
-- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-10-16core: Really remove CR from version output.Werner Koch1-1/+1
* src/version.c (_gpgme_get_program_version): Fix test. -- Fixes-commit: 6bde056355796f15b6e6954372e87f349847515b Signed-off-by: Werner Koch <[email protected]>
2018-10-09core: Add trust-model flagAndre Heinecke3-0/+34
* src/context.h (gpgme_context): Extend with trust_model. * src/engine-gpg.c (engine_gpg): Extend with trust_model. (gpg_set_engine_flags): Take trust_model from context. (build_argv): Handle trust_model. (gpg_release): Free trust_model. * src/gpgme.c (gpgme_set_ctx_flag): Handle trust-model flag. (gpgme_release): Release trust-model. * doc/gpgme.texi: Document new flag for gpgme_set_ctx_flag. (Context Flags): New subsection for the context flags. * tests/run-keylist.c (show_usage, main): Add new --trust-model parameter. -- This gives a GPGME user fine grained control over the trust-model. Changing the trust model for only a single application depends on: GnuPG-Bug-Id: T4134 Maniphest Tasks: T4134 Differential Revision: https://dev.gnupg.org/D466
2018-10-09core: Ensure r_key init in gpgme_get_keyAndre Heinecke1-2/+3
* src/keylist.c (gpgme_get_key): Move r_key init above the first invalid value check. -- This fixes the case where someone passes an unitialized r_key and no fingerprint.
2018-10-08Release 1.12.0gpgme-1.12.0Werner Koch1-1/+1
* configure.ac: Bump core LT version to C32/A21/R0. Bump C++ LT version to C14/A8/R0. * lang/qt/tests/Makefile.am (CLEANFILES): Add reader status files. * Makefile.am (EXTRA_DIST): Add conf/whatisthis. Signed-off-by: Werner Koch <[email protected]>
2018-10-05core: Apply GPGME_EXPORT_MODE_NOUID also to keyserver exports.Werner Koch1-0/+2
* src/engine-gpg.c (export_common): Add keyserver-options to the send-keys commands. Signed-off-by: Werner Koch <[email protected]>
2018-10-02core: add experimental GPGME_EXPORT_MODE_NOUID.Werner Koch3-1/+10
* src/gpgme.h.in (GPGME_EXPORT_MODE_NOUID): New. * src/export.c (export_start): Adjust option check. * src/engine-gpg.c (export_common): Implement option. Signed-off-by: Werner Koch <[email protected]>
2018-09-20python: Silence a few warnings.Werner Koch1-2/+8
* src/gpgme.h.in: Obsolete "class" also for Python. * lang/python/gpgme.i: Silenece a swig warning. Silence a gcc warning. Signed-off-by: Werner Koch <[email protected]>
2018-09-19json: Remove subkey-algo from createkey command.Werner Koch1-82/+7
* src/gpgme-json.c (op_createkey): Remove subkey-algo param. (GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER): Fix typo. * lang/js/src/Keyring.js: Remove subkey-algo support. * lang/js/src/permittedOperations.js: Ditto. -- We do not want to expose details of the protocol's key generation and thus the subkey-algo does not make sense. Right now we support only the default and future-default algorithms. A user can configure them anyway using new-default-key-algo in gpg.conf. Eventually we may officially support a more flexible way of creating special structured OpenPGP keys but right now that is not part of the API. Signed-off-by: Werner Koch <[email protected]>