aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: Un-deprecate gpgme_data_rewind.Werner Koch2017-02-023-16/+16
| | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_data_rewind): Un-deprecate. * src/data-compat.c (gpgme_data_rewind): Move to ... * src/data.c (gpgme_data_rewind): here. -- That function is very convenient because it is required a lot with memory streams. It also documents the intention of the caller better than gpgme_data_seek with its addition parameters and the need to map system errors. Thus it does not make sense to make it a first class citizen again. Signed-off-by: Werner Koch <[email protected]>
* core: Move all deprecated stuff to the end of gpgme.h.Werner Koch2017-02-021-315/+315
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Cleanup gpgme_key_unref freesAndre Heinecke2017-02-011-17/+8
| | | | * src/key.c (gpgme_key_unref): Nowadays we assume free(NULL) is ok.
* core: Fix leakage of address for mail only uidsAndre Heinecke2017-02-011-9/+1
| | | | | | | | | | * src/key.c (gpgme_key_unref): Always free address if set. (_gpgme_key_append_name): Remove memory optimization for address. -- The check if address is not allocated would now be more complicated then just comparing it to email because email is set to address also when an email was not parsed from the user id.
* core: Improve mailbox only uid handlingAndre Heinecke2017-02-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | * src/key.c (_gpgme_key_append_name): Set email and remove name for uid only keys. -- If we have a name and no email but the name can be parsed as an address we now treat the address as email and remove the name. This fixes downstream users that rely on email to show email addresses and don't expilicity handle this case. E.g. A userid [email protected] was: uid->name = "[email protected]" uid->email = "" uid->address = "[email protected]" It is now: uid->name = "" uid->email = "[email protected]" uid->address = "[email protected]"
* core: Add new context flag "redraw".Werner Koch2017-01-314-1/+22
| | | | | | | | | | * src/context.h (struct gpgme_context): New field 'redraw_suggested'. * src/op-support.c (_gpgme_op_reset): Clear REDRAW_SUGGESTED. * src/progress.c (_gpgme_progress_status_handler): Set REDRAW_SUGGESTED. * src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Add "redraw". * tests/run-sign.c (main): Use it. Signed-off-by: Werner Koch <[email protected]>
* w32: Fix closing file descriptors.Justus Winter2017-01-231-2/+8
| | | | | | | | | * src/w32-io.c (writer): Only stop once the buffer is drained. (destroy_writer): Wait for the writers buffer to be drained. This aligns '_gpgme_io_close's behavior with close(2) and fclose(3). GnuPG-bug-id: 2881 Signed-off-by: Justus Winter <[email protected]>
* Fix changing options with gpgconf.Justus Winter2017-01-161-12/+54
| | | | | | | | | * src/engine-gpgconf.c (gpgconf_write): Connect a pipe to the child's stderr, and wait for it to be closed as an indication that gpgconf has exited. Also improve error handling. GnuPG-bug-id: 2881 Signed-off-by: Justus Winter <[email protected]>
* core: Always use runtime for gpgconf changesAndre Heinecke2017-01-022-2/+4
| | | | | | | | | | | | * src/engine-gpgconf.c (gpgconf_write): Add --runtime. * src/gpgme.h.in (gpgme_conf_opt_change): Document this behavior. -- If a tool uses GPGME for changing configuration values it needs a way to ensure that these changes take effect. Otherwise users may change and see config values and do not understand why they are not working.
* Fix gpg_addkey() to work with GPGME_CREATE_NOPASSWD as well.Ben Kibbey2016-12-311-0/+2
| | | | | | | | * src/engine-gpg.c (gpg_addkey): Pass --batch to gpg when GPGME_CREATE_NOPASSWD is set to fix pinentry without loopback mode. -- Signed-off-by: Ben Kibbey <[email protected]>
* Fix GPGME_CREATE_NOPASSWD without pinentry loopback.Ben Kibbey2016-12-271-0/+2
| | | | | | | | * src/engine-gpg.c(gpg_createkey): Pass --batch to gpg when GPGME_CREATE_NOPASSWD is set. -- Signed-off-by: Ben Kibbey <[email protected]>
* doc: Replace http: by https: in core source files.Werner Koch2016-11-1635-36/+36
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Do not leak the override session key to ps(1).Werner Koch2016-11-161-3/+29
| | | | | | | | | | | | | | * src/engine-gpg.c (struct engine_gpg): New field override_session_key. (gpg_release): Free that field. (gpg_decrypt): With gnupg 2.1.16 use --override-session-key-fd. * tests/run-decrypt.c (main): Fix setting over the override key. -- Note that this works only with gnupg 2.1.16 and later. Signed-off-by: Werner Koch <[email protected]>
* core: Implement context flag "override-session-key".Werner Koch2016-11-1513-56/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_ctx_flag): Add flags "export-session-key" and "override-session-key". (gpgme_get_ctx_flag): Ditto. (gpgme_set_export_session_keys): Remove. (gpgme_get_export_session_keys): Remove. * src/gpgme.def, src/libgpgme.vers: Remove them. * src/context.h (struct gpgme_context): Add field override_session_key. * src/decrypt-verify.c (decrypt_verify_start): Pass override_session_key value to the engine. * src/decrypt.c (decrypt_start): Ditto. * src/engine.c (_gpgme_engine_op_decrypt): Ditto. (_gpgme_engine_op_decrypt_verify): Ditto. * src/engine-backend.h (struct engine_ops): Extend DECRYPT and DECRYPT_VERIFY_START with override_session_key. * src/engine-uiserver.c (_uiserver_decrypt): Add stub arg override_session_key. (uiserver_decrypt): Ditto. (uiserver_decrypt_verify): Ditto. * src/engine-gpgsm.c (gpgsm_decrypt): Ditto. * src/engine-gpg.c (gpg_decrypt): Add arg override_session_key and set corresponding gpg option. * tests/run-decrypt.c (print_result): Print the session key if available. (main): Add options --export-session-key and --override-session-key. -- To keep the number of context manipulation functions at bay, this patches removes the just added gpgme_set_export_session_keys and gpgme_get_export_session_keys by flags for the generic context function. The patch also implements the --override-session-key feature. GnuPG-bug-id: 2754 Signed-off-by: Werner Koch <[email protected]>
* core: Add public function gpgme_get_ctx_flag.Werner Koch2016-11-154-33/+65
| | | | | | | | | | * src/gpgme.h.in (gpgme_get_ctx_flag): New. * src/gpgme.c (gpgme_set_ctx_flag): Move down the file and add a trace statement. (gpgme_get_ctx_flag): New. * src/gpgme.def, src/libgpgme.vers: Add new interface. Signed-off-by: Werner Koch <[email protected]>
* core: Enable extraction of session keys.Daniel Kahn Gillmor2016-11-1513-19/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_export_session_keys): New function. (gpgme_get_export_session_keys): New function. * src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key member. (gpgme_{set,get}_export_session_keys): Declare new functions. * src/libgpgme.vers, src/gpgme.def: Export new functions in shared object. * src/engine.h: (_gpgme_engine_op_decrypt) Add export_session_key parameter. (_gpgme_engine_op_decrypt_verify): Add export_session_key parameter. * src/engine-backend.h: (struct engine_ops): Change function pointer declarations to match. * src/context.h (struct gpgme_context): Add export_session_keys member. * src/decrypt.c (release_op_data): Free result.session_key. (_gpgme_decrypt_status_handler): Store a copy of the exported session key. (decrypt_start): Pass export_session_keys from the context. * src/decrypt-verify.c (decrypt_verify_start): Pass export_session_keys from context. * src/engine.c (_gpgme_engine_op_decrypt): Pass through export_session_key flag. (_gpgme_engine_op_decrypt_verify): Pass through export_session_key flag. * src/engine-gpg.c (gpg_decrypt): If export_session_key is set, add --export-session-key to argument list. * src/engine-gpgsm.c (gpgsm_decrypt): Ignore export_session_key for now, since gpgsm offers no such mechanism. * src/engine-uiserver.c (_uiserver_decrypt): If export_session_key is set, add --export-session-key flag to cmd. * doc/gpgme.texi: Document new functions and session_key member of decrypt_result_t. * doc/uiserver.texi: Add --export-session-key flag to DECRYPT command. -- gpg(1) documents session key export as useful for key escrow, and is rightly dubious of that use case. However, session key export is also useful in other use cases. Two examples from MUA development (where this functionality would be specifically useful to me right now): * If the MUA stores a local copy of the session key upon decrypting the message, it can re-decrypt the message without expensive asymmetric operations. When rendering a thread with dozens of encrypted messages, this can represent a significant speedup. * A user may have expired encryption-capable secret key material, along with many messages encrypted to that material. If she stores the session keys for those messages she wants to keep, she can destroy her secret key material and make any messages she has deleted completely unrecoverable, even to an attacker who gets her remaining secret keys in the future. This patchset makes a two specific implementation decisions that could have gone in different ways. I welcome feedback on preferred outcomes. 0) session key representation: we currently represent the session key as an opaque textual string, rather than trying to provide any sort of in-memory structure. While it wouldn't be hard to parse the data produced by gpg's --export-session-key, I chose to use the opaque string rather than lock in a particular data format. 1) API/ABI: i've added a member to gpgme_op_decrypt_result_t. This has the potential to cause an out-of-bound memory access if someone uses code compiled against the newer verision, but linked at runtime against an older version. I've attempted to limit that risk by documenting that users must verify gpgme_get_export_session_keys() before accessing this new struct member -- this means that code expecting this capability will require the symbol at link-time, and will refuse to link against older versions. Another approach to solving this problem would be to avoid modifying gpgme_op_decrypt_result_t, and to introduce instead a new function gpgme_op_session_key(), which could be called in the same places as gpgme_op_decrypt_result(). Depending on the representation of the session key, this might introduce new memory-management burdens on the user of the library, and the session key is certainly part of a decryption result, so it seemed simpler to go with what i have here. If anyone has strong preferences that these choices should be solved in a different way, i'm happy to hear them. Additionally, I note that i'm also still pretty unclear about how the "UI Server" fits into this whole ecosystem. In particular, I don't know whether it's kosher to just add an --export-session-key flag to the DECRYPT operation without actually having implemented it anywhere, but i don't see where i would actually implement it either :/ If this patch (or some variant) is adopted, i will supply another patch that permits offering a session key during decryption (e.g. "gpg --override-session-key"), but I wanted to get these implementation choices ironed out first. Gnupg-Bug-Id: 2754 Signed-off-by: Daniel Kahn Gillmor <[email protected]> On the concern of adding a new field to a structure: It may not be clearly documented but we don't expect that a user ever allocates such a structure - those result structure may only be created bu gpgme and are read-only for the user. Adding a new member constitutes a compatible ABI change and thus an older SO may not be used by code compiled with a header for the newer API. Unless someone tinkers with the build system, this should never happen. We have added new fields to result structure may times and I can't remember any problems. - wk
* w32: Fix build of w32-glibAndre Heinecke2016-11-141-3/+3
| | | | | | * src/Makefile.am (main_sources): Remove system_components_not_extra. (libgpgme_la_SOURCES): Add system_components_not_extra. (libgpgme_glib_la_SOURCES): Remove duplicated ath files.
* core: Non-zero values should set _armor, _textmode, and _online.Daniel Kahn Gillmor2016-11-111-3/+3
| | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_armor, gpgme_set_textmode, gpgme_set_offline): Ensure that non-zero values actually set the appropriate internal bit. -- The documentation for these functions says things like "disabled if YES is zero, and enabled otherwise", where YES is an integer. However, if you pass an even integer, it will be aliased back to 0 because the context member variables are declared as single bits. This should make the implementation match the documentation. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* core: Use better error code when using select with a too high fd.Werner Koch2016-11-101-2/+2
| | | | | | | | | | | | | | | * src/posix-io.c (_gpgme_io_select): Return EMFILE instead of EBADF. -- Also EBADF seem more correct, EMFILE (Too man open files) gives a clearer message to the user that there are somehow too many files open. The problem can be exhibited by running lots of threads, We should eventually move to poll but that would be a large change and so we better fix it with the planned migration of the I/O subsystem to libgpgrt (currently known as libgpg-error). Signed-off-by: Werner Koch <[email protected]>
* core: Detect unreadable keyrings.Werner Koch2016-11-101-2/+13
| | | | | | | | | | | | | * src/keylist.c (op_data_t): Add field keydb_search_err. (keylist_status_handler): Parse STATUS_ERROR into that var. (gpgme_op_keylist_next): Use that err instead of GPG_ERR_EOF. -- With a recent GnuPG version this allows to detect a keyring with wrong permissions (i.e. no read access). GPG_ERR_OPEN_KEYRING will be returned instead of GPG_ERR_EOF. Signed-off-by: Werner Koch <[email protected]>
* core: Use gpgrt locking for thread safenessAndre Heinecke2016-11-109-497/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Require libgpg-error 1.17. No longer check for pthread. * doc/gpgme.texi: Document removed neccessity for thread safe gpgme flavours. * src/sema.h (DEFINE_GLOBAL_LOCK), (DEFINE_STATIC_LOCK, INIT_LOCK, DECLARE_LOCK) (DESTROY_LOCK, LOCK, UNLOCK): Change to gpgrt equivalents. * src/posix-sema.c, src/w32-sema.c: Removed. * src/Makefile.am: Remove libpthread and Update accordingly. * src/ath.c, src/ath.h (ath_mutex_init) (ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Removed. * src/ath.h (ATH_MUTEX_INITIALIZER): Removed. * src/version.c (do_subsystem_inits): sema_subsystem_init is no longer required. * tests/gpg/Makefile.am: Add new threading tests. (t_thread1_LDADD, t_cancel_LDADD): Use just gpgme. * tests/gpg/t-thread-keylist-verify.c, tests/gpg/t-thread-keylist.c: New. * src/gpgme-config.in: Use -lgpgme for thread-model pthread. -- Using gpgrt locks instead of pthread locks removes the neccessity to link pthread directly to gpgme and have a different, thread safe flavor of gpgme. Now gpgme is thread-safe if the conditions mentioned in the doc are met. As the cpp bindings linked against libgpgme and not libgpgme-pthread this fixes threading problems with them. libgpgme-pthread is removed but gpgme-config still supports --thread=pthread for compatibility with find scripts.
* w32: Better protect the IO-system's fd_tableWerner Koch2016-11-091-12/+26
| | | | | | | | | | | | * src/w32-io.c (fd_table_lock): New. (new_fd): Lock allocation of a new slot. (release_fd): Lock deallocation of a slot. -- Note that we lock only the allocation but not the sanitiy checks we do further down in the code. Signed-off-by: Werner Koch <[email protected]>
* w32: Fix locating gpgconf on 64 bit systems.Werner Koch2016-11-041-2/+11
| | | | | | | | | | | | * src/w32-util.c (find_program_at_standard_place): Use access to check whether the binary is at CSIDL_PROGRAM_FILES before testing CSIDL_PROGRAM_FILESX86. -- Suggested-by: ticho Fixes-commit: a82e9b182f62966207cad0972be6fa284329a5a1 GnuPG-bug-id: 2814 Signed-off-by: Werner Koch <[email protected]>
* core: Add gpgme_op_query_swdb and helper.Werner Koch2016-11-0318-5/+441
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_query_swdb_result_t): New. (gpgme_op_query_swdb): New. (gpgme_op_query_swdb_result): New. * src/libgpgme.vers, src/gpgme.def: Add the two new functions. * src/queryswdb.c: New. * src/Makefile.am (main_sources): Add new file. * src/context.h (OPDATA_QUERY_SWDB): New. * src/engine-backend.h (struct engine_ops): Add field 'query_swdb'. Adjust all initializer. * src/engine.c (_gpgme_engine_op_query_swdb): New. * src/engine-gpgconf.c (parse_swdb_line): New. (gpgconf_query_swdb): New. (_gpgme_engine_ops_gpgconf): Register that function. * src/util.h (GPG_ERR_TOO_OLD): Define for older libgpg-error. (GPG_ERR_ENGINE_TOO_OLD): Ditto. * tests/run-swdb.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add new debug tool. Signed-off-by: Werner Koch <[email protected]>
* core: Make use of --homedir in gpgconf.Werner Koch2016-11-031-13/+45
| | | | | | | | | | * src/engine-gpgconf.c (struct engine_gpgconf): Add field 'version'. (have_gpgconf_version): New. (gpgconf_release): Free VERSION. (gpgconf_new): Set VERSION. (gpgconf_read, gpgconf_write): Use --homedir with recent gnupg. Signed-off-by: Werner Koch <[email protected]>
* core: New API functions gpgme_set_sender, gpgme_get_sender.Werner Koch2016-10-2512-20/+104
| | | | | | | | | | | | | | | | | | | | | | | * src/context.h (struct gpgme_context): Add field 'sender'. * src/gpgme.c: Include mbox-util.h. (gpgme_release): Free SENDER. (gpgme_set_sender): New. (gpgme_get_sender): New. * src/gpgme.def, src/libgpgme.vers: Add new functions. * src/engine-gpg.c (append_args_from_sender): New. (gpg_encrypt_sign, gpg_sign): Call append_args_from_sender. (gpg_verify): Add arg CTX. Call append_args_from_sender/ * src/engine-gpgsm.c (gpgsm_verify): Add dummy arg CTX. * src/engine-uiserver.c (uiserver_verify): Ditto. * src/engine.c (_gpgme_engine_op_verify): Add arg CTX. * src/verify.c (verify_start): Pass CTX to engine function. * tests/gpg/t-verify.c (main): Add some checks for new functions. * tests/run-sign.c (main): Add option --sender. * tests/run-verify.c (main): Ditto. Signed-off-by: Werner Koch <[email protected]>
* core: Fix w32 crash in find_program_in_dirAndre Heinecke2016-10-101-1/+1
| | | | | | | | * src/w32-util.c (find_program_in_dir): Fix call to _gpgme_strconcat. -- This fixes a crash introduced by dc39552d0 because it tried to concat a strlen.
* core: New helper function gpgme_addrspec_from_uid.Werner Koch2016-10-084-1/+27
| | | | | | | | * src/gpgme.h.in: Add gpgme_addrspec_from_uid. * src/gpgme.def, src/libgpgme.vers: Ditto. * src/mbox-util.c (gpgme_addrspec_from_uid): New. Signed-off-by: Werner Koch <[email protected]>
* Clarify licensingDaniel Kahn Gillmor2016-09-273-3/+3
| | | | | | | | | * src/b64dec.c, src/mbox-util.c, src/mbox-util.h: These three files are explicitly licensed under LGPL, but their comments suggest that details about the warranty can be found in the GPL. Adjust comments to refer to the correct license. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Fix spellingDaniel Kahn Gillmor2016-09-232-2/+2
| | | | | | | | | * lang/cpp/src/context.h, lang/qt/src/protocol.h, lang/qt/src/wkspublishjob.h, src/data-identify.c, src/engine-gpg.c: minor spelling cleanup. -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* w32: Silence some warnings about unused parameters.Werner Koch2016-09-221-0/+14
| | | | | | | * src/assuan-support.c (my_recvmsg, my_sendmsg, my_waitpid) (my_socketpair) [W32]: Mark unused parameters. Signed-off-by: Werner Koch <[email protected]>
* core: Fix error checking in _gpgme_mkstemp.Werner Koch2016-09-221-1/+3
| | | | | | | * src/w32-util.c (_gpgme_mkstemp): Fix error checking. (dlopen): Mark FLAGS as unused. Signed-off-by: Werner Koch <[email protected]>
* core: New helper function _gpgme_strconcat.Werner Koch2016-09-223-24/+77
| | | | | | | | | | | | | | | | | | | | | | * src/conversion.c: Include stdarg.h. (do_strconcat): New. (_gpgme_strconcat): New. * src/util.h: Provide fallback for GPGRT_ATTR_SENTINEL. (_gpgme_strconcat): New with sentinel. * src/w32-util.c (find_program_in_dir): Replace malloc and stpcpy by _gpgme_strconcat. (find_program_at_standard_place): Ditto. (_gpgme_set_default_gpg_name): Ditto. (_gpgme_set_default_gpgconf_name): Ditto. (_gpgme_mkstemp): Ditto. (_gpgme_set_override_inst_dir): Repalce malloc and strcpy by strdup. -- The function has been taken from gnupg/common/stringhelp.c and license changed to LPGLv2.1+. I am the original author of that code. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add option --exit-on-status-write-errorDaiki Ueno2016-09-221-0/+2
| | | | | | | | | | | | | | * src/engine-gpg.c (gpg_new): Add --exit-on-status-write-error if the engine version is latest enough to expect progress output from gpg. -- GnuPG-bug-id: 1415 Signed-off-by: Daiki Ueno <[email protected]> Changed the version test from the patch to use the newer have_gpg_version. Signed-off-by: Werner Koch <[email protected]>
* Release 1.7.0gpgme-1.7.0Werner Koch2016-09-212-2/+2
| | | | | | * configure.ac: Bump LT vesion to C26/A15/R0. Signed-off-by: Werner Koch <[email protected]>
* core: Remove moc artifactAndre Heinecke2016-09-192-62/+1
| | | | | | | | | | * src/moc_kdpipeiodevice.cpp: Removed. * src/Makefile.am (EXTRA_DIST): Remove moc_kdpipeiodevice.cpp. -- This file was overlooked in 58ed9c17 which removed the unused and obsolete w32-qt code. See lang/qt QIODeviceDataProvider which replaced kdpipeiodevice.
* core: Check for GPG_TTY as well as DISPLAY.Ben Kibbey2016-09-195-15/+67
| | | | | | | | | | | | | | * src/engine-assuan.c (llass_new): Update --ttyname from GPG_TTY. * src/engine-g13.c (g13_new): Ditto. * src/engine-gpg.c (gpg_new): Ditto. * src/engine-uiserver.c (uiserver_new): Ditto. * src/engine-gpgsm.c (gpgsm_new): Ditto. -- Useful when no DISPLAY is set and there is no attached terminal to the current process. Signed-off-by: Ben Kibbey <[email protected]>
* core: Document the version a function has been deprecated.Werner Koch2016-09-161-72/+76
| | | | | | | | | * src/gpgme.h.in (_GPGME_DEPRECATED): Change to take versio numbers for documentation. Change all places. (_GPGME_DEPRECATED_OUTSIDE_GPGME): Ditto. * lang/python/gpgme-h-clean.py: Adjust RE. Signed-off-by: Werner Koch <[email protected]>
* core: Map GPGME_STATUS_EOF to the empty string.Werner Koch2016-09-162-3/+2
| | | | | | | | * src/status-table.c (_gpgme_status_to_string): Return "" for EOF. * src/engine-gpg.c (read_status): Ditto. The old code accidently used GPGME_STATUS_EOF which is the integer 0 and neiteyr NULL nor a string. Signed-off-by: Werner Koch <[email protected]>
* core: Fix typos.Justus Winter2016-09-161-2/+2
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* core: Remove stub to try implementing gpg < 2.1 support for createkey.Werner Koch2016-09-161-27/+2
| | | | | | | * src/engine-gpg.c (gpg_createkey_legacy): Remove. (gpg_genkey): Remove call. Signed-off-by: Werner Koch <[email protected]>
* core: Fix setting og the verification result.Werner Koch2016-09-161-17/+2
| | | | | | | * src/verify.c (parse_new_sig): Proberly handle the RC in an ERRSIG status. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_interact, deprecate gpgme_op_edit.Werner Koch2016-09-156-15/+146
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_interact_cb_t): New. (GPGME_INTERACT_CARD): New. (gpgme_op_interact_start, gpgme_op_interact): New. * src/libgpgme.vers, src/gpgme.def: Add new functions. * src/edit.c (op_data_t): Rename fnc to fnc_old and change users. Add fnc. (edit_status_handler): Call old or new callback. (command_handler): Ditto. (interact_start): New. (gpgme_op_interact_start, gpgme_op_interact_start): New. * src/status-table.c (_gpgme_status_to_string): New. * tests/gpg/t-edit.c (edit_fnc): Rename to interact_fnc and change type of STATUS. Use gpgme_io_writen. (main): s/gpgme_op_edit/gpgme_op_interact/. -- This change will eventually allow us to remove all those status codes from gpgme.h. Signed-off-by: Werner Koch <[email protected]>
* core: Minor change of the gpgme_op_edit semantics.Werner Koch2016-09-155-9/+32
| | | | | | | | | | | | | | | | | | * src/edit.c (command_handler): Handle special error code. * src/engine-gpg.c (read_status): Ditto. * src/engine-gpgsm.c (status_handler): Ditto. * src/engine-uiserver.c (status_handler): Ditto. * src/util.h (GPG_ERR_FALSE): Define for older libgpg-error versions. -- An edit callback may now simply return GPG_ERR_FALSE to indicate that it did not handled the status code. GPGME will the do the appropriate action, which is to send an empty line. Note that it is highly unlikely that GPG_ERR_FALSE has ever been used by an application as return value from an edit interactor. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_tofu_policyWerner Koch2016-09-1416-2/+267
| | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_tofu_policy_start): New function. (gpgme_op_tofu_policy): New function. * src/libgpgme.vers, src/gpgme.def: Add new functions. * src/tofupolicy.c: New. * src/Makefile.am (main_sources): Add that file. * src/context.h (ctx_op_data_id_t): Add OPDATA_TOFU_POLICY. * src/engine.c (_gpgme_engine_op_tofu_policy): New. * src/engine-backend.h (engine_ops): Add funcptr 'tofu_policy'. Adjust all engine initializations. * src/engine-gpg.c (gpg_tofu_policy): New. (_gpgme_engine_ops_gpg): Register this function. * tests/run-tofu.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add it. Signed-off-by: Werner Koch <[email protected]>
* core: Defer implementation of gpgme_op_createkey with gpg < 2.1Werner Koch2016-09-141-0/+6
| | | | | | * src/engine-gpg.c (gpg_createkey_legacy): Mark unused variables. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_keysign.Werner Koch2016-09-1416-12/+371
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_keysign_start, gpgme_op_keysign): New. (GPGME_KEYSIGN_LOCAL): New. (GPGME_KEYSIGN_LFSEP): New. (GPGME_KEYSIGN_NOEXPIRE): New. * src/context.h (ctx_op_data_id_t): Add OPDATA_KEYSIGN. * src/keysign.c: New. * src/Makefile.am (main_sources): Add keysig. * src/libgpgme.vers, src/gpgme.def: Add gpgme_op_keysign_start. * src/engine.c (_gpgme_engine_op_keysign): New. * src/engine-backend.h (engine_ops): Add 'keysign' and adjust all engine initializers. * src/engine-gpg.c (_add_arg): Add args PREFIX and ARGLEN and change callers to set them. (add_arg_pfx): New. (add_arg_len): New. (gpg_keysign): New. (_gpgme_engine_ops_gpg): Set keysign to gpg_keysign. * tests/run-keysign.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add run-keysign. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_revuid.Werner Koch2016-09-146-13/+68
| | | | | | | | | | | | | * src/engine.h (GENKEY_EXTRAFLAG_REVOKE): New. * src/genkey.c (adduid_start): Rename to addrevuid_start. Add arg REVOKE and pass it as extraflags. Remove useless ARMOR extraflag. Adjust callers. (gpgme_op_revuid_start, gpgme_op_revuid): New. * src/gpgme.def, src/libgpgme.vers: Add them. * tests/run-genkey.c: Add option --revuid. Signed-off-by: Werner Koch <[email protected]>
* core: Change a parameter for the engine's genkey function.Werner Koch2016-09-146-23/+37
| | | | | | | | | | | | | | | * src/engine.h (GENKEY_EXTRAFLAG_ARMOR): New. * src/engine-backend.h (engine_ops): Rename USE_ARMOR in genkey to EXTRAFLAGS. * src/engine.c (_gpgme_engine_op_genkey): Ditto. * src/engine-gpg.c (gpg_createkey_from_param): Ditto and test the flags. (gpg_createkey_legacy): Ditto. (gpg_createkey): Ditto. (gpg_addkey): Ditto. (gpg_genkey): Ditto. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_adduid.Werner Koch2016-09-145-16/+135
| | | | | | | | | | | | | * src/genkey.c: Replace most error codes GPG_ERR_INV_VALUE by GPG_ERR_INV_ARG. (struct op_data_t): Add field UIDMODE. (genkey_status_handler): Use UIDMODE. (adduid_start): New. (gpgme_op_adduid_start, gpgme_op_adduid): New. * src/gpgme.def, src/libgpgme.vers: Add them. * tests/run-genkey.c: Add option --adduid. Signed-off-by: Werner Koch <[email protected]>