aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: Silence newer compiler warnings.Werner Koch2018-12-173-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]>
* core: Fix ERR_INV_ARG check in genkey_startAndre Heinecke2018-12-071-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
* doc: Minor comment cleanups.Werner Koch2018-12-031-0/+2
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Fix format string errors in w32-io.c and use of TRACE_SUC.Werner Koch2018-11-191-19/+23
| | | | | | * src/w32-io.c: Fix use of TRACE_SUC. Fix some format strung errors. Signed-off-by: Werner Koch <[email protected]>
* core: Protect the trace macros for fun and profit.Werner Koch2018-11-1611-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]>
* core: Fix a LF problem in the new debug fucntion.Werner Koch2018-11-161-3/+6
| | | | | * src/debug.c (_gpgme_debug): Print a LF for an empty FORMAT unless we are in legacy mode.
* core: Fix format string errors in trace macrosWerner Koch2018-11-1611-29/+30
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Remove old debug helper functionWerner Koch2018-11-166-95/+59
| | | | | | | * src/debug.c (_gpgme_debug): Remove. (_gpgme_debugf): Rename to _gpgme_debug. Signed-off-by: Werner Koch <[email protected]>
* core: Simplify the trace maros by using variadics.Werner Koch2018-11-1645-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]>
* Add SPDX identifiers to most source filesWerner Koch2018-11-1675-1125/+1171
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* build: Make gpgme.m4 use gpgrt-config with *.pc.NIIBE Yutaka2018-11-121-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]>
* build: Provide gpgme-glib.pc too.NIIBE Yutaka2018-11-123-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]>
* build: Provide gpgme.pc, generated by configure.NIIBE Yutaka2018-11-123-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]>
* spelling: fix misspellingsDaniel Kahn Gillmor2018-11-0815-57/+57
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Avoid error diagnostics with --override-session-key.Werner Koch2018-11-051-1/+8
| | | | | | | | * src/engine-gpg.c (gpg_decrypt): Add --no-keyring. -- GnuPG-bug-id: 3464 Signed-off-by: Werner Koch <[email protected]>
* w32: Fix a few compiler warnings.Werner Koch2018-11-022-15/+15
| | | | | | | * src/debug.h (TRACE_SYSERR_NR): New. * src/w32-io.c: Fix compiler warnings. Signed-off-by: Werner Koch <[email protected]>
* w32: Log all errors from CloseHandle and WFSO in w32-io.Werner Koch2018-11-021-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]>
* w32: Don't use CloseHandle on an arbitrary integer.Werner Koch2018-11-021-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]>
* w32: Revamp the closing of system objects.Werner Koch2018-11-021-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]>
* core: Print a dump of the I/O data only at level 8.Werner Koch2018-11-023-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]>
* w32: Fix and improve CancelSynchronousIo use.Werner Koch2018-11-021-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]>
* w32: Use CancelSynchronousIo in destroy_reader.Werner Koch2018-11-013-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]>
* w32: Merge all the object tables of w32-io into one.Werner Koch2018-11-011-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]>
* w32: Remove unused arg from two functions.Werner Koch2018-10-311-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]>
* w32: Remove all support for WindowsCEWerner Koch2018-10-3114-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]>
* w32: Remove cruft in w32-io from WindowsME times.Werner Koch2018-10-311-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]>
* w32: Fix previous commit.Werner Koch2018-10-301-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]>
* core,w32: Fix memleak of tmp_name in w32-ioAndre Heinecke2018-10-291-0/+7
| | | | | | | * src/w32-io.c (_gpgme_io_spawn): Free tmp_name. -- GnuPG-Bug-Id: T4238
* core: Do not crash if CMS plaintext is ignoredAndre Heinecke2018-10-291-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.
* core: Fix segv in genkey when no endtag is provided.Werner Koch2018-10-181-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]>
* core: Return an error if NULL is provided for genkey's parms.Werner Koch2018-10-182-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]>
* doc: convert more links to equivalent https:// URLsDaniel Kahn Gillmor2018-10-181-1/+1
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: convert more http:// links to https://Daniel Kahn Gillmor2018-10-182-4/+4
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: use https:// for www.gnu.orgDaniel Kahn Gillmor2018-10-184-4/+4
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* core: Really remove CR from version output.Werner Koch2018-10-161-1/+1
| | | | | | | | * src/version.c (_gpgme_get_program_version): Fix test. -- Fixes-commit: 6bde056355796f15b6e6954372e87f349847515b Signed-off-by: Werner Koch <[email protected]>
* core: Add trust-model flagAndre Heinecke2018-10-093-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
* core: Ensure r_key init in gpgme_get_keyAndre Heinecke2018-10-091-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.
* Release 1.12.0gpgme-1.12.0Werner Koch2018-10-081-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]>
* core: Apply GPGME_EXPORT_MODE_NOUID also to keyserver exports.Werner Koch2018-10-051-0/+2
| | | | | | | * src/engine-gpg.c (export_common): Add keyserver-options to the send-keys commands. Signed-off-by: Werner Koch <[email protected]>
* core: add experimental GPGME_EXPORT_MODE_NOUID.Werner Koch2018-10-023-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]>
* python: Silence a few warnings.Werner Koch2018-09-201-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]>
* json: Remove subkey-algo from createkey command.Werner Koch2018-09-191-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]>
* estreams revisedBen McGinnes2018-09-082-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | * Egon Spengler was right, crossing the streams is bad. * Restored both src/gpgme.def and src/libgpgme.vers to use the estreams symbols without the leading underscore. * The new_from_estream() function added to lang/python/src/core.py and set to alias the new_from_stream() function remains. * Opted for the solution favouring Linux onthree main grounds: 1. Andre reported major problems with Windows as well, so the number of potentially affected systems would vastly increase. 2. All the BSDs and OS X have spent far more time and development work in order to accommodate the eccentricities of both Microsoft and the GNU Project (ref. GCC), so they're more likely to be able to cope with doing so again than the other way around. 3. If I really have to I can write a custom installer for OS X to try this and, if it fails, to then patch the two symbol entries and recompile from scratch. That said, I may not have to since it actually behaved during the most recent tests for this commit; into ten separate CPython installations and all five supported versions (standard source installs and OS X Framework installs for each version). Tested-by: Ben McGinnes <[email protected]> Signed-off-by: Ben McGinnes <[email protected]>
* estreams symbols for python bindingsBen McGinnes2018-09-022-1/+3
| | | | | | | | | | * It turns out that even though some platforms detect differing symbols for estreams, the two types do not appear to be in conflict. At least they don't from the BSD/OS X side of things. As a consequence both versions are now included. Tested-by: Ben McGinnes <[email protected]> Signed-off-by: Ben McGinnes <[email protected]>
* python bindings: estreams fixben/estreams-fixBen McGinnes2018-08-302-2/+2
| | | | | | | | | | | | * lang/python/src/core.py: Adjusted new_from_estream function to alias new_from_stream instead of fd. * fixed the _gpgme import errors introduced in commit 08cd34afb762975b0273575035dacf69449ef241 by changing the exported functions/types to match the inner module where all the work is done, rather than the outer one(s). Tested-by: Ben McGinnes <[email protected]> Signed-off-by: Ben McGinnes <[email protected]>
* json: Fix detached verifyAndre Heinecke2018-08-291-20/+23
| | | | | | | | | * src/gpgme-json.c (op_verify): Only create output and use it for clearsigned and opaque signed. -- Just passing output to gpgme_op_verify changes the behavior to no longer do a verify of the signature.
* json: Delete primary key if subkey gen failsAndre Heinecke2018-08-281-2/+22
| | | | | | | | | | | | * src/gpgme-json.c (op_delete): Delete primary key on subkey gen error. -- This can happen for example if the user cancels the pinentry to unlock the primary key when adding the subkey. To avoid an artifact of a pimary key without an encryption capable subkey we delete the created key and treat the whole operation as failed.
* json: Allow NULL request in encode and chunkAndre Heinecke2018-08-281-2/+1
| | | | | | | | | | | * src/gpgme-json.c (encode_and_chunk): Don't error on NULL request. -- This fixes the error that is passed when parthing the json object failed and request would be NULL. Instead of the JSON parser error it would otherwise report that encode and chunk failed.
* json: Do not put FILE_NAME into the verify result.Werner Koch2018-08-271-2/+1
| | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (verify_result_to_json): Remove "file_name". -- Having the file name in the verify result may lead developers to assume that the file name is covered by the signature. This is not the case and can easily be checked by hex-editing a signed message. We better don't output it at all. The same is true for the is_mime flag but that is anyway only an advisory and I can't see damage from a faulty one. Note that we keep file_name in gpgme's output for ABI stability and because some tools want to display meta information even if they are subject to tampering. This is similar to the non-encrypted subject in mails. Signed-off-by: Werner Koch <[email protected]>
* doc: Add warning that FILE_NAME is not part of the signed data.Werner Koch2018-08-271-2/+3
| | | | --