gpgme.git
2 years agopython: Share generated methods between objects. justus/pyme3
Justus Winter [Thu, 12 May 2016 16:29:04 +0000 (18:29 +0200)]
python: Share generated methods between objects.

* lang/python/pyme/util.py (GpgmeWrapper.__getattr__): Monkey-patch
the class.
* lang/python/tests/t-wrapper.py: Demonstrate the sharing.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Raise exceptions on write errors.
Justus Winter [Thu, 12 May 2016 16:00:16 +0000 (18:00 +0200)]
python: Raise exceptions on write errors.

* lang/python/pyme/core.py (Data.write): Handle errors.
* lang/python/pyme/errors.py (GPGMEError.fromSyserror): New function.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Fix writing to data buffers.
Justus Winter [Thu, 12 May 2016 15:44:54 +0000 (17:44 +0200)]
python: Fix writing to data buffers.

* lang/python/gpgme.i: Add typemap for buffers.
* lang/python/pyme/core.py (Data.write): Fix function.
* lang/python/tests/Makefile.am: Add new test.
* lang/python/tests/t-data.py: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Add a test suite.
Justus Winter [Thu, 12 May 2016 13:27:50 +0000 (15:27 +0200)]
python: Add a test suite.

* configure.ac: Add new Makefile.
* lang/python/Makefile.am: Add subdirectory.
* lang/python/tests/Makefile.am: New file.
* lang/python/tests/t-wrapper.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Cache generated wrapper functions.
Justus Winter [Thu, 12 May 2016 12:57:42 +0000 (14:57 +0200)]
python: Cache generated wrapper functions.

* lang/python/util.py (GpgmeWrap.__getattr__): Cache generated wrapper
functions.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Fix function invocation.
Justus Winter [Thu, 12 May 2016 10:54:15 +0000 (12:54 +0200)]
python: Fix function invocation.

* lang/python/pyme/core.py (Data.new_from_fd): Fix function
invocation.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Fix name of exception, make slot methods explicit.
Justus Winter [Thu, 12 May 2016 10:51:30 +0000 (12:51 +0200)]
python: Fix name of exception, make slot methods explicit.

* lang/python/pyme/util.py (GpgmeWrapper._getctype): Fix exception,
add docstring.
(GpgmeWrapper._getnameprepend): New function.
(GpgmeWrapper._errorcheck): Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Handle interpreter shutdown.
Justus Winter [Thu, 12 May 2016 09:53:43 +0000 (11:53 +0200)]
python: Handle interpreter shutdown.

* lang/python/pyme/core.py: Avoid races at interpreter shutdown.  This
silences the most annoying occurrences, however this problem also
affects the SWIG generated code, which might indicate that the real
problem is somewhere else.  If so, this change can be easily reverted.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Make test case more robust.
Justus Winter [Thu, 12 May 2016 09:51:21 +0000 (11:51 +0200)]
python: Make test case more robust.

* lang/python/examples/t-edit.py: Check if key is found.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Fix type translation.
Justus Winter [Thu, 12 May 2016 09:21:58 +0000 (11:21 +0200)]
python: Fix type translation.

* lang/python/gpgme.i: Adjust to Python3's string type being
'Unicode', not 'bytes'.  Fix type checking.
* lang/python/core.py (Data.write): Add docstring mentioning the
expected type of parameter 'buffer'.
(Data.read): Adjust read loop.  Also, use a saner chunk size, and join
all chunks at the end instead of adding them.
* lang/python/examples/simple.py: Adjust example.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Fix simple example.
Justus Winter [Wed, 11 May 2016 11:51:40 +0000 (13:51 +0200)]
python: Fix simple example.

* lang/python/examples/simple.py: Flush stdout, encode name as
UTF-8 before passing it to GPGME.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Integrate into the build system.
Justus Winter [Wed, 11 May 2016 09:42:00 +0000 (11:42 +0200)]
python: Integrate into the build system.

* configure.ac: Make Python bindings configurable, add new Makefile.
* lang/python/Makefile.am: New file.
* lang/python/setup.py: Integrate into the build system.
* m4/ax_pkg_swig.m4: New file from the autoconf archive.
* m4/m4_ax_swig_python.m4: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: PEP8 fixes.
Justus Winter [Tue, 10 May 2016 12:45:44 +0000 (14:45 +0200)]
python: PEP8 fixes.

