aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* core: Make the refactored user event loop work.wk/new-waitWerner Koch2019-06-141-0/+7
| | | | | | | | | * src/wait.c (user_io_cb_handler): Set FD signaled. -- With this patch the regression test suite now passes. Signed-off-by: Werner Koch <[email protected]>
* core: Make the refactored global wait work.Werner Koch2019-06-144-39/+114
| | | | | | | | | | | | | | | | * src/fdtable.h (FDTABLE_FLAG_NOT_DONE): New flag. * src/fdtable.c (_gpgme_fdtable_io_cb_count): Rename to ... (_gpgme_fdtable_get_count): this and add arg 'flags'. (_gpgme_fdtable_run_io_cbs): Add return arg 'r_owner'. * src/wait.c (gpgme_wait_ext): Improve tracing. Act upon error codes from running the callbacks. * tests/gpg/t-wait.c (main): Remove the sleep. -- Now t-wait works again. There are still problems with the user defined events but it is another step in our refactoring work. Signed-off-by: Werner Koch <[email protected]>
* core: Use a better name for the internal synchronous wait.Werner Koch2019-06-1424-93/+68
| | | | | | | | | | | | * src/wait.c (_gpgme_wait_on_condition): Rename to ... (_gpgme_sync_wait): this. Small code refactoring. (_gpgme_wait_one, _gpgme_wait_one_ext): Remove and change all callers to use _gpgme_sync_wait. * src/fdtable.c (_gpgme_fdtable_run_io_cbs): Move TRACE up. -- Signed-off-by: Werner Koch <[email protected]>
* core: Refactor the wait code utilizing the new fdtable.Werner Koch2019-06-1315-939/+992
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/fdtable.c, src/fdtable.h: Largely extend. * src/wait-global.c, src/wait-private.c, src/wait-user.c: Remove and move code to ... * src/wait.c: here. (_gpgme_fd_table_init, fd_table_put): Remove. Do not call them. (_gpgme_add_io_cb, _gpgme_add_io_cb_user): Change to use the fdtable. (_gpgme_remove_io_cb, _gpgme_remove_io_cb_user): Ditto. (_gpgme_wait_global_event_cb): Ditto. (gpgme_wait_ext, _gpgme_wait_on_condition): Ditto. * src/wait.h (struct io_cb_tag_s): Add fields 'serial' and 'desc'. Change 'idx' to 'fd'. (struct fd_table): Remove. * src/context.h (struct gpgme_context): Remoce 'fdt'. Rename io_cbs to user_io_cbs for clarity. * src/engine-gpgsm.c: Unify trace output. (start): Pass a description along with the IO handlers. * src/priv-io.h (struct io_select_fd_s): Rename to io_select_s. (io_select_t): New. * src/gpgme.c (_gpgme_cancel_with_err): Replace arg 'ctx' by 'serial'. (gpgme_cancel): Adjust. -- This is the second part of a larger refactoring of the wait/event code. Does currently only work on Unix and with the private wait functions (i.e. the async operations don't yet work). Signed-off-by: Werner Koch <[email protected]>
* core: Use fully correct command args for gpg --verify.Werner Koch2019-06-121-0/+2
| | | | | | | | | | | | * src/engine-gpg.c (gpg_verify): Supply --verify for fixed gpg versions. -- With 2.1.something we print a warning if no explict command was given. Since 2.1.16 this has been fixed to also allow the combination of --verify and --output. Thus we now always use "--verify". Signed-off-by: Werner Koch <[email protected]>
* core: At debug levels up to 9 print only an ascii dump.Werner Koch2019-06-121-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: Improve code by using strconcat at two places.Werner Koch2019-06-121-22/+17
| | | | | | | | * src/engine-gpgsm.c (gpgsm_export): Use _gpgme_strconcat. (gpgsm_keylist): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
* core: Link all context objects and add _gpgme_get_ctx.Werner Koch2019-06-123-17/+91
| | | | | | | | | | | | | | | | | | * src/context.h (struct gpgme_context): Add field 'next_ctx'. * src/gpgme.c (def_lc_lock): Replace by ... (context_list_lock): new. (context_list): New variable. (gpgme_new): Add new context object to the list. (gpgme_release): Remove context object from the list. (_gpgme_get_ctx): New function. -- To allow mapping a context serial number back to a context object and to check whether a serialno has still a context object, we need to link them all together. We already take a lock to setup the locale and thus the only overhead is in freeing the context. Signed-off-by: Werner Koch <[email protected]>
* core: Introduce a context serial number.Werner Koch2019-06-073-97/+135
| | | | | | | | | | | | | | * src/context.h: Include stdint.h. (struct gpgme_context): Add field 'serial'. (CTXSERIAL): New. * src/gpgme.c: (last_ctx_serial): New. (gpgme_new): Set serial. * src/gpgme.c: Change trace calls to use the serial. * src/wait.c (_gpgme_add_io_cb): Ditto (_gpgme_remove_io_cb): Ditto. Signed-off-by: Werner Koch <[email protected]>
* core: Replace the posix close notify mechanism by a new generic one.Werner Koch2019-06-0713-148/+358
| | | | | | | | | | | | | | | | | | | * src/fdtable.c, src/fdtable.h: New. * src/posix-io.c (notify_table_item_s): Remove. (notify_table, notify_table_size, notify_table_lock): Remove. (_gpgme_io_pipe): Put new fds into the table. (_gpgme_io_dup): Ditto. (_gpgme_io_close): Replace notify stuff by a call to the fdtable. (_gpgme_io_set_close_notify): Remove. Change all callers to to use _gpgme_fdtable_add_close_notify. * src/Makefile.am (main_sources): Add new files. -- This is the first part or a larger change to unify the tracking of file descriptors. Right now this has only been implemented for Posix and thus the code will not yet build for Windows. Signed-off-by: Werner Koch <[email protected]>
* tests: Minor fix to run-threaded.c.Werner Koch2019-06-061-1/+5
| | | | | | | | | | * tests/run-threaded.c (random_data_close): Correct FD test. -- An invalid DS is -1 and not 0; this fix is for correctness and does not chnage anything in the real world. 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]>
* tests: Add option "allow-del" to run-threadedAndre Heinecke2019-06-061-0/+74
| | | | | | | | | | | | | | | * tests/run-threaded.c (main): Handle allow-del. (allow-del): New. Variable to allow deletion of keys. (import): Delete key after import if allow-del is set. (delete_impres): Delete keys from an import result. (delete_fpr): Delete a key by fingerprint. -- This is intended to test write access and locking of the keyring by repeatedly importing and deleting pubkeys. It is an option because it might cause keyring corruption etc. so it should be explicitly enabled.
* tests: Implement import in run-threadedAndre Heinecke2019-06-051-0/+36
| | | | | * tests/run-threaded.c (import): New. (do_data_op): Call it.
* 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]>
* tests: Use synced output for error in run-threadedAndre Heinecke2019-06-051-2/+2
| | | | * tests/run-threaded.c (do_data_op): Use synced out macro.
* tests: Avoid variable named the same as a macroAndre Heinecke2019-06-051-8/+8
| | | | | | | | * tests/run-threaded.c (decrypt, verify): Don't use a variable name that is also a macro. -- It just looks confusing and strange at first glance.
* tests,w32: Fix thread creation in run-threadedAndre Heinecke2019-06-051-2/+4
| | | | | * tests/run-threaded.c (create_thread): Check proper return value and not return value of CloseHandle.
* 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]>
* python: Fix typo in DecryptionError exception.NIIBE Yutaka2019-06-042-4/+6
| | | | | | | | | | | | * lang/python/src/errors.py (DecryptionError): Rename from DeryptionError. (UnsupportedAlgorithm): Use DecryptionError. -- GnuPG-bug-id: 4478 Reported-by: Jan Girlich Signed-off-by: NIIBE Yutaka <[email protected]>
* Add NEWS for 1.13.1Andre Heinecke2019-06-031-0/+22
| | | | | | * NEWS: Add news for 1.13.1 --
* python: Make EXTRA_DIST files explicitAndre Heinecke2019-05-065-6/+175
| | | | | | | | | | | | | | | * configure.ac: Configure new Makefiles. * lang/python/Makefile.am: Remove dirs from extra dist and use subdirs. * lang/python/examples/Makefile.am, lang/python/src/Makefile.am, lang/python/doc/Makefile.am: New. Files that list EXTRA_DIST files. -- This is similar to what lang/js does by explicitly listing the files. This ensures that we have clean distribution tarballs without accidentall additions that just lay in the directory. GnuPG-Bug-Id: T4481
* Python, doc: Minor style improvementAndre Heinecke2019-05-061-8/+9
| | | | | * lang/python/src/core.py (Context): Retab and shorten max line length.
* Merge remote-tracking branch 'origin/dkg/fix-T4276'Andre Heinecke2019-05-067-14/+64
|\
| * python: stop raising BadSignatures from decrypt(verify=True)dkg/fix-T4276Daniel Kahn Gillmor2019-05-032-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/core.py (decrypt): filter out signatures with errors from the returned verify_result, but avoid raising BadSignatures * tests/t-decrypt-verify.py: ensure that only a single signature is returned when evaluating cipher-3.asc, since the other signature is unknown. -- This change preserves the invariant that decrypt() only ever returns valid signatures in the verify_result, but it avoids unnecessary errors in the face of the presence of an additional bad signature. GnuPG-bug-id: 4276 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
| * python/tests: try to decrypt and verify new test dataDaniel Kahn Gillmor2019-05-032-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lang/python/tests/t-decrypt.py: test decryption of cipher-3.asc and cipher-no-sig.asc * lang/python/tests/t-decrypt-verify.py: test decryption and verification of cipher-3.asc and cipher-no-sig.asc -- note that this introduces a failed test -- decrypt-verify.py misbehaves on cipher-3.asc by throwing a BadSignature even though GnuPG-bug-id: 4276 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
| * tests: add two new types of encrypted dataDaniel Kahn Gillmor2019-05-033-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/gpg/cipher-3.asc: add an encrypted file containing signatures (one from a known key, and one from an unknown key) * tests/gpg/cipher-no-sig.asc: add an encrypted file containing no signatures at all -- We currently aren't using these files yet, but they should be useful for exercising the library in unusual circumstances (where the bugs are). Signed-off-by: Daniel Kahn Gillmor <[email protected]>
| * python: make it easier to run a limited number of testsDaniel Kahn Gillmor2019-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lang/python/tests/Makefile.am: prefer py_tests from the environment if present. -- I'm trying to make it nicer/quicker to hack on the testsuite for python bindings. With this change, if you're improving the python bindings test suite, you can selectively run only a few specific tests like so: lang/python$ make check py_tests='t-decrypt.py t-decrypt-verify.py' Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* | Always use maintainer mode -Wno cflagsAndre Heinecke2019-05-031-15/+18
| | | | | | | | | | | | | | | | | | | | * configure.ac (CFLAGS): Move -Wno flags out of the maintainer mode. -- It makes sense to have more warnings in maintainer mode and not more warnings in release builds. GnuPG-Bug-Id: T4477
* | cpp: Fix initialization warningAndre Heinecke2019-05-031-1/+1
|/ | | | | * lanc/cpp/src/gpggencardkeyinteractor.cpp (GpgGenCardKeyInteractor::Private): Fix initialization warning.
* tests: Add cms mode to run-importAndre Heinecke2019-05-021-2/+15
| | | | | * tests/run-import.c (show_usage): Add doc for cms / openpgp. (main): Handle protocol.
* cpp: Add wrapper for gpgme_set_global_flagAndre Heinecke2019-04-243-0/+11
| | | | | | | | * lang/cpp/src/context.cpp (setGlobalFlag): New. * lang/cpp/src/global.h (setGlobalFlag): Export it. -- GnuPG-Bug-Id: T4471
* 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.
* Post release updates.Werner Koch2019-03-262-1/+5
| | | | --
* Release GPGME 1.13.0gpgme-1.13.0Werner Koch2019-03-263-9/+51
| | | | | | | | | * configure.ac: Bump LT versions. For C to C33/A22/R0. For C++ to C15/A9/R0. For Qt to C10/A3/R3. Signed-off-by: Werner Koch <[email protected]>
* 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.