gnupg.git
3 years agospeedo: Add make option SELFCHECK=0 to build a new release.
Werner Koch [Tue, 12 May 2015 12:27:14 +0000 (14:27 +0200)]
speedo: Add make option SELFCHECK=0 to build a new release.

* build-aux/getswdb.sh: Add option --skip-selfcheck.
* build-aux/speedo.mk: Add option SELFCHECK.

3 years agopo: Update German translation
Werner Koch [Tue, 12 May 2015 11:20:20 +0000 (13:20 +0200)]
po: Update German translation

--

3 years agogpgparsemail: Rename a variable.
Werner Koch [Tue, 12 May 2015 09:31:11 +0000 (11:31 +0200)]
gpgparsemail: Rename a variable.

--

For unknown reason I used the term MOSS for an RFC1847 structure.
MOSS is a historic and broken security format for MIME define in 1848.
To avoid misunderstandings this patch changes the term to SMFM which
stands for Security Multiparts for MIME (rfc-1847).

3 years agocommon: Cope with AIX problem on number of open files.
Werner Koch [Mon, 11 May 2015 18:18:08 +0000 (20:18 +0200)]
common: Cope with AIX problem on number of open files.

* common/exechelp-posix.c: Limit returned value for too hight values.
--

GnuPG-bug-id: 1778
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg-connect-agent: Fix quoting of internal percent+ function.
Werner Koch [Mon, 11 May 2015 17:38:07 +0000 (19:38 +0200)]
gpg-connect-agent: Fix quoting of internal percent+ function.

* tools/gpg-connect-agent.c (get_var_ext) <percent, percent+): Also
escape '+'.
--

GnuPG-bug-id: 1841
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoagent: Add option --no-allow-external-cache.
Werner Koch [Mon, 11 May 2015 16:08:44 +0000 (18:08 +0200)]
agent: Add option --no-allow-external-cache.

* agent/agent.h (opt): Add field allow_external_cache.
* agent/call-pinentry.c (start_pinentry): Act upon new var.
* agent/gpg-agent.c (oNoAllowExternalCache): New.
(opts): Add option --no-allow-external-cache.
(parse_rereadable_options): Set this option.
--

Pinentry 0.9.2 may be build with libsecret support and thus an extra
checkbox is displayed to allow the user to get passwords out of an
libsecret maintained cache.  Security aware user may want to avoid
this feature and may do this at runtime by enabling this option.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoagent: Add strings for use by future Pinentry versions.
Werner Koch [Mon, 11 May 2015 08:25:09 +0000 (10:25 +0200)]
agent: Add strings for use by future Pinentry versions.

* agent/call-pinentry.c (start_pinentry): Add more strings.
--

We do this so that translations of these strings will be available at
the time a pinentry implements features which require these strings.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoagent: Add option --debug-pinentry.
Werner Koch [Mon, 11 May 2015 08:23:24 +0000 (10:23 +0200)]
agent: Add option --debug-pinentry.

* agent/gpg-agent.c (oDebugPinentry): New.
(opts): Add --debug-pinentry.
(parse_rereadable_options): Set that option.
* agent/call-pinentry.c (start_pinentry): Pass option to
assuan_set_flag.
--

This option is quite useful to see the IPC between gpg-agent and
Pinentry.  Note that "debug 1024" is also required.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Avoid cluttering stdout with trustdb info in verbose mode.
Werner Koch [Fri, 8 May 2015 14:30:04 +0000 (16:30 +0200)]
gpg: Avoid cluttering stdout with trustdb info in verbose mode.

* g10/trustdb.c (validate_keys): Call dump_key_array only in debug
mode.
--

I guess that is a left-over from an early attempt to output
information on the trustdb for use by other tools.  Maybe related to
the former --list-trust-path command.  Sending it to stdout is
probably useful so we do this now only in debug mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Fix wrong output in list mode.
Werner Koch [Fri, 8 May 2015 14:20:26 +0000 (16:20 +0200)]
gpg: Fix wrong output in list mode.

* g10/parse-packet.c (parse_gpg_control): Replace puts by es_fputs to
LISTFP.
--

Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
This was an oversight from the conversion to estream or a separate
listing stream.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: New command --quick-adduid.
Werner Koch [Fri, 8 May 2015 14:08:57 +0000 (16:08 +0200)]
gpg: New command --quick-adduid.

* g10/keygen.c (ask_user_id): Factor some code out to ...
(uid_already_in_keyblock): new.
(generate_user_id): Add arg UIDSTR.  Fix leaked P.
* g10/keyedit.c (menu_adduid): Add new arg uidstring.  Adjust caller.
(keyedit_quick_adduid): New.
* g10/gpg.c (aQuickAddUid): New.
(opts):  Add command --quick-adduid.
(main): Implement that.
--

GnuPG-bug-id: 1956
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Add push/pop found state feature to keydb.
Werner Koch [Fri, 8 May 2015 13:51:11 +0000 (15:51 +0200)]
gpg: Add push/pop found state feature to keydb.

* g10/keydb.c (keydb_handle): Add field saved_found.
(keydb_new): Init new field.
(keydb_push_found_state, keydb_pop_found_state): New.
* g10/keyring.c (kyring_handle): Add field saved_found.
(keyring_push_found_state, keyring_pop_found_state): New.
--

We have the same feature in gpgsm.  It is very useful to check for an
unambiguous user id with a follow up update of the keyblock.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Minor code merging in keyedit.
Werner Koch [Fri, 8 May 2015 10:05:52 +0000 (12:05 +0200)]
gpg: Minor code merging in keyedit.

* g10/keyedit.c (fix_keyblock): Rename to fix_key_signature_order.
(fix_keyblock): New.  Call fix_key_signature_order and other fix
functions.
(keyedit_menu): Factor code out to new fix_keyblock.
(keyedit_quick_sign): Ditto.  Check for primary fpr before calling
fix_keyblock.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoTypo fixes
Werner Koch [Fri, 8 May 2015 06:55:57 +0000 (08:55 +0200)]
Typo fixes

--

3 years agoagent: Minor change for 56b5c9f.
Werner Koch [Thu, 7 May 2015 13:42:00 +0000 (15:42 +0200)]
agent: Minor change for 56b5c9f.

* agent/call-pinentry.c (agent_askpin): Move option setting to ...
(start_pinentry): here.  Fix error code check.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Fix segfault in ldap engine
Kristian Fiskerstrand [Sat, 11 Apr 2015 23:11:07 +0000 (01:11 +0200)]
dirmngr: Fix segfault in ldap engine

(ks-engine-ldap.c) Fix segfault caused by missing check whether uri is
initialized

3 years agoagent: Improve some comments.
Neal H. Walfield [Wed, 6 May 2015 13:27:23 +0000 (15:27 +0200)]
agent: Improve some comments.

--

Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agoagent: Improve support for externally cached passwords.
Neal H. Walfield [Wed, 6 May 2015 13:20:32 +0000 (15:20 +0200)]
agent: Improve support for externally cached passwords.

* agent/call-pinentry.c (PINENTRY_STATUS_PASSWORD_FROM_CACHE): New
constant.
(pinentry_status_cb): Add it to *FLAGS if PASSWORD_FROM_CACHE was
provided.
(agent_askpin): Pass "OPTION allow-external-password-cache" to the
pinentry.  Always pass SETKEYINFO to the pinentry.  If there is no
stable identifier, then use "--clear".  If the password is incorrect
and PINENTRY_STATUS_PASSWORD_FROM_CACHE is set in *PINENTRY_STATUS,
then decrement PININFO->FAILED_TRIES.

--

Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agoagent: Or in the value; don't overwrite the variable.
Neal H. Walfield [Wed, 6 May 2015 12:50:38 +0000 (14:50 +0200)]
agent: Or in the value; don't overwrite the variable.

* agent/call-pinentry.c (pinentry_status_cb): Or in
PINENTRY_STATUS_CLOSE_BUTTON; don't overwrite *FLAG.

--

Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agoagent: Avoid magic numbers. Use more accurate names.
Neal H. Walfield [Wed, 6 May 2015 12:35:22 +0000 (14:35 +0200)]
agent: Avoid magic numbers.  Use more accurate names.

* agent/call-pinentry.c (PINENTRY_STATUS_CLOSE_BUTTON): New constant.
(PINENTRY_STATUS_PIN_REPEATED): Likewise.
(close_button_status_cb): Rename from this...
(pinentry_status_cb): ... to this.  Use the constants.
(agent_askpin): Rename local variable from close_button to
pinentry_status.  Use symbolic constants rather than magic numbers.

--

Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Improve 'General key info' line of --card-status.
Werner Koch [Thu, 7 May 2015 10:01:12 +0000 (12:01 +0200)]
gpg: Improve 'General key info' line of --card-status.

* g10/keylist.c (print_pubkey_info): Print either "pub" or "sub".

* g10/getkey.c (get_pubkey_byfprint): Add optional arg R_KEYBLOCK.
* g10/keyid.c (keyid_from_fingerprint): Adjust for change.
* g10/revoke.c (gen_desig_revoke): Adjust for change.
* g10/card-util.c (card_status): Simplify by using new arg.  Align
card-no string.

* g10/card-util.c (card_status): Remove not used GnuPG-1 code.
--

This now prints "sub" if the first used card key is actually a subkey.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Fix regression not displaying the card serial number
Werner Koch [Thu, 7 May 2015 09:54:34 +0000 (11:54 +0200)]
gpg: Fix regression not displaying the card serial number

* g10/call-agent.c (keyinfo_status_cb): Detect KEYINFO.
--

This regression is due to
commit 585d5c62eece23911a768d97d11f159be138b13d
from February 2013!

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agospeedo,w32: Install a native pinentry.
Werner Koch [Wed, 6 May 2015 09:06:26 +0000 (11:06 +0200)]
speedo,w32: Install a native pinentry.

* build-aux/speedo.mk: Always build pinentry for w32.
(speedo_pkg_pinentry_configure): Adjust to modern pinentry.
* build-aux/speedo/w32/inst.nsi: Install native pinentry under the
name pinentry-basic.exe.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agog10: fix cmp_public_key.
NIIBE Yutaka [Thu, 30 Apr 2015 08:02:42 +0000 (17:02 +0900)]
g10: fix cmp_public_key.

* g10/free-packet.c (cmp_public_keys): Compare opaque
data at the first entry of the array when it's unknown algo.

--

(forwardported from 2.0 commit 43429c7869152f301157e4b24790b3801dce0f0a)

GnuPG-bug-id: 1962

3 years agoscd: PC/SC reader selection by partial string match.
NIIBE Yutaka [Thu, 30 Apr 2015 03:36:38 +0000 (12:36 +0900)]
scd: PC/SC reader selection by partial string match.

* scd/apdu.c (open_pcsc_reader_direct): Partial string match.

--

The card reader name by PC/SC service might include USB bus,
which varies (on some platform like GNU/Linux).  Thus, it's
better to match partial string.

Original patch was submitted by anstein.  I changed it to fallback to
the first reader if no match found.

Note that we need to change pcsc-wrapper.c in 2.0 backport.

GnuPG-bug-id: 1618, 1930

3 years agocommon: Remove JNLIB from boiler plate (jnlib merge).
Werner Koch [Fri, 24 Apr 2015 14:42:28 +0000 (16:42 +0200)]
common: Remove JNLIB from boiler plate (jnlib merge).

* common/README.jnlib: Remove.
--

This is the final part of merging jnlib into gnupg/common.

3 years agocommon: Rename log and gcc attribute macros (jnlib merge).
Werner Koch [Fri, 24 Apr 2015 13:49:18 +0000 (15:49 +0200)]
common: Rename log and gcc attribute macros (jnlib merge).

* common/logging.h: Rename JNLIB_LOG_* to GPGRT_LOG_*.
* common/mischelp.h: Rename JNLIB_GCC_* to GPGRT_GCC_*.
--

JNLIB has no more meaning.  Thus we switch to a GPGRT_ prefix in
anticipation that some code may eventually be moved to libgpg-error.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Remove two JNLIB_ macros (jnlib merge).
Werner Koch [Fri, 24 Apr 2015 14:10:15 +0000 (16:10 +0200)]
common: Remove two JNLIB_ macros (jnlib merge).

* configure.ac: Merge seperate jnlib checks.
(HAVE_JNLIB_LOGGING): Remove.
* common/logging.c, common/simple-pwquery.c (JNLIB_NEED_AFLOCAL):
Rename to GNUPG_COMMON_NEED_AFLOCAL.  Change all tests.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Remove libjnlib-config.h (jnlib merge).
Werner Koch [Fri, 24 Apr 2015 13:19:10 +0000 (15:19 +0200)]
common: Remove libjnlib-config.h (jnlib merge).

* common/libjnlib-config.h: Remove.
* common/common-defs.h (getenv) [HAVE_GETENV]: New.  From removed
header.
(getpid) [HAVE_W32CE_SYSTEM]: New.  From removed header.
* common/argparse.c: Include util.h and common-defs.h.  Replace
jnlib_ macro names for non-GNUPG builds by x* names.
* common/dotlock.c: Ditto.
* common/logging.c: Include util.h and common-defs.h.  Replace jnlib_
symbol names by x* names.
* common/strlist.c: Ditto.
* common/utf8conv.c: Ditto.
* common/w32-reg.c: Ditto.
* common/mischelp.c: Ditto.  Also remove _jnlib_free.
* common/stringhelp.c: Ditto.
(JNLIB_LOG_WITH_PREFIX): Do not depend on this macro.
* common/logging.h (JNLIB_LOG_WITH_PREFIX): Do not depend on this
macro.
--

This is part 1 of the patches to merge the jnlib files into common/.
It does not make much sense to keep jnlib/ files separate.  They are
not often use elsewhere and maintaining the complex marcos stuff is
too troublesome for the future.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Move all DNS access to Dirmngr.
Werner Koch [Thu, 23 Apr 2015 13:42:56 +0000 (15:42 +0200)]
gpg: Move all DNS access to Dirmngr.

* common/dns-cert.h: Move to ../dirmngr/.
* common/dns-cert.c: Move to ../dirmngr/.  Change args to return the
key as a buffer.
* common/t-dns-cert.c: Move to ../dirmngr/.
* common/pka.c, common/pka.h, common/t-pka.c: Remove.

* dirmngr/server.c (data_line_cookie_write): Factor code out to
data_line_write and make it a wrapper for that.
(data_line_write): New.
(cmd_dns_cert): New.
(register_commands): Register new command.

* g10/Makefile.am (LDADD): Remove DNSLIBS.
* g10/call-dirmngr.c (dns_cert_parm_s): New.
(dns_cert_data_cb, dns_cert_status_cb): New.
(gpg_dirmngr_dns_cert): New.
(gpg_dirmngr_get_pka): New.
* g10/gpgv.c (gpg_dirmngr_get_pka): New dummy function.
* g10/keyserver.c (keyserver_import_cert): Replace get_dns_cert by
gpg_dirmngr_dns_cert.
(keyserver_import_pka): Replace get_pka_info by gpg_dirmngr_get_pka.
* g10/mainproc.c: Include call-dirmngr.h.
(pka_uri_from_sig): Add CTX arg. Replace get_pka_info by
gpg_dirmngr_get_pka.
--

With this patch gpg does not do any network access itself but uses
dirmngr for that.  Note that we need to keep linking to NETLIBS due to
the logging code and because we need TCP for our socket emulation
under Windows.  Probably also required for Solaris etc.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Minor change of hex2str to allow for embedded nul.
Werner Koch [Thu, 23 Apr 2015 12:31:04 +0000 (14:31 +0200)]
common: Minor change of hex2str to allow for embedded nul.

* common/convert.c (hex2str): Set ERRNO.  Return adjusted COUNT.
--

hex2str is only used at one place for in-place converting an hex
encoded passphrase.  This change does not affect this use.  The change
is however useful to use the function for in-place conversion of
arbitrary hex encoded strings.

Take care for in-place conversion of a hex string encoding binary data
you need to use it this way:

  if (hex2str (string, string, strlen (string) + 1, &length)
     oops ("probably out of memory but see ERRNO");
  for (i=0; i < length; i++)
     foo (string[i));

Note that strlen() + 1.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: removal of t-support.c from t_jnlib_src.
NIIBE Yutaka [Thu, 23 Apr 2015 01:51:33 +0000 (10:51 +0900)]
common: removal of t-support.c from t_jnlib_src.

* common/Makefile.am (t_jnlib_src): Remove t-support.c.

--

Since test programs are linked to libgcrypt and libgpg-error, there
is no need to include t-support.c.

GnuPG-bug-id: 1862, 1915

3 years agogpg: Make keyserver-option http_proxy work.
Werner Koch [Tue, 21 Apr 2015 17:29:53 +0000 (19:29 +0200)]
gpg: Make keyserver-option http_proxy work.

* g10/options.h (opt): Add field keyserver_options.http_proxy.
* g10/keyserver.c (warn_kshelper_option): Add arg noisy.
(parse_keyserver_options): Parse into new http_proxy field.
* g10/call-dirmngr.c (create_context): Send the http-proxy option.

3 years agocommon: Make proper use of http proxy parameter.
Werner Koch [Tue, 21 Apr 2015 17:27:22 +0000 (19:27 +0200)]
common: Make proper use of http proxy parameter.

* common/http.c (is_hostname_port): New.
(send_request): Fix proxy name parsing.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Add http proxy support for keyservers.
Werner Koch [Tue, 21 Apr 2015 15:14:53 +0000 (17:14 +0200)]
dirmngr: Add http proxy support for keyservers.

* dirmngr/dirmngr.h (server_control_s): Add field http_proxy.
* dirmngr/dirmngr.c (dirmngr_init_default_ctrl): Copy http_proxy value
from OPT.
(dirmngr_deinit_default_ctrl): New.
(main): Call dirmngr_deinit_default_ctrl.
* dirmngr/server.c (start_command_handler): Ditto.
(option_handler): Add option "http-proxy".
* dirmngr/crlfetch.c (crl_fetch): Take http_proxy from CTRL.
* dirmngr/ocsp.c (do_ocsp_request): Ditto.
* dirmngr/ks-engine-hkp.c (send_request): Add proxy support.
* dirmngr/ks-engine-http.c (ks_http_fetch): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Do not use honor-keyserver-url sub-option by default.
Werner Koch [Tue, 21 Apr 2015 13:46:13 +0000 (15:46 +0200)]
gpg: Do not use honor-keyserver-url sub-option by default.

3 years agogpg: Make preferred keyservers work.
Werner Koch [Tue, 21 Apr 2015 13:36:30 +0000 (15:36 +0200)]
gpg: Make preferred keyservers work.

* g10/call-dirmngr.c (dirmngr_local_s): Add field set_keyservers_done.
(create_context): Move keyserver setting to ...
(open_context): here.
(clear_context_flags): New.
(gpg_dirmngr_ks_get): Add arg override_keyserver.
* g10/keyserver.c (keyserver_refresh): Improve diagnostics.
(keyserver_get_chunk): Ditto.  Pass OVERRIDE_KEYSERVER to ks_get.
--

It used to ignore the given server but showed a diagnostics that it
will be used.

3 years agogpg: Update sub-options of --keyserver-options
Werner Koch [Tue, 21 Apr 2015 08:15:04 +0000 (10:15 +0200)]
gpg: Update sub-options of --keyserver-options

* g10/options.h (KEYSERVER_HTTP_PROXY): New.
(KEYSERVER_USE_TEMP_FILES, KEYSERVER_KEEP_TEMP_FILES): Remove.
(KEYSERVER_TIMEOUT): New.
* common/keyserver.h (KEYSERVER_TIMEOUT): Remove.
* g10/keyserver.c (keyserver_opts): Remove obsolete "use-temp-files"
and "keep-temp-files". Add "http-proxy" and "timeout".
(parse_keyserver_options): Remove 1.2 compatibility option
"honor-http_proxy".  Remove "use-temp-files" and "keep-temp-files"
code.
--

Note that many of these options where implicitly used by passing any
unknown option down to the former keyserver helpers.  The don't exist
anymore thus we need to make them explicit.  Another patch will convey
them to dirmngr.  Temp files are not anymore used thus they can be
removed and will be ignored when used.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoRemove the obsolete keyserver directory from the repo.
Werner Koch [Mon, 20 Apr 2015 15:39:20 +0000 (17:39 +0200)]
Remove the obsolete keyserver directory from the repo.

--

We also merge dirmngr/ChangeLog.1 into dirmngr/ChangeLog-2011
and rename keyserver/ChangeLog-2011 to dirmngr/ChangeLog-2011-ks.

3 years agoagent: Send the new SETKEYINFO command to the Pinentry.
Werner Koch [Tue, 14 Apr 2015 16:41:05 +0000 (18:41 +0200)]
agent: Send the new SETKEYINFO command to the Pinentry.

* agent/call-pinentry.c (agent_askpin): Add args keyinfo and
cache_mode.  Change all callers to pass (NULL,0) for them.  Send
SETKEYINFO command.
* agent/findkey.c (unprotect): Pass the keygrip and the cache_mode for
the new args.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoscd: better handling of extended APDU.
NIIBE Yutaka [Tue, 14 Apr 2015 05:17:03 +0000 (14:17 +0900)]
scd: better handling of extended APDU.

* scd/apdu.c (send_le): Bug fix for not append Z when lc<0&&le<0.
* scd/app-common.h (struct app_ctx_s): Use bit fields for flags.
* scd/ccid-driver.c (CCID_MAX_BUF): New.  Only for OpenPGPcard.
(struct ccid_driver_s): New field of max_ccid_msglen.
 Remove ifsd field.
(parse_ccid_descriptor): Initialize max_ccid_msglen.
(ccid_transceive_apdu_level): Implement sending extended APDU in
chain of CCID message.

--

With this patch, we won't need PC/SC library/service any more.
GnuPG-bug-id: 1947

3 years agogpg: Fix NULL-segv due to invalid imported data.
Werner Koch [Mon, 13 Apr 2015 09:44:10 +0000 (11:44 +0200)]
gpg: Fix NULL-segv due to invalid imported data.

* g10/free-packet.c (my_mpi_copy): New.
(copy_public_key, copy_signature): Use instead of mpi_copy.
--

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: If LDAP is not enable, don't build the LDAP bits.
Neal H. Walfield [Mon, 13 Apr 2015 10:02:40 +0000 (12:02 +0200)]
dirmngr: If LDAP is not enable, don't build the LDAP bits.

* dirmngr/Makefile.am (dirmngr_SOURCES): Only include
ks-engine-ldap.c, ldap-parse-uri.c and ldap-parse-uri.h if USE_LDAP
is TRUE.
(module_tests): Only add t-ldap-parse-uri if USE_LDAP is TRUE.
* dirmngr/ks-action.c: Only include "ldap-parse-uri.h" if USE_LDAP is
TRUE.
(ks_action_help): Don't invoke LDAP functionality if USE_LDAP is not
TRUE.
(ks_action_search): Likewise.
(ks_action_get): Likewise.
(ks_action_put): Likewise.
* dirmngr/server.c: Only include "ldap-parse-uri.h" if USE_LDAP is
TRUE.
(cmd_keyserver): Don't invoke LDAP functionality if USE_LDAP is not
TRUE.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
GnuPG-bug-id: 1949

3 years agocommon: Do without nested fucntions to support non-gcc.
Werner Koch [Mon, 13 Apr 2015 07:57:33 +0000 (09:57 +0200)]
common: Do without nested fucntions to support non-gcc.

* common/t-stringhelp.c (test_strsplit): Remove nested function.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agobuild: Update gpg-error.m4.
Werner Koch [Sun, 12 Apr 2015 17:58:28 +0000 (19:58 +0200)]
build: Update gpg-error.m4.

--

3 years agoPost release updates.
Werner Koch [Sat, 11 Apr 2015 11:33:41 +0000 (13:33 +0200)]
Post release updates.

--

3 years agoRelease 2.1.3. gnupg-2.1.3
Werner Koch [Sat, 11 Apr 2015 11:14:43 +0000 (13:14 +0200)]
Release 2.1.3.

3 years agopo: Update Ukrainian translation
Yuri Chornoivan [Wed, 18 Feb 2015 17:12:43 +0000 (19:12 +0200)]
po: Update Ukrainian translation

3 years agopo: Update and review Russian translation
Ineiev [Mon, 16 Feb 2015 17:29:47 +0000 (17:29 +0000)]
po: Update and review Russian translation

3 years agodirmngr,w32: Make it build for Windows.
Werner Koch [Fri, 10 Apr 2015 13:08:50 +0000 (15:08 +0200)]
dirmngr,w32: Make it build for Windows.

* dirmngr/Makefile.am (t_common_ldadd): Add missing libs.

3 years agoRemove obsolete directories from AM_CPPFLAGS.
Werner Koch [Fri, 10 Apr 2015 11:11:59 +0000 (13:11 +0200)]
Remove obsolete directories from AM_CPPFLAGS.

3 years agodirmngr,w32: Replace functions not available under Windows.
Werner Koch [Fri, 10 Apr 2015 11:05:38 +0000 (13:05 +0200)]
dirmngr,w32: Replace functions not available under Windows.

* dirmngr/ks-engine-ldap.c (extract_attributes): Replace isoptime and
gmtime_r.

3 years agocommon: Add new function gnupg_gmtime.
Werner Koch [Fri, 10 Apr 2015 10:24:43 +0000 (12:24 +0200)]
common: Add new function gnupg_gmtime.

* common/gettime.c (gnupg_gmtime): New.
(gnupg_get_isotime): Use it.  Also take care of an gmtime_t returning
an error.
--

The fix in gnupg_get_isotime is only to cover up a theoretical broken
time (e.g. a value of (time_t)(-2) which is not mapped beyond 2038 on
32 bit systems).

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Add new function isodate_human_to_tm
Werner Koch [Fri, 10 Apr 2015 10:02:31 +0000 (12:02 +0200)]
common: Add new function isodate_human_to_tm

* common/gettime.c (isotime_human_p): Add arg date_only.
(isodate_human_to_tm): New.
* common/t-gettime.c (test_isodate_human_to_tm): New.
(main): Call new test.
--

This function in intended as replacement for

 strptime (foo, "%Y-%m-%d", &bar)

which is not available under Windows.

3 years agodirmngr,w32: Avoid name clash with existing function
Werner Koch [Fri, 10 Apr 2015 08:59:28 +0000 (10:59 +0200)]
dirmngr,w32: Avoid name clash with existing function

* dirmngr/ks-engine-ldap.c (ldap_connect): Rename to my_ldap_connect.

3 years agogpgparsemail: Fix last commit (3f2bdac)
Werner Koch [Fri, 10 Apr 2015 06:34:35 +0000 (08:34 +0200)]
gpgparsemail: Fix last commit (3f2bdac)

* tools/rfc822parse.c (parse_field): Replace break by goto.
--

Brown paper bag bug: Changing an IF to a WHILE inside another loop
requires to fix the inner break.

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agospeedo: Fix libgpg-error build in w64 builds
Werner Koch [Thu, 9 Apr 2015 17:08:57 +0000 (19:08 +0200)]
speedo: Fix libgpg-error build in w64 builds

--

This typo was recently introduced.

3 years agotools: Remove trailing spaces.
Werner Koch [Thu, 9 Apr 2015 17:07:21 +0000 (19:07 +0200)]
tools: Remove trailing spaces.

--

3 years agogpgparsemail: Fix case of zero length continuation lines.
Werner Koch [Thu, 9 Apr 2015 17:06:33 +0000 (19:06 +0200)]
gpgparsemail: Fix case of zero length continuation lines.

* tools/rfc822parse.c (parse_field): Loop after continuation line.
--

Using header lines like

  Name:[lf]
  [space][lf]
  [lf]

resulted in running into the "(s2 = strchr (delimiters2, *s)" branch
and inserting a new token for the empty continuation line.  This also
led to one byte read after the string which is what Hanno figured.
The new code should handle empty continuation lines correct.

Reported-by: Hanno Böck
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agosm: Fix certificate lookup in dirmngr cache.
Werner Koch [Wed, 8 Apr 2015 13:58:16 +0000 (15:58 +0200)]
sm: Fix certificate lookup in dirmngr cache.

* sm/call-dirmngr.c (get_cached_cert): Fix typo in LOOKUP command.
--

This bug has been here since the code was written.  The commit message
for commit 2d0ca28a226773b9779a93c39bba9bace13232fe actually had the
warning that the code has not been tested.  Now the funny thing is
that when the code was backported to the 2.0 branch just a few minutes
later that typo was fixed en passant in that branch.

3 years agogpg: Print the user id in --fast-list-mode.
Werner Koch [Mon, 6 Apr 2015 18:23:05 +0000 (20:23 +0200)]
gpg: Print the user id in --fast-list-mode.

* g10/keylist.c (list_keyblock_print, list_keyblock_colon): Change.

3 years agogpg: Prepare to pass additional context to the list functions.
Werner Koch [Mon, 6 Apr 2015 17:46:25 +0000 (19:46 +0200)]
gpg: Prepare to pass additional context to the list functions.

* g10/keylist.c (struct sig_stats): Rename to keylist_context and add
field check_sigs.
(keylist_context_release): New.
(list_all): Set listctx.check_sigs and call release func.
(list_one): Ditto.
(locate_one): Ditto.
(list_keyblock_print): Use .check_sigs field.  Repalce arg opaque by
listctx.
(list_keyblock): Ditto.  Make static.
(list_keyblock_direct): New.
* g10/keygen.c (do_generate_keypair): Replace list_keyblock by
list_keyblock_direct.
--

This is in preparation for the server mode and for a patch to speed up
--list-sigs.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Merge duplicated code for get_user_id et al.
Werner Koch [Mon, 6 Apr 2015 16:57:05 +0000 (18:57 +0200)]
gpg: Merge duplicated code for get_user_id et al.

* g10/getkey.c (get_user_id_string): Add args mode and r_LEN.
(get_user_id_string_native): Add new args.
(get_long_user_id_string, get_user_id): Rewrite using
get_user_id_string.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Add new option --debug-iolbf.
Werner Koch [Mon, 6 Apr 2015 12:07:50 +0000 (14:07 +0200)]
gpg: Add new option --debug-iolbf.

* g10/gpg.c (oDebugIOLBF): new.
(opts): Add --debug-iolbf.
(main): Set option.
--

This option is convenient for debugging to make sure that debug output
to stderr is synced with output to stdout.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoRename DBG_ASSUAN to DBG_IPC and add separate DBG_EXTPROG.
Werner Koch [Mon, 6 Apr 2015 11:42:17 +0000 (13:42 +0200)]
Rename DBG_ASSUAN to DBG_IPC and add separate DBG_EXTPROG.

* g10/options.h (DBG_EXTPROG_VALUE): Separate from DBG_IPC_VALUE.

3 years agoFix use of DBG_CACHE and DBG_LOOKUP
Werner Koch [Mon, 6 Apr 2015 11:27:26 +0000 (13:27 +0200)]
Fix use of DBG_CACHE and DBG_LOOKUP

* dirmngr/dirmngr.h (DBG_LOOKUP_VALUE): Change to 8192.
* g10/options.h (DBG_LOOKUP_VALUE, DBG_LOOKUP): New.
* g10/getkey.c: Use DBG_LOOKUP instead of DBG_CACHE at most places.

3 years agogpg: Rename a debug macro.
Werner Koch [Mon, 6 Apr 2015 11:07:09 +0000 (13:07 +0200)]
gpg: Rename a debug macro.

* g10/options.h (DBG_CIPHER_VALUE): Rename to DBG_CRYPTO_VALUE.
(DBG_CIPHER): Rename to DBG_CRYPTO.

3 years agogpg: Fix DoS while parsing mangled secret key packets.
Werner Koch [Sun, 5 Apr 2015 10:48:14 +0000 (12:48 +0200)]
gpg: Fix DoS while parsing mangled secret key packets.

* g10/parse-packet.c (parse_key): Check PKTLEN before calling mpi_read
et al.
--

Due to the missing length checks PKTLEN may turn negative.  Because
PKTLEN is an unsigned int the malloc in read_rest would try to malloc
a too large number and terminate the process with "error reading rest
of packet: Cannot allocate memory".

Reported-by: Hanno Böck.
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agog10: Fix keytocard.
NIIBE Yutaka [Fri, 3 Apr 2015 08:39:59 +0000 (17:39 +0900)]
g10: Fix keytocard.

g10/call-agent.h (agent_scd_learn): Add FORCE option.
g10/call-agent.c (agent_scd_learn): Implement FORCE option.
g10/keygen.c (gen_card_key): Follow the change of option.
g10/card-util.c (change_pin, card_status, factory_reset): Likewise.
g10/keyedit.c (keyedit_menu): Update private key storage by
agent_scd_learn.
--

This is not a perfect solution since there is a possibility user
unplug card before quitting 'gpg --keyedit' session.  Usually,
it works well.

GnuPG-bug-id: 1846

3 years agoagent: Add --force option for LEARN.
NIIBE Yutaka [Fri, 3 Apr 2015 08:33:11 +0000 (17:33 +0900)]
agent: Add --force option for LEARN.

* agent/command.c (cmd_learn): Handle --force option.
(cmd_keytocard): Don't update key storage file.
* agent/agent.h (agent_handle_learn): Add FORCE.
* agent/learncard.c (agent_handle_learn): Implement FORCE to update
key stroage file.
--

3 years agodirmngr: Don't use alloca.
Neal H. Walfield [Tue, 31 Mar 2015 12:48:31 +0000 (14:48 +0200)]
dirmngr: Don't use alloca.

* dirmngr/ks-engine-ldap.c (ks_ldap_put): Replace use of alloca with
xmalloc and xfree.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agodirmngr: Simplify truncation of long strings in debug code.
Neal H. Walfield [Tue, 31 Mar 2015 12:23:13 +0000 (14:23 +0200)]
dirmngr: Simplify truncation of long strings in debug code.

* dirmngr/ks-engine-ldap.c (modlist_dump): Simplify truncation of long
strings.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agodirmngr: Correct indentation.
Neal H. Walfield [Tue, 31 Mar 2015 10:26:59 +0000 (12:26 +0200)]
dirmngr: Correct indentation.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agodirmngr: Use a better error code.
Neal H. Walfield [Tue, 31 Mar 2015 10:07:39 +0000 (12:07 +0200)]
dirmngr: Use a better error code.

* dirmngr/ldap-parse-uri.c (ldap_parse_uri): On error, return
GPG_ERR_GENERAL, not GPG_ERR_ASS_GENERAL.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Remove gratuitous extern qualifier from declaration.
Neal H. Walfield [Tue, 31 Mar 2015 10:00:58 +0000 (12:00 +0200)]
gpg: Remove gratuitous extern qualifier from declaration.

--

Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agodirmngr: Better encapsulate the keyservers variable.
Neal H. Walfield [Sat, 28 Mar 2015 16:23:56 +0000 (17:23 +0100)]
dirmngr: Better encapsulate the keyservers variable.

* dirmngr/dirmngr.h (struct server_control_s): Move field keyservers
from here...
* dirmngr/server.c (struct server_local_s): ... to here.  Update
users.
* dirmngr/ks-action.h (ks_action_resolve): Add argument keyservers.
(ks_action_search): Likewise.
(ks_action_get): Likewise.
(ks_action_put): Likewise.
* dirmngr/ks-action.c (ks_action_resolve): Add argument keyservers.
Use it instead of ctrl->keyservers.
(ks_action_search): Likewise.
(ks_action_get): Likewise.
(ks_action_put): Likewise.

--

Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Only use the last specified keyserver.
Neal H. Walfield [Sat, 28 Mar 2015 15:55:10 +0000 (16:55 +0100)]
gpg: Only use the last specified keyserver.

* g10/gpg.c (main): Only use the last specified keyserver.

--

Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agodirmngr: Fix resource leaks and check rare errors.
Werner Koch [Wed, 25 Mar 2015 18:39:27 +0000 (19:39 +0100)]
dirmngr: Fix resource leaks and check rare errors.

* dirmngr/ks-engine-ldap.c (keyspec_to_ldap_filter): Fix resource
leak.
(ks_ldap_search): Check error from es_fopenmem.  Use LDAP_ERR where
required.
(modlist_dump): Check error from es_fopenmem.
(uncescape): s/int/size_t/.  Use existing macros.
(extract_attributes): Use existing trim function.
(ks_ldap_put): Do not segv on error from modlist_dump.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Minor cleanups.
Werner Koch [Wed, 25 Mar 2015 18:33:59 +0000 (19:33 +0100)]
dirmngr: Minor cleanups.

* dirmngr/ks-engine-ldap.c [__riscos__]: Remove doubled util.h.
(ldap_to_gpg_err): s/GPG_ERR_GENERAL/GPG_ERR_INTERNAL/.
(tm2ldaptime): Use snprintf.
(ldap_connect): Get error code prior to log_error and and use modern
function.   Use xfree, xtrustrdup etc.
(modlist_lookup): Use GNUPG_GCC_A_USED.
(modlist_free): Use xfree.
--

sprintf has been replaced by snprintf to avoid warnings on some
platforms.

xfree et al. is required so that replacement functions are
used if defined.  For example the Libgcrypt functions which may not be
fully compatible with standard free.

Impossible conditions should use GPG_ERR_INTERNAL.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Add macro GNUPG_GCC_A_USED.
Werner Koch [Wed, 25 Mar 2015 18:19:38 +0000 (19:19 +0100)]
common: Add macro GNUPG_GCC_A_USED.

* common/util.h (GNUPG_GCC_A_USED): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Document the changed default algos for gpgsm.
Werner Koch [Wed, 25 Mar 2015 09:16:37 +0000 (10:16 +0100)]
doc: Document the changed default algos for gpgsm.

--

3 years agosm: Change default algos to SHA256 (CSR) and AES128 (bulk encryption).
Werner Koch [Wed, 25 Mar 2015 09:12:11 +0000 (10:12 +0100)]
sm: Change default algos to SHA256 (CSR) and AES128 (bulk encryption).

* sm/certreqgen.c (create_request): Change default hash algo.
* sm/gpgsm.c (DEFAULT_CIPHER_ALGO): Change default bulk cipher algo.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg,w32: Handle forward slash in --keyring option.
Werner Koch [Tue, 24 Mar 2015 12:30:57 +0000 (13:30 +0100)]
gpg,w32: Handle forward slash in --keyring option.

* g10/keydb.c (keydb_add_resource): Allow forward slash under Windows.
--

GnuPG-bug-id: 1546

3 years agodoc: Mention that --use-standard-socket-p always returns true.
Werner Koch [Tue, 24 Mar 2015 08:22:24 +0000 (09:22 +0100)]
doc: Mention that --use-standard-socket-p always returns true.

--

3 years agocommon:stringhelp.c: Replace use of jblib_malloc with xtrymalloc, etc. neal/dirmngr-ldap
Neal H. Walfield [Thu, 12 Mar 2015 12:45:27 +0000 (13:45 +0100)]
common:stringhelp.c: Replace use of jblib_malloc with xtrymalloc, etc.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoImprove documentation for ks_hkp_get.
Neal H. Walfield [Thu, 19 Mar 2015 10:15:53 +0000 (11:15 +0100)]
Improve documentation for ks_hkp_get.

* dirmngr/ks-engine-hkp.c (ks_hkp_get): Improvement documentation.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoImprove spelling and grammar of some comments.
Neal H. Walfield [Thu, 19 Mar 2015 10:14:52 +0000 (11:14 +0100)]
Improve spelling and grammar of some comments.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoImprove documenation of http_parse_uri.
Neal H. Walfield [Thu, 19 Mar 2015 10:12:43 +0000 (11:12 +0100)]
Improve documenation of http_parse_uri.

* common/http.c (http_parse_uri): Improve documentation.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoAdd support to talking to LDAP key servers.
Neal H. Walfield [Thu, 19 Mar 2015 10:02:46 +0000 (11:02 +0100)]
Add support to talking to LDAP key servers.

* g10/call-dirmngr.c (record_output): New function.
(ks_put_inq_cb): Use it here to generate a --with-colons like output
instead of a custom format.
* dirmngr/ks-action.c: Include "ldap-parse-uri.h".
(ks_action_help): If the provided URI is an LDAP URI, then use
ldap_parse_uri to parse.  Call ks_ldap_help.
(ks_action_search): If passed an LDAP URI, then call ks_ldap_search.
(ks_action_get): Likewise.
(ks_action_put): Likewise.  Also, change data from a 'const void *' to
a 'void *' and add info and infolen parameters.  Add note that
function may modify DATA.
* dirmngr/ks-action.h (ks_action_put): Update declaration accordingly.
* dirmngr/server.c: Include "ldap-parse-uri.h".
(cmd_keyserver): If ITEM->URI is an LDAP URI, parse it using
ldap_parse_uri.
(hlp_ks_put): Improve documentation.
(cmd_ks_put): Also pass info and infolen to ks_action_put.  Improve
documentation.
* dirmngr/ks-engine.h (ks_ldap_help): New declaration.
(ks_ldap_search): Likewise.
(ks_ldap_get): Likewise.
(ks_ldap_put): Likewise.
* dirmngr/ks-engine-ldap.c: New file.
* dirmngr/Makefile.am (dirmngr_SOURCES): Add ks-engine-ldap.c,
ldap-parse-uri.c and ldap-parse-uri.h.
(dirmngr_LDADD) [USE_LDAP]: Add $(ldaplibs).

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoImport _gpgme_parse_timestamp from gpgme as parse_timestamp.
Neal H. Walfield [Mon, 23 Mar 2015 12:22:48 +0000 (13:22 +0100)]
Import _gpgme_parse_timestamp from gpgme as parse_timestamp.

* common/gettime.h (parse_timestamp): New declaration.
* common/gettime.c (_win32_timegm): New function imported from
gpgme/src/conversion.c:_gpgme_timegm.
(parse_timestamp): New function imported from
gpgme/src/conversion.c:_gpgme_parse_timestamp.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoMove copy_stream function to misc.c.
Neal H. Walfield [Fri, 13 Mar 2015 12:44:18 +0000 (13:44 +0100)]
Move copy_stream function to misc.c.

* dirmngr/ks-action.c (copy_stream): Move function from here...
* dirmngr/misc.c (copy_stream): ... to here and drop the static
qualifier.
* dirmngr/misc.h (copy_stream): Add declaration.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoMove armor_data to misc.c.
Neal H. Walfield [Fri, 13 Mar 2015 12:42:00 +0000 (13:42 +0100)]
Move armor_data to misc.c.

* dirmngr/ks-engine-hkp.c (armor_data): Move function from here...
* dirmngr/misc.c (armor_data): ... to here and drop static qualifier.
* dirmngr/misc.h: New declaration.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoAdd new LDAP utility functions.
Neal H. Walfield [Fri, 13 Mar 2015 12:39:40 +0000 (13:39 +0100)]
Add new LDAP utility functions.

* dirmngr/Makefile.am (module_tests): New variable.
(noinst_PROGRAMS): New primary.  Set it to $(module_tests).
(TESTS): New variable.  Set it to $(module_tests).
(t_common_src): New variable.
(t_common_ldadd): Likewise.
(t_ldap_parse_uri_SOURCES): New primary.
(t_ldap_parse_uri_LDADD): Likewise.
* dirmngr/ldap-parse-uri.c: New file.
* dirmngr/ldap-parse-uri.h: Likewise.
* dirmngr/t-ldap-parse-uri.c: Likewise.
* dirmngr/t-support.h: Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoAdd new function uri_query_lookup.
Neal H. Walfield [Thu, 19 Mar 2015 08:59:20 +0000 (09:59 +0100)]
Add new function uri_query_lookup.

* common/http.h (uri_query_lookup): New declaration.
* common/http.c (uri_query_lookup): The corresponding implementation.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agoAdd new function strlist_find.
Neal H. Walfield [Fri, 13 Mar 2015 14:08:22 +0000 (15:08 +0100)]
Add new function strlist_find.

* common/strlist.h (strlist_find): New declaration.
* common/strlist.c (strlist_find): New function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agocommon: Add new helper function, strsplit.
Neal H. Walfield [Thu, 12 Mar 2015 12:03:50 +0000 (13:03 +0100)]
common: Add new helper function, strsplit.

* common/stringhelp.h (strsplit): New declaration.
* common/stringhelp.c (strsplit): New function.
* common/t-stringhelp.c (test_strsplit): New function.
(main): Call it here.

--
Signed-off-by: Neal H. Walfield <neal@g10code.de>
3 years agogpg: Consider a mailbox only userid in mail search mode.
Werner Koch [Fri, 20 Mar 2015 14:43:32 +0000 (15:43 +0100)]
gpg: Consider a mailbox only userid in mail search mode.

* kbx/keybox-search.c: Include mbox-util.h.
(blob_cmp_mail): Improve OpenPGP uid parsing.
--

GnuPG-bug-id: 1927

3 years agocommon: Add function is_valid_mailbox_mem.
Werner Koch [Fri, 20 Mar 2015 14:39:49 +0000 (15:39 +0100)]
common: Add function is_valid_mailbox_mem.

* common/mbox-util.c (mem_count_chr): New.
(my_memstr): New.
(has_invalid_email_chars): Change args to work on a buffer.
(is_valid_mailbox_mem): New.
(is_valid_mailbox): Rewrite to use is_valid_mailbox_mem.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Find keys using mail addresses with garbage after the '>'
Werner Koch [Fri, 20 Mar 2015 12:29:20 +0000 (13:29 +0100)]
gpg: Find keys using mail addresses with garbage after the '>'

* kbx/keybox-search.c (blob_cmp_mail): Stop comparing at the '>'.
--

This change allows to find mail addresses like

  Joe Doe <joe@example.org> bar
  Joe Doe <joe@example.org> (comment)

using the command

   gpg  -k '<joe@example.org'

or (with syntactic sugar)

   gpg  -k '<joe@example.org>'

These UIDs are ill-formed according to gpg checks but nevertheless are
seen in the wild.

Note, that it does only work with the new keybox format.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Fix syntax error when building with gnutls
Werner Koch [Fri, 20 Mar 2015 12:20:04 +0000 (13:20 +0100)]
common: Fix syntax error when building with gnutls

* common/http.c (send_request): Add missing comma.
--

This fixes commit dc10d46.

Signed-off-by: Werner Koch <wk@gnupg.org>