Cherry picked from 0267c151.

Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Delete trailing whitespace.
Justus Winter [Tue, 10 May 2016 11:30:30 +0000 (13:30 +0200)]
python: Delete trailing whitespace.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Drop Debian packaging.
Justus Winter [Tue, 10 May 2016 11:21:34 +0000 (13:21 +0200)]
python: Drop Debian packaging.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agopython: Rename bindings.
Justus Winter [Tue, 10 May 2016 11:19:26 +0000 (13:19 +0200)]
python: Rename bindings.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
2 years agoMerge branch 'master' into justus/pyme3
Justus Winter [Tue, 10 May 2016 11:03:34 +0000 (13:03 +0200)]
Merge branch 'master' into justus/pyme3

2 years agoAllow cc to detect missing cases in a switch.
Werner Koch [Tue, 10 May 2016 08:27:54 +0000 (10:27 +0200)]
Allow cc to detect missing cases in a switch.

* 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 <wk@gnupg.org>
2 years agoFix possible _SC_OPEN_MAX max problem on AIX.
Werner Koch [Fri, 15 Jan 2016 15:16:38 +0000 (16:16 +0100)]
Fix possible _SC_OPEN_MAX max problem on AIX.

* 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 <wk@gnupg.org>
2 years agow32: Avoid conflict with Mingw-w64 version 4.0.4-1
Werner Koch [Wed, 9 Dec 2015 10:39:26 +0000 (11:39 +0100)]
w32: Avoid conflict with Mingw-w64 version 4.0.4-1

* 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 <andrej@kacian.sk>
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoReturn on user cancellation of delete operation
Daiki Ueno [Mon, 9 Nov 2015 04:13:50 +0000 (13:13 +0900)]
Return on user cancellation of delete operation

* 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.

2 years agodoc: Fix minor errors
Daiki Ueno [Fri, 4 Dec 2015 08:55:09 +0000 (17:55 +0900)]
doc: Fix minor errors

* doc/gpgme.texi: Fix errors and typos in the cancellation and
gpgme_import_result_t documentation.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoFix typos found by codespell.
Justus Winter [Wed, 2 Dec 2015 10:28:07 +0000 (11:28 +0100)]
Fix typos found by codespell.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoMake use of user passphrase handler during passwd.
Ben Kibbey [Wed, 28 Oct 2015 22:16:27 +0000 (18:16 -0400)]
Make use of user passphrase handler during passwd.

* 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.

2 years agow32: Add extra diagnostic about possible missing gpgme-w32spawn.exe.
Werner Koch [Wed, 28 Oct 2015 15:27:49 +0000 (16:27 +0100)]
w32: Add extra diagnostic about possible missing gpgme-w32spawn.exe.

* src/w32-io.c (_gpgme_io_spawn): Add a new diagnostic.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agow32: Improve locating gpgconf on 64 bit systems.
Werner Koch [Wed, 28 Oct 2015 15:26:03 +0000 (16:26 +0100)]
w32: Improve locating gpgconf on 64 bit systems.

* src/w32-util.c (find_program_at_standard_place): Fallback to
CSIDL_PROGRAM_FILESX86.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agow32: Add new global flag "w32-inst-dir".
Werner Koch [Wed, 28 Oct 2015 15:24:30 +0000 (16:24 +0100)]
w32: Add new global flag "w32-inst-dir".

* 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 <wk@gnupg.org>
2 years agocleanup: Fix type mismatch around gpgme_error_t.
NIIBE Yutaka [Fri, 16 Oct 2015 00:51:42 +0000 (09:51 +0900)]
cleanup: Fix type mismatch around gpgme_error_t.

* 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.

2 years agogpgme-tool: Switch to argparse.c for option parsing.
Werner Koch [Mon, 31 Aug 2015 18:33:44 +0000 (20:33 +0200)]
gpgme-tool: Switch to argparse.c for option parsing.

* 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 <wk@gnupg.org>
2 years agoAdd gpgme_pubkey_algo_string
Werner Koch [Sun, 30 Aug 2015 17:04:44 +0000 (19:04 +0200)]
Add gpgme_pubkey_algo_string

* 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 <wk@gnupg.org>
2 years agoPost release updates
Werner Koch [Wed, 26 Aug 2015 08:16:39 +0000 (10:16 +0200)]
Post release updates

--

2 years agoRelease 1.6.0 gpgme-1.6.0
Werner Koch [Wed, 26 Aug 2015 07:28:32 +0000 (09:28 +0200)]
Release 1.6.0

* configure.ac: Set LT version to C25/A14/R0.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoMake use of GPGRT macros is available.
Werner Koch [Wed, 26 Aug 2015 07:16:36 +0000 (09:16 +0200)]
Make use of GPGRT macros is available.

* 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.

2 years agoAvoid -Wundef warnings if gpgme.h is used by g++.
Werner Koch [Tue, 25 Aug 2015 19:04:15 +0000 (21:04 +0200)]
Avoid -Wundef warnings if gpgme.h is used by g++.

* src/gpgme.h.in (_GPGME_INLINE): Move definition into the
extern-C-scope.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoAdd configure option --enable-build-timestamp.
Werner Koch [Tue, 25 Aug 2015 18:40:06 +0000 (20:40 +0200)]
Add configure option --enable-build-timestamp.

* configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default.
--

This is based on
libgpg-error commit d620005fd1a655d591fccb44639e22ea445e4554
but changed to be disbaled by default.  Check there for some
background.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoRelax ttyname_r error checks
Daiki Ueno [Mon, 27 Jul 2015 07:19:52 +0000 (16:19 +0900)]
Relax ttyname_r error checks

* 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 <ueno@gnu.org>
2 years agoCleanup layout of gpgme.h
Werner Koch [Tue, 25 Aug 2015 16:06:24 +0000 (18:06 +0200)]
Cleanup layout of gpgme.h

* src/gpgme.h.in: Reorder prototypes.  Chnage some comments.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoImprove error return by checking the FAILURE status.
Werner Koch [Tue, 25 Aug 2015 11:22:43 +0000 (13:22 +0200)]
Improve error return by checking the FAILURE status.

* 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 <wk@gnupg.org>
2 years agotests: Build test programs in tests/ without wrappers.
Werner Koch [Tue, 25 Aug 2015 08:37:02 +0000 (10:37 +0200)]
tests: Build test programs in tests/ without wrappers.

--

2 years agotests: Allow using run-sign to test loopback pinentry problems.
Werner Koch [Tue, 25 Aug 2015 07:05:27 +0000 (09:05 +0200)]
tests: Allow using run-sign to test loopback pinentry problems.

* tests/run-sign.c: Add options --status and --loopback.

2 years agoCall status_cb for an ERROR status seen in the passphrase handler.
Werner Koch [Mon, 24 Aug 2015 19:17:21 +0000 (21:17 +0200)]
Call status_cb for an ERROR status seen in the passphrase handler.

* 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 <wk@gnupg.org>
2 years agow32: Look for gpgconf in the new GnuPG 2.1 install dir.
Werner Koch [Mon, 24 Aug 2015 17:59:43 +0000 (19:59 +0200)]
w32: Look for gpgconf in the new GnuPG 2.1 install dir.

* src/w32-util.c (_gpgme_get_gpgconf_path): Try another location of
gpgconf.exe.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agow32: Expect gpgme-w32spawn.exe only in the gpgme installation dir.
Werner Koch [Mon, 24 Aug 2015 14:34:29 +0000 (16:34 +0200)]
w32: Expect gpgme-w32spawn.exe only in the gpgme installation dir.

* 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 <wk@gnupg.org>
2 years agow32: Print the installation directory in debug mode.
Werner Koch [Mon, 24 Aug 2015 13:03:20 +0000 (15:03 +0200)]
w32: Print the installation directory in debug mode.

* 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 <wk@gnupg.org>
2 years agoAdd an export secret key feature.
Werner Koch [Mon, 24 Aug 2015 10:41:24 +0000 (12:41 +0200)]
Add an export secret key feature.

* 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 <wk@gnupg.org>
2 years agoParse INQUIRE_MAXLEN in the passphrase callback.
Ben Kibbey [Sun, 16 Aug 2015 16:29:41 +0000 (12:29 -0400)]
Parse INQUIRE_MAXLEN in the passphrase callback.

* 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.

2 years agoFix gpgme_{get,set}_status_cb to match documentation.
Ben Kibbey [Sat, 15 Aug 2015 20:58:04 +0000 (16:58 -0400)]
Fix gpgme_{get,set}_status_cb to match documentation.

* doc/gpgme.texi: Minor fixes.
* src/gpgme.c (gpgme_get_status_cb): Set return variables to NULL and
check for a valid ctx pointer.

2 years agoParse the INQUIRE_MAXLEN status message.
Ben Kibbey [Fri, 17 Apr 2015 01:05:01 +0000 (21:05 -0400)]
Parse the INQUIRE_MAXLEN status message.

* 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.

2 years agoAdd gpgme_set/get_status_cb().
Ben Kibbey [Fri, 17 Apr 2015 00:23:38 +0000 (20:23 -0400)]
Add gpgme_set/get_status_cb().

* 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.

2 years agoMake use of user passphrase handler during genkey.
Ben Kibbey [Tue, 14 Apr 2015 22:39:26 +0000 (18:39 -0400)]
Make use of user passphrase handler during genkey.

* 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.

2 years agoAlso check the return code in gpg_sign().
Ben Kibbey [Wed, 12 Aug 2015 10:46:43 +0000 (06:46 -0400)]
Also check the return code in gpg_sign().

* src/engine-gpg.c (gpg_sign): Check return value from start().

2 years agoCheck the return value when starting gpg.
Ben Kibbey [Tue, 11 Aug 2015 01:23:02 +0000 (21:23 -0400)]
Check the return value when starting gpg.

* src/engine-gpg.c (gpg_decrypt, gpg_delete, gpg_passwd): Check return
value of start().

2 years agoMore GTK2 removal pyme3
Ben McGinnes [Sun, 2 Aug 2015 01:06:14 +0000 (11:06 +1000)]
More GTK2 removal

* Missed a couple of files, these 2 go for the same reason as the
  previous 3.

2 years agoRemoved GUI examples
Ben McGinnes [Sun, 2 Aug 2015 01:01:02 +0000 (11:01 +1000)]
Removed GUI examples

* GUI examples written with pygtk, which has not been ported to Python
  3 and won't be as it is for GTK2 and GNOME is moving to GTK3.
* New GUI examples may be required in future using any of several GUI
  frameworks (e.g. wxPython, PyQt, PySide, PyGObject, etc.).

2 years agoAdd offline mode support for CMS keylisting
Andre Heinecke [Thu, 2 Jul 2015 08:19:04 +0000 (10:19 +0200)]
Add offline mode support for CMS keylisting

* 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 <aheinecke@intevation.de>
2 years agobuild: ignore scissor line for the commit-msg hook
Peter Wu [Thu, 9 Jul 2015 15:11:33 +0000 (17:11 +0200)]
build: ignore scissor line for the commit-msg hook

* build-aux/git-hooks/commit-msg: Stop processing more lines when the
  scissor line is encountered.
--
This allows the command `git commit -v` to work even if the code is
longer than 72 characters. Note that comments are already ignored by the
previous line.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2 years agoAdd option --lib-version to gpgme-tool.
Werner Koch [Thu, 23 Jul 2015 09:40:09 +0000 (11:40 +0200)]
Add option --lib-version to gpgme-tool.

* src/gpgme-tool.c (options, parse_options):  Add --lib-version
(CMD_LIBVERSION): New.
(main): Implement.

3 years agoPost release updates
Werner Koch [Mon, 8 Jun 2015 13:18:56 +0000 (15:18 +0200)]
Post release updates

--

3 years agoRelease 1.5.5 gpgme-1.5.5
Werner Koch [Mon, 8 Jun 2015 12:58:44 +0000 (14:58 +0200)]
Release 1.5.5

3 years agoFix regression with gpgsm 2.0 due to "OPTION with-secret".
Werner Koch [Mon, 8 Jun 2015 10:34:49 +0000 (12:34 +0200)]
Fix regression with gpgsm 2.0 due to "OPTION with-secret".

* 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 <wk@gnupg.org>
3 years agotests: Add option --secret to run-keylist.
Werner Koch [Mon, 8 Jun 2015 10:30:11 +0000 (12:30 +0200)]
tests: Add option --secret to run-keylist.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoFix compiler warnings about unused value in TRACE macros.
Werner Koch [Mon, 8 Jun 2015 09:08:08 +0000 (11:08 +0200)]
Fix compiler warnings about unused value in TRACE macros.

* 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 <wk@gnupg.org>
3 years agoFix test suite for GnuPG 2.1 which uses pubring.kbx.
Werner Koch [Mon, 8 Jun 2015 08:43:29 +0000 (10:43 +0200)]
Fix test suite for GnuPG 2.1 which uses pubring.kbx.

* tests/gpgsm/final.test: New.
* tests/gpgsm/initial.test: New.
* tests/gpg/start-stop-agent: Move to ../.
* tests/gpgsm/Makefile.am (TESTS_ENVIRONMENT): Export top_srcdir.
(TESTS): Add intial.test and final.test.
(AM_LDFLAGS): Add -no-install.
(clean-local): Use start-stop-agent
(initial.test): Add dependency.
* tests/gpg/Makefile.am (top_srcdir): Export top_srcdir.
(AM_LDFLAGS): Add -no-install.
(check-local): Depend on pubring-stamp instead of pubring.gpg.
(initial.test): Depend on check-local.
(./pubring-gpg): Replace by rule for ./pubring-stamp.
--

There are also a couple of other changes which should make the tests a
bit more robust and the gpg and gpgsm tests more similar.

The -no-install avoids creating wrappers for test programs, which make
debugging easier.

The dependency on check-local guarantees that its rules are run before
the first test.  This is important because conf files are setup by
this rule.  Earlier automake versions seem to have run check-local
always before the tests but today the order of execution is not
defined.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoSet GPGME_SIGSUM_KEY_REVOKED also for gpg.
Matthew Barnes [Wed, 18 Mar 2015 21:20:55 +0000 (17:20 -0400)]
Set GPGME_SIGSUM_KEY_REVOKED also for gpg.

* 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.

3 years agoFix segv for userids with a backslash.
Werner Koch [Fri, 5 Jun 2015 12:25:59 +0000 (14:25 +0200)]
Fix segv for userids with a backslash.

* 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 <wk@gnupg.org>
3 years agoPython 3 port of PyME
Ben McGinnes [Sat, 16 May 2015 19:31:35 +0000 (05:31 +1000)]
Python 3 port of PyME

* Port of PyME 0.9.0 for Python 2 to Python 3 along with most of the
  example scripts.
* Intended to be developed in parallel with the original Python 2
  version until such time as a rewrite of GPGME leads to developing an
  IO API in Python 3 from scratch.
* Python 3 PyME and API maintainer has entered, stage left with current
  GPG key ID 0x321E4E2373590E5D, primary fingerprint is "DB47 24E6 FA42
  86C9 2B4E  55C4 321E 4E23 7359 0E5D" and signing subkey fingerprint is
  "B7F0 FE75 9387 430D D0C5  8BDB 7FF2 D371 35C7 553C" for future
  reference with git commit signatures.

3 years agoExplaining why not all scripts work
Ben McGinnes [Sat, 16 May 2015 19:14:47 +0000 (05:14 +1000)]
Explaining why not all scripts work

* Some of them cannot be properly tested on OS X, especially with GTK in
  the mix (it works on OS X, but is unlikely to be as easily accessible
  as Cocoa or Qt).
* Most major functions are showcased and do work, albeit sometimes with
  false positives of error messages, at least on OS X.

3 years agoByte encoding
Ben McGinnes [Sat, 16 May 2015 19:07:12 +0000 (05:07 +1000)]
Byte encoding

* More string updates.
* verifydetails.py still fails, but as Bernhard is still contactable, it
  might be worth him checking on it instead.

3 years agoNo change, note added to explain why.
Ben McGinnes [Sat, 16 May 2015 18:57:26 +0000 (04:57 +1000)]
No change, note added to explain why.

3 years agoStrings vs. Bytes
Ben McGinnes [Sat, 16 May 2015 18:43:53 +0000 (04:43 +1000)]
Strings vs. Bytes

* CLI input must be byte encoded.

3 years agoMore byte changes and passphrase changes
Ben McGinnes [Sat, 16 May 2015 18:22:53 +0000 (04:22 +1000)]
More byte changes and passphrase changes

* exportimport works, but will still segfault for an as yet unknown
  reason.
* genkey produces a traceback error, but does create the key as
  intended.
* matched passphrase in signverify.

3 years agoMore bytes good
Ben McGinnes [Sat, 16 May 2015 18:09:38 +0000 (04:09 +1000)]
More bytes good

* Another string to byte change.

3 years agoUpdated encrypt-to-all
Ben McGinnes [Sat, 16 May 2015 18:03:49 +0000 (04:03 +1000)]
Updated encrypt-to-all

* Changed plaintext string to byte literal.
* Nested key selection in a try/except statement in case of
  UnicodeEncodeError instances.
* Tested successfully on over 9,000 keys.

3 years agoPassphrase update
Ben McGinnes [Sat, 16 May 2015 16:38:32 +0000 (02:38 +1000)]
Passphrase update

* Changed example passphrase to something that meets the current minimum
  requirements.

3 years agoexample email
Ben McGinnes [Sat, 16 May 2015 16:35:24 +0000 (02:35 +1000)]
example email

* changed joe@foo.bar to joe@example.org as it is only a matter of time
  before ICANN actually creates bar as a gTLD, if they haven't already.

3 years agoUpdated string and key data
Ben McGinnes [Sat, 16 May 2015 16:30:13 +0000 (02:30 +1000)]
Updated string and key data

* Text changed to byte literals.
* Changed key type to RSA/RSA.
* Changed expiry to the future (2020).

3 years agoString type
Ben McGinnes [Fri, 8 May 2015 18:53:46 +0000 (04:53 +1000)]
String type

* the plain text string must be bytes and not unicode.
* Expect most of the example code to have similar issues at present.

3 years agoPython 3 port of PyME
Ben McGinnes [Tue, 5 May 2015 17:09:44 +0000 (03:09 +1000)]
Python 3 port of PyME

* The entirety of the Python 3 port of PyME up to commit
  2145348ec54c6027f2ea20f695de0277e2871405
* The old commit log has been saved as
  lang/py3-pyme/docs/old-commits.log
* Can be viewed as a normal (separate) git repository at
  https://github.com/adversary-org/pyme3
* Utilising the submodule feature of git was deliberately skipped on
  humanitarian grounds (in order to prevent pain and suffering on the
  part of anyone having to manage this repository).

3 years agoPost release updates.
Werner Koch [Mon, 13 Apr 2015 13:50:59 +0000 (15:50 +0200)]
Post release updates.

--

3 years agoRelease 1.5.4. gpgme-1.5.4
Werner Koch [Mon, 13 Apr 2015 13:43:13 +0000 (15:43 +0200)]
Release 1.5.4.

3 years agow32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.
Werner Koch [Mon, 13 Apr 2015 13:35:06 +0000 (15:35 +0200)]
w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.

* 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 <wk@gnupg.org>
3 years agoFix potential crash in trace macro.
Werner Koch [Mon, 16 Mar 2015 12:40:34 +0000 (13:40 +0100)]
Fix potential crash in trace macro.

* 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 <wk@gnupg.org>
3 years agoFix one byte too short malloc.
Werner Koch [Mon, 16 Mar 2015 12:38:10 +0000 (13:38 +0100)]
Fix one byte too short malloc.

* 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.

3 years agoSwitch to automake 1.14 and update build-aux files.
Werner Koch [Fri, 30 Jan 2015 09:45:20 +0000 (10:45 +0100)]
Switch to automake 1.14 and update  build-aux files.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Update gpl.texi to match version from gnupg
Daniel Kahn Gillmor [Sat, 6 Sep 2014 05:04:07 +0000 (01:04 -0400)]
doc: Update gpl.texi to match version from gnupg

--

Somehow the doc/gpl.texi from gpgme and gnupg drifted out of sync.
This patch to gpgme's file brings it in line with gnupg's master
branch, and avoids the following errors during make:

./gpl.texi:667: @section seen before @end enumerate
./gpl.texi:724: unmatched `@end enumerate'
./gpl.texi:1: warning: node next `Copying' in menu `Concept Index'
   and in sectioning `Function and Data Index' differ

3 years agoPost release updates.
Werner Koch [Thu, 11 Dec 2014 11:53:28 +0000 (12:53 +0100)]
Post release updates.

--

3 years agoRelease 1.5.3. gpgme-1.5.3
Werner Koch [Thu, 11 Dec 2014 11:07:49 +0000 (12:07 +0100)]
Release 1.5.3.

* configure.ac: Set LT version to C24/A13/R2.

3 years agoReturn an error for some export key operations.
Werner Koch [Mon, 8 Dec 2014 10:19:16 +0000 (11:19 +0100)]
Return an error for some export key operations.

* 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.

3 years agoPost release updates
Werner Koch [Fri, 21 Nov 2014 20:29:11 +0000 (21:29 +0100)]
Post release updates

--

3 years agoRelease 1.5.2. gpgme-1.5.2
Werner Koch [Fri, 21 Nov 2014 20:19:26 +0000 (21:19 +0100)]
Release 1.5.2.

* configure.ac: Set LT version to C24/A13/R1.

3 years agoUpdate the previous commit
Werner Koch [Wed, 19 Nov 2014 09:34:32 +0000 (10:34 +0100)]
Update the previous commit

* 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.

3 years agoFix returning new signatures when there are none.
Ben Kibbey [Sun, 9 Nov 2014 21:42:54 +0000 (16:42 -0500)]
Fix returning new signatures when there are none.

* src/sign.c (gpgme_op_sign_result): Test that invalid and valid
signatures add up to gpgme_signers_count().
--

When invalid and valid signatures do not equal gpgme_signers_count() it
means that there was a bad passphrase during signing after the first
signer. This leaves the result.signatures from previous signers intact
which isn't correct since gpg will report:

gpg: number of one-pass packets does not match number of signature
packets
gpg: can't handle this ambiguous signature data

during verify. So when this happens append the valid signatures to the
.invalid_signers list with .reason set to GPG_ERR_GENERAL.

3 years agodoc: Clarify the FILE command.
Werner Koch [Wed, 19 Nov 2014 09:34:32 +0000 (10:34 +0100)]
doc: Clarify the FILE command.

--

3 years agoImprove the debug output a bit.
Werner Koch [Thu, 6 Nov 2014 14:59:06 +0000 (15:59 +0100)]
Improve the debug output a bit.

* src/debug.h (TRACE_ERR): Include the line number in the output.

3 years agobuild: Implement SYSROOT feature. origin/bjk/master
Werner Koch [Thu, 2 Oct 2014 13:48:53 +0000 (15:48 +0200)]
build: Implement SYSROOT feature.

* configure.ac: Document SYSROOT.
* m4/gpg-error.m4: Update from libgpg-error master.
* src/gpgme.m4: Implement SYSROOT stuff.

3 years agoUse --no-sk-comments, not --no-sk-comment.
Daniel Kahn Gillmor [Mon, 29 Sep 2014 21:48:39 +0000 (17:48 -0400)]
Use --no-sk-comments, not --no-sk-comment.

--
The --no-sk-comments flag is (or should be) a no-op in modern versions
of gnupg, but gpgme should still use its full form rather than the
(slightly) abbreviated --no-sk-comment

3 years agoRegister DCO for Daniel Kahn Gillmor.
Werner Koch [Wed, 24 Sep 2014 13:24:05 +0000 (15:24 +0200)]
Register DCO for Daniel Kahn Gillmor.

--

3 years agoAdd ftp and git URLs to AUTHORS.
Werner Koch [Thu, 18 Sep 2014 14:00:34 +0000 (16:00 +0200)]
Add ftp and git URLs to AUTHORS.

--

3 years agotests: Delay some test file extraction until "make check".
Werner Koch [Thu, 18 Sep 2014 14:00:34 +0000 (16:00 +0200)]
tests: Delay some test file extraction until "make check".

* tests/gpg/Makefile.am (all-local): Change to check-local.
* tests/gpgsm/Makefile.am (all-local): Ditto.

3 years agoClean up gpgme's tests/gpg when gpg2.1 is available
Daniel Kahn Gillmor [Tue, 23 Sep 2014 16:46:00 +0000 (12:46 -0400)]
Clean up gpgme's tests/gpg when gpg2.1 is available

* tests/gpg/Makefile.am: Clean up .gpg-v21-migrated
--

We also need to gitignore this file.