gnupg.git
3 years agopo: Update Ukrainian translation
Yuri Chornoivan [Fri, 23 Oct 2015 17:04:34 +0000 (20:04 +0300)]
po: Update Ukrainian translation

--

Merged with current POT - wk

3 years agopo: Update Russian translation
Ineiev [Fri, 4 Dec 2015 09:23:39 +0000 (10:23 +0100)]
po: Update Russian translation

--

Signed-off-by: Werner Koch <wk@gnupg.org>
The patch was from October 12 and thus 6 strings could not be applied
due to chnaged original strings.

3 years agospeedo,w32: Improve installer.
Werner Koch [Fri, 4 Dec 2015 08:11:11 +0000 (09:11 +0100)]
speedo,w32: Improve installer.

* build-aux/speedo/w32/inst.nsi (SEC_gnupg): Install dirmngr.conf and
distsigkey.gpg.
(un.gnupglast): Stop dirmngr.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Do not pre-check keys given on the command line.
Werner Koch [Fri, 4 Dec 2015 07:56:02 +0000 (08:56 +0100)]
gpg: Do not pre-check keys given on the command line.

* g10/keydb.h (PK_LIST_ENCRYPT_TO, PK_LIST_HIDDEN, PK_LIST_CONFIG)
(PK_LIST_SHIFT): New.
* g10/pkclist.c (build_pk_list): Use them here.
* g10/gpg.c (check_user_ids, main): Ditto.

* g10/gpg.c (main): Set PK_LIST_CONFIG for REMUSR and LOCUSR.
(check_user_ids): Skip check for command line specified options.
--

If a key has been given on the command line and it has not been
given by one of the encrypt-to options, we now skip the checks.  The
reason is that the actual key selection code does its own checks and
provides proper status message to the caller to detect the wrong keys.
Without this we would break most frontends because they expect for
example STATUS_INV_RECP.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Add command to print the resolver version.
Werner Koch [Thu, 3 Dec 2015 17:05:32 +0000 (18:05 +0100)]
dirmngr: Add command to print the resolver version.

* dirmngr/server.c (cmd_getinfo): Add sub-command "dnsinfo".

3 years agopo: Auto-update.
Werner Koch [Thu, 3 Dec 2015 16:28:20 +0000 (17:28 +0100)]
po: Auto-update.

--

3 years agopo: Update German translation.
Werner Koch [Thu, 3 Dec 2015 16:27:46 +0000 (17:27 +0100)]
po: Update German translation.

--

3 years agogpg: Allow "help" as value for --tofu-policy.
Werner Koch [Thu, 3 Dec 2015 15:19:35 +0000 (16:19 +0100)]
gpg: Allow "help" as value for --tofu-policy.

* g10/gpg.c (parse_tofu_policy): Add keyword "help".
(parse_tofu_db_format): Ditto.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoDo not translate messages printed with log_debug.
Werner Koch [Thu, 3 Dec 2015 14:38:25 +0000 (15:38 +0100)]
Do not translate messages printed with log_debug.

* common/asshelp.c (start_new_gpg_agent): Do not i18n string.
(start_new_dirmngr): Ditto.
* g10/mainproc.c (proc_encrypted): Ditto.  Print only if debug is
enabled.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoscd: Fix for removing the prefix.
NIIBE Yutaka [Fri, 4 Dec 2015 05:37:05 +0000 (14:37 +0900)]
scd: Fix for removing the prefix.

* scd/app-openopg.c (do_decipher): Fix the condition.

3 years agoscd: Simplify saving application context.
NIIBE Yutaka [Fri, 4 Dec 2015 05:13:23 +0000 (14:13 +0900)]
scd: Simplify saving application context.

* scd/app.c (lock_table): Remove LAST_APP field.
(lock_reader, app_dump_state, application_notify_card_reset)
(release_application): Follow the change.
(check_conflict): New.
(check_application_conflict): Lock the slot and call check_conflict.
(select_application): Call check_conflict and not use LAST_APP.

--

We don't need LAST_APP field but just keep the application context by
APP field.  Since we have a reference counter, it is possible if we
can deallocate or not.

3 years agoscd: More fix for Curve25519 prefix handling.
NIIBE Yutaka [Fri, 4 Dec 2015 05:02:48 +0000 (14:02 +0900)]
scd: More fix for Curve25519 prefix handling.

* scd/app-openpgp.c (do_decipher): Handle trancated cipher text.
Also fix xfree bug introduced.

--

In old format with no prefix, cipher text can be trancated when it
is parsed as MPI.  Recover the value adding back zeros.

Fixes-commit: 11b2691eddc42e91651e4f95dd2731255a3e9211

3 years agoscd: Another fix for Curve25519 prefix handling.
Werner Koch [Thu, 3 Dec 2015 12:46:03 +0000 (13:46 +0100)]
scd: Another fix for Curve25519 prefix handling.

* scd/app-openpgp.c (do_decipher): Check 0x02 also for 16+1 byte long
INDATA.
(do_decipher): Fix integer arithmetic in void pointer.
(do_decipher): Add missing memcpy.
--

I have not tested this fix but it is obvious.

Fixes-commit: 11b2691eddc42e91651e4f95dd2731255a3e9211
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agobuild: Avoid dependecy problems in "make distcheck".
Werner Koch [Thu, 3 Dec 2015 12:28:28 +0000 (13:28 +0100)]
build: Avoid dependecy problems in "make distcheck".

* doc/Makefile.am (gnupg.texi): Depend on defs.inc.
--

Reported-by: Justus Winter
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agobuild: Change how caller provided CFLAGS are used by configure.
Werner Koch [Thu, 3 Dec 2015 11:51:52 +0000 (12:51 +0100)]
build: Change how caller provided CFLAGS are used by configure.

* configure.ac: Append instead of prepend caller provided CFLAGS.
--

Suggested-by: Justus Winter
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Additional comment on commit a28ac99e.
Werner Koch [Thu, 3 Dec 2015 11:37:56 +0000 (12:37 +0100)]
gpg: Additional comment on commit a28ac99e.

--

My statement that commit 04a6b903 changed the semantics of keydb_new
was plainly wrong.  Not Neal broke it but me when I initially wrote
that function or copied it from gpgsm.

Sorry.

3 years agogpg: Add variant of 'key "%s" not found: %s' error message.
Werner Koch [Thu, 3 Dec 2015 11:25:37 +0000 (12:25 +0100)]
gpg: Add variant of 'key "%s" not found: %s' error message.

* g10/gpg.c (check_user_ids): Change error message.
* g10/delkey.c (do_delete_key): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Make keyidlist more robust in case of errors.
Werner Koch [Thu, 3 Dec 2015 11:19:30 +0000 (12:19 +0100)]
gpg: Make keyidlist more robust in case of errors.

* g10/keyserver.c (keyidlist): Clear *KLIST on error.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Take care of keydb_new returning NULL.
Werner Koch [Thu, 3 Dec 2015 11:18:32 +0000 (12:18 +0100)]
gpg: Take care of keydb_new returning NULL.

* g10/keydb.c (keydb_new): Print an error message if needed.  Also use
xtrycalloc because we return an error anyway.
* g10/delkey.c (do_delete_key): Handle error retruned by keydb_new.
* g10/export.c (do_export_stream): Ditto.
* g10/getkey.c (get_pubkey): Ditto.
(get_pubkey_fast): Ditto.
(get_pubkeyblock): Ditto.
(get_seckey): Ditto.
(key_byname): Ditto.
(get_pubkey_byfprint): Ditto.
(get_pubkey_byfprint_fast): Ditto.
(parse_def_secret_key): Ditto.
(have_secret_key_with_kid): Ditto.
* g10/import.c (import_one): Ditto.
(import_revoke_cert): Ditto.
* g10/keyedit.c (keyedit_quick_adduid): Ditto.
* g10/keygen.c (quick_generate_keypair): Ditto.
(do_generate_keypair): Ditto.
* g10/trustdb.c (validate_keys): Ditto.
* g10/keyserver.c (keyidlist): Ditto.
* g10/revoke.c (gen_desig_revoke): Ditto.
(gen_revoke): Ditto.
* g10/gpg.c (check_user_ids): Ditto.
(main): Do not print an error message for keydb_new error.
* g10/keylist.c (list_all): Use actual error code returned by
keydb_new.

* g10/t-keydb-get-keyblock.c (do_test): Abort on keydb_new error.
* g10/t-keydb.c (do_test): Ditto.

* g10/keyring.c (keyring_new): Actually return an error so that the
existing keydb_new error checking makes sense for a keyring resource.
(keyring_rebuild_cache): Take care of keyring_new returning an error.
--

Commit 04a6b903 changed keydb_new to return an error.  However the
error was not checked at most places which we fix with this patch.  To
make things easier keydb_new prints an error message itself.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Change some error messages.
Werner Koch [Thu, 3 Dec 2015 09:39:29 +0000 (10:39 +0100)]
gpg: Change some error messages.

* g10/getkey.c (parse_def_secret_key): Change error message.  Replace
log_debug by log_info.
* g10/gpg.c (check_user_ids): Make function static.  Change error
messages.
(main): Change error messages.
* g10/revoke.c (gen_revoke): Ditto.
--

There are other smaller changes not described above.

This change tries to avoid new error messages so not to increase the
the number of translated strings or break too many existing
translations.  It also tries to use existing strings and changes the
quoting to the most common style used in gpg.

Key specifications should in general use double quotes.  Other values
should use single quotes.  However. sometimes it is not easy to
distinguish between values given on the command line and key
specifications.  According to old GNU coding standards diagnostics
should not start capitalized - whether this is a good idea is a
different thing but we used this rules for most strings.  However,
strings which are used interactively should be properly capitalized
and end with a dot.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoscd: Fix "Conflicting usage" bug.
NIIBE Yutaka [Thu, 3 Dec 2015 02:26:24 +0000 (11:26 +0900)]
scd: Fix "Conflicting usage" bug.

* scd/apdu.c (apdu_close_reader): Call CLOSE_READER method even if we
  got an error from apdu_disconnect.
* scd/app-common.h (no_reuse): Remove.
* scd/app.c (application_notify_card_reset): Deallocate APP here.
(select_application, release_application): Don't use NO_REUSE.

--

Reproducible scenario: Invoke gpg --card-edit session from a terminal.
Invoke another gpg --card-edit session from another.  Remove a token.
Insert a token again.  Type RET on both terminals.  One of terminal
answers "Conflicting usage".

Perhaps, having NO_REUSE field was to avoid race conditions.  Now,
APP can be safely deallocated by application_notify_card_reset.

Thanks to the2nd.

3 years agoscd: Fix for Curve25519 prefix handling.
NIIBE Yutaka [Wed, 2 Dec 2015 23:48:51 +0000 (08:48 +0900)]
scd: Fix for Curve25519 prefix handling.

* scd/app-openpgp.c (do_decipher): More condition for AES decipher.
  Handle the prefix in cipher text.  Always add the prefix in result.

3 years agogpg: Use the matching key if the search description is exact.
Neal H. Walfield [Wed, 2 Dec 2015 19:51:52 +0000 (20:51 +0100)]
gpg: Use the matching key if the search description is exact.

* g10/gpg.c (check_user_ids): If the search description is for an
exact match (a keyid or fingerprint that ends in '!'), then use the
matching key, not the primary key.
* tests/openpgp/Makefile.am (TESTS): Add use-exact-key.test.
(priv_keys): Add privkeys/00FE67F28A52A8AA08FFAED20AF832DA916D1985.asc,
privkeys/1DF48228FEFF3EC2481B106E0ACA8C465C662CC5.asc,
privkeys/A2832820DC9F40751BDCD375BB0945BA33EC6B4C.asc,
privkeys/ADE710D74409777B7729A7653373D820F67892E0.asc and
privkeys/CEFC51AF91F68A2904FBFF62C4F075A4785B803F.asc.
(sample_keys): Add
samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc.
* tests/openpgp/privkeys/00FE67F28A52A8AA08FFAED20AF832DA916D1985.asc:
New file.
* tests/openpgp/privkeys/1DF48228FEFF3EC2481B106E0ACA8C465C662CC5.asc:
New file.
* tests/openpgp/privkeys/A2832820DC9F40751BDCD375BB0945BA33EC6B4C.asc:
New file.
* tests/openpgp/privkeys/ADE710D74409777B7729A7653373D820F67892E0.asc:
New file.
* tests/openpgp/privkeys/CEFC51AF91F68A2904FBFF62C4F075A4785B803F.asc:
New file.
* tests/openpgp/samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc:
New file.
* tests/openpgp/use-exact-key.test: New file.
* tests/openpgp/version.test: Install the new private keys.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Reported-by: Reported-by: Kristian Fiskerstrand
  <kristian.fiskerstrand@sumptuouscapital.com>
Fixes-commit: 10cca02

3 years agobuild: Require at least Libassuan 2.4.1.
Werner Koch [Wed, 2 Dec 2015 17:47:50 +0000 (18:47 +0100)]
build: Require at least Libassuan 2.4.1.

* configure.ac (NEED_LIBASSUAN_VERSION): Set to 2.4.1.
* agent/gpg-agent.c (create_server_socket): Remove check for
libassuan >= 2.3.0 and >= 2.1.4.
(main): Remove check for libassuan >= 2.1.4.
* scd/scdaemon.c (create_server_socket): Remove check for
libassuan >= 2.1.4.
* dirmngr/dirmngr.c (set_tor_mode): Remove check for
libassuan >= 2.3.0.
* dirmngr/http.c (http_raw_connect, send_request): Remove checks for
libassuan >= 2.3.0.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg: Improve documentation.
Neal H. Walfield [Wed, 2 Dec 2015 14:21:20 +0000 (15:21 +0100)]
gpg: Improve documentation.

* g10/tofu.c (initdb): Improve documentation.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Fix type mismatch resulting in a buffer overflow.
Neal H. Walfield [Wed, 2 Dec 2015 14:20:18 +0000 (15:20 +0100)]
gpg: Fix type mismatch resulting in a buffer overflow.

* g10/tofu.c (record_binding): Change policy_old's type from an enum
tofu_policy to a long: this variable is passed by reference and a long
is expected.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Reported-by: Justus Winter <justus@g10code.com>
Fixes-commit: f77913e

3 years agodirmngr: Switch to an onion address if Tor is running.
Werner Koch [Wed, 2 Dec 2015 10:49:41 +0000 (11:49 +0100)]
dirmngr: Switch to an onion address if Tor is running.

* dirmngr/dirmngr.h (opt): Turn field 'keyserver' into an strlist.
* dirmngr/dirmngr.c (parse_rereadable_options): Allow multiple
--keyserver options.
* dirmngr/server.c (server_local_s): Add field 'tor_state'.
(release_uri_item_list): New.
(release_ctrl_keyservers): Use it.
(start_command_handler): Release list of keyservers.
(is_tor_running): New.
(cmd_getinfo): Re-implement "tor" subcommand using new fucntion.
(ensure_keyserver): Rewrite.
* g10/dirmngr-conf.skel: Add two keyserver options.
--

This feature is independent of --use-tor and automagically uses Tor if
available.  The dirmngr.conf file needs to specify two keyservers to
make this work.  For new installations this is done using the skeleton
file.  This feature requires the Libassuan 2.4.2 to work.

This patch also fixes a memory leak of opt.keyserver en passant.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agohttp: Enhance parser to detect .onion addresses.
Werner Koch [Wed, 2 Dec 2015 09:12:32 +0000 (10:12 +0100)]
http: Enhance parser to detect .onion addresses.

* dirmngr/http.h (parsed_uri_s): Add flag 'onion'.
* dirmngr/http.c (do_parse_uri): Set that flag.
* dirmngr/t-http.c (main): Print flags.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon,gpg: Fix processing of search descriptions ending in '!'.
Neal H. Walfield [Wed, 2 Dec 2015 10:07:05 +0000 (11:07 +0100)]
common,gpg: Fix processing of search descriptions ending in '!'.

* g10/gpg.c (check_user_ids): If the search description describes a
keyid or fingerprint and ends in a '!', include the '!' in the
rewritten description.
* common/userids.c (classify_user_id): Accept keyids and fingerprints
ending in '!'.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Reported-by: Kristian Fiskerstrand
  <kristian.fiskerstrand@sumptuouscapital.com>
Fixes-commit: f99830b7
Fixes-commit: e8c53fca

3 years agodirmngr: Improve error handling.
Justus Winter [Tue, 1 Dec 2015 12:24:38 +0000 (13:24 +0100)]
dirmngr: Improve error handling.

* dirmngr/dns-stuff.c (getsrv): Avoid looking at 'header' before
checking for errors, but silently ignore errors when looking up SRV
records.
--
This is a follow-up to 946faaff.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agoUpdate NEWS file
Werner Koch [Tue, 1 Dec 2015 07:45:03 +0000 (08:45 +0100)]
Update NEWS file

--

3 years agobuild: Let configure show the the status of Tor support
Werner Koch [Tue, 1 Dec 2015 07:04:49 +0000 (08:04 +0100)]
build: Let configure show the the status of Tor support

* configure.ac (show_tor_support): New

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Clarify dirmngr's --keyserver option.
Werner Koch [Mon, 30 Nov 2015 15:01:07 +0000 (16:01 +0100)]
doc: Clarify dirmngr's --keyserver option.

--
GnuPG-bug-id: 2165

3 years agodoc: Typo fix.
Werner Koch [Mon, 30 Nov 2015 10:47:23 +0000 (11:47 +0100)]
doc: Typo fix.

--

3 years agodoc: Make make distcheck work again.
Werner Koch [Mon, 30 Nov 2015 10:45:28 +0000 (11:45 +0100)]
doc: Make make distcheck work again.

* doc/Makefile.am (DISTCLEANFILES): Add gpgkey2ssh.1

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoyat2m: Add keyword @url.
Werner Koch [Mon, 30 Nov 2015 10:32:00 +0000 (11:32 +0100)]
yat2m: Add keyword @url.

* doc/yat2m.c (proc_texi_cmd): Add keyword @url.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Build man pages with the same date as the info files.
Werner Koch [Mon, 30 Nov 2015 10:27:30 +0000 (11:27 +0100)]
doc: Build man pages with the same date as the info files.

* doc/Makefile.am (yat2m-stamp): Use option --date.
--

This changes allows reproducible builds.

Debian-bug-id: 806494

3 years agoyat2m: New option --date.
Werner Koch [Mon, 30 Nov 2015 10:25:37 +0000 (11:25 +0100)]
yat2m: New option --date.

* doc/yat2m.c (opt_date): new.
(isodatestring): Use it if set.
(main): New option --date.

3 years agogpg: Avoid extra translation strings.
Werner Koch [Fri, 27 Nov 2015 17:23:33 +0000 (18:23 +0100)]
gpg: Avoid extra translation strings.

* g10/keyedit.c (menu_expire): Use only one prompt.
--

The old code was anyway not fully i18n because it did not used
ngettext.  Further we ran into const char*/char* conflicts on Windows
where we use a different gettext implementation.

FWIW: A better pattern in the case of a static and a malloced string
w/o error return on malloc failure would be:

  const char *s;
  char *s_buf;
  s_buf = xtryasprintf ("%d foo", n);
  if (!s_buf)
    s = "several foo";
  else
    s = s_buf;
  bar (s);
  xfree (s_buf);

3 years agokbx: Include gpg-error prior to mischelp.h.
Werner Koch [Fri, 27 Nov 2015 17:10:31 +0000 (18:10 +0100)]
kbx: Include gpg-error prior to mischelp.h.

* kbx/keybox-init.c: Change order of includes.
--

This is to avoid redefintion warnings about GPGRT_ATTR_PRINTF.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agogpg,w32: Fix a format string error.
Werner Koch [Fri, 27 Nov 2015 16:59:52 +0000 (17:59 +0100)]
gpg,w32: Fix a format string error.

* g10/keyring.c (keyring_search): Fix format string for off_t.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoSilence compiler warnings related to not using assuan_fd_t.
Werner Koch [Fri, 27 Nov 2015 16:58:51 +0000 (17:58 +0100)]
Silence compiler warnings related to not using assuan_fd_t.

* common/call-gpg.c (start_gpg): Use assuan_fd_t.  Note that the
declaration was already fixed by a previous change.
* dirmngr/server.c (cmd_getinfo): Use assuan_fd_t.
--

Note that this matters only for Windows and it does not harm as long
as we can only build for 32 bit Windows withsizeof(int)==sizeof(void*).

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoSilence unused variable or parameter warnings.
Werner Koch [Fri, 27 Nov 2015 16:53:52 +0000 (17:53 +0100)]
Silence unused variable or parameter warnings.

--

3 years agoAvoid incompatible pointer assignment warnings on Windows.
Werner Koch [Fri, 27 Nov 2015 17:30:14 +0000 (18:30 +0100)]
Avoid incompatible pointer assignment warnings on Windows.

* common/logging.c (fun_writer): Use gpgrt_ssize_t instead of ssize_t.
* dirmngr/server.c (data_line_cookie_write): Ditto.
* sm/certdump.c (format_name_writer): Ditto.
* sm/server.c (data_line_cookie_write): Ditto.
* dirmngr/http.c (cookie_read, cookie_write): Ditto.
--

See the release notes of libgpg-error 1.15 for background info on
gpgrt_ssize_t.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Avoid a declarations after statements.
Werner Koch [Fri, 27 Nov 2015 16:12:56 +0000 (17:12 +0100)]
dirmngr: Avoid a declarations after statements.

* tools/gpgtar.c (parse_arguments): Use a block for a local varibale
definition.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Avoid casting away a const from an char**.
Werner Koch [Fri, 27 Nov 2015 16:10:59 +0000 (17:10 +0100)]
dirmngr: Avoid casting away a const from an char**.

* dirmngr/ldap.c (start_cert_fetch_ldap): Do not use pointers from
global variables.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Allow testing for a running Tor via "getinfo tor".
Werner Koch [Fri, 27 Nov 2015 11:21:45 +0000 (12:21 +0100)]
dirmngr: Allow testing for a running Tor via "getinfo tor".

* dirmngr/server.c (cmd_getinfo): Print an S line if Tor is not
running.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agog13: Fix commit 1a045b13.
Werner Koch [Thu, 26 Nov 2015 17:10:05 +0000 (18:10 +0100)]
g13: Fix commit 1a045b13.

* g13/g13.c (main): Use existsing function.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocommon: Fix off-by-one access in the new format_text.
Werner Koch [Thu, 26 Nov 2015 17:04:54 +0000 (18:04 +0100)]
common: Fix off-by-one access in the new format_text.

* common/stringhelp.c (format_text): Use existsing fucntion to trim
trailing spaces.  Fix off-by-one access.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Improve output of "getinfo tor".
Werner Koch [Thu, 26 Nov 2015 16:35:56 +0000 (17:35 +0100)]
dirmngr: Improve output of "getinfo tor".

* dirmngr/server.c (cmd_getinfo): Print a message along with OK.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodirmngr: Let Libassuan employ nPth wrappers for connect.
Werner Koch [Thu, 26 Nov 2015 16:15:08 +0000 (17:15 +0100)]
dirmngr: Let Libassuan employ nPth wrappers for connect.

* dirmngr/http.c (my_unprotect, my_protect): Remove.
(connect_server): Do not use these wrappers.
--

Since Libassuan version 2.4.2 the macro ASSUAN_SYSTEM_NPTH_IMPL
protects the low-level connect calls with npth_unprotect and
npth_protect.  This is better than the high-level kludge we used here.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agotools/gpgtar: Add '--dry-run'.
Justus Winter [Thu, 26 Nov 2015 16:05:12 +0000 (17:05 +0100)]
tools/gpgtar: Add '--dry-run'.

* tools/gpgtar-extract.c (extract_{regular,directory}): Honor
'--dry-run'.
* tools/gpgtar.c (enum cmd_and_opt_values): New value.
(opts): Add '--dry-run'.
(parse_arguments): Handle '--dry-run'.
* tools/gpgtar.h (opt): Add field 'dry_run'.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotools/gpgtar: Handle '--gpg-args'.
Justus Winter [Thu, 26 Nov 2015 14:36:52 +0000 (15:36 +0100)]
tools/gpgtar: Handle '--gpg-args'.

* tools/gpgtar-create.c (gpgtar_create): Use given arguments.
* tools/gpgtar-extract.c (gpgtar_extract): Likewise.
* tools/gpgtar-list.c (gpgtar_list): Likewise.
* tools/gpgtar.c (enum cmd_and_opt_values): New value.
(opts): Add 'gpg-args'.
(parse_arguments): Handle arguments.
* tools/gpgtar.h (opt): Add field 'gpg_arguments'.
* tests/openpgp/gpgtar.test: Simplify accordingly.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agocommon: Make the GPG arguments configurable in call-gpg.
Justus Winter [Thu, 26 Nov 2015 14:01:40 +0000 (15:01 +0100)]
common: Make the GPG arguments configurable in call-gpg.

* common/call-gpg.c (start_gpg): Add parameter 'gpg_arguments'.
(_gpg_encrypt, gpg_encrypt_blob, gpg_encrypt_stream): Likewise.
(_gpg_decrypt, gpg_decrypt_blob, gpg_decrypt_stream): Likewise.
* common/call-gpg.h: Adapt prototypes.
* g13/create.c (encrypt_keyblob): Adapt callsite.
* g13/g13-common.h (opt): Add field 'gpg_arguments'.
* g13/g13.c (main): Construct default arguments.
* g13/mount.c (decrypt_keyblob): Adapt callsite.
* tools/gpgtar-create.c (gpgtar_create): Likewise.
* tools/gpgtar-extract.c (gpgtar_extract): Likewise.
* tools/gpgtar-list.c (gpgtar_list): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotools/gpgtar: Handle '--tar-args' for compatibility with gpg-zip.
Justus Winter [Thu, 26 Nov 2015 13:08:48 +0000 (14:08 +0100)]
tools/gpgtar: Handle '--tar-args' for compatibility with gpg-zip.

* tools/gpgtar.c (enum cmd_and_opt_values): New value.
(opts): Add new group for tar options, rearrange a little, add
'--tar-args'.
(tar_opts): New variable.
(shell_parse_stringlist): New function.
(shell_parse_argv): Likewise.
(parse_arguments): Add option argument, handle '--tar-args'.
(main): Fix invokation of 'parse_arguments'.
* tests/openpgp/gpgtar.test: Simplify decryption.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotools/gpgtar: Rework argument parsing.
Justus Winter [Thu, 26 Nov 2015 10:46:35 +0000 (11:46 +0100)]
tools/gpgtar: Rework argument parsing.

* tools/gpgtar.c (main): Move argument parsing into its own function.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotests: Add tests for gpgtar and gpg-zip.
Justus Winter [Wed, 25 Nov 2015 17:32:09 +0000 (18:32 +0100)]
tests: Add tests for gpgtar and gpg-zip.

* tests/openpgp/Makefile.am (TESTS): Add new file.
* tests/openpgp/gpgtar.test: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotools/gpgtar: Handle '--directory' argument.
Justus Winter [Wed, 25 Nov 2015 17:29:22 +0000 (18:29 +0100)]
tools/gpgtar: Handle '--directory' argument.

* tools/gpgtar-extract.c (gpgtar_extract): Only generate a directory
name if none is given via arguments.
* tools/gpgtar.c (enum cmd_and_opt_values): New constant.
(opts): Add argument.
(main): Parse argument.
* tools/gpgtar.h (opt): New field 'directory'.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotools/gpgtar: Handle '--gpg' argument.
Justus Winter [Wed, 25 Nov 2015 13:57:14 +0000 (14:57 +0100)]
tools/gpgtar: Handle '--gpg' argument.

* tools/gpgtar-create.c (gpgtar_create): Use given gpg program.
* tools/gpgtar-extract.c (gpgtar_extract): Likewise.
* tools/gpgtar-list.c (gpgtar_list): Likewise.
* tools/gpgtar.c (enum cmd_and_opt_values): New constant.
(opts): Add argument.
(main): Handle argument.
* tools/gpgtar.h (opt): Add field 'gpg_program'.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotools/gpgtar: Improve error handling.
Justus Winter [Wed, 25 Nov 2015 12:39:50 +0000 (13:39 +0100)]
tools/gpgtar: Improve error handling.

* tools/gpgtar-create.c (gpgtar_create): Return an error code, fix
error handling.
* tools/gpgtar-extract.c (gpgtar_extract): Likewise.
* tools/gpgtar-list.c (read_header): Return an error code.
(gpgtar_list): Return an error code, fix error handling.
(gpgtar_read_header): Return an error code.
* tools/gpgtar.c: Add missing include.
(main): Print an generic error message if a command failed and no
error has been printed yet.
* tools/gpgtar.h (gpgtar_{create,extract,list,read_header}): Fix the
prototypes accordingly.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agotools: Add encryption and decryption support to gpgtar.
Justus Winter [Tue, 24 Nov 2015 17:39:30 +0000 (18:39 +0100)]
tools: Add encryption and decryption support to gpgtar.

* tools/Makefile.am: Amend CFLAGS and LDADD.
* tools/gpgtar-create.c (gpgtar_create): Add encrypt flag and encrypt
stream if requested.
* tools/gpgtar-extract.c (gpgtar_extract): Likewise for decryption.
* tools/gpgtar-list.c (gpgtar_list): Likewise.
* tools/gpgtar.c (main): Initialize npth and assuan.  Parse recipient
and local user, and note which flags are currently ignored.  Adapt
calls to gpgtar_list and friends.
(tar_and_encrypt): Drop stub function and prototype.
(decrypt_and_untar): Likewise.
(decrypt_and_list): Likewise.
* tools/gpgtar.h (gpgtar_{create,extract,list}): Add encryption or
decryption argument.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agocommon: Add stream interface to call-pgp.
Justus Winter [Tue, 24 Nov 2015 17:31:14 +0000 (18:31 +0100)]
common: Add stream interface to call-pgp.

* common/call-gpg.c (struct writer_thread_parms): Add field 'stream'.
(writer_thread_main): Support reading from a stream.
(start_writer): Add stream argument.
(struct reader_thread_parms): Add field 'stream'.
(reader_thread_main): Support writing to a stream.
(start_reader): Add stream argument.
(_gpg_encrypt): Add stream api.
(gpg_encrypt_blob): Adapt accordingly.
(gpg_encrypt_stream): New function.
(_gpg_decrypt): Add stream api.
(gpg_decrypt_blob): Adapt accordingly.
(gpg_decrypt_stream): New function.
* common/call-gpg.h (gpg_encrypt_stream): New prototype.
(gpg_decrypt_stream): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agocommon: Refactor the call-gpg code.
Justus Winter [Tue, 24 Nov 2015 13:58:31 +0000 (14:58 +0100)]
common: Refactor the call-gpg code.

* common/call-gpg.c (gpg_{en,de}crypt_blob): Move most of the code
into two new functions, _gpg_encrypt and _gpg_decrypt.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agog13: Move 'call-gpg.c' to common.
Justus Winter [Tue, 24 Nov 2015 12:40:56 +0000 (13:40 +0100)]
g13: Move 'call-gpg.c' to common.

* common/Makefile.am (common_sources): Add files.
* g13/call-gpg.c: Move to 'common' and adapt slightly.  Add a
parameter to let callees override the gpg program to execute.
* g13/call-gpg.h: Likewise.
* g13/Makefile.am (g13_SOURCES): Drop files.
* g13/create.c (encrypt_keyblob): Hand in the gpg program to execute.
* g13/mount.c (decrypt_keyblob): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agogpg: When comparing keyids, use the keyid, not the fingerprint's suffix.
Neal H. Walfield [Tue, 24 Nov 2015 12:03:24 +0000 (13:03 +0100)]
gpg: When comparing keyids, use the keyid, not the fingerprint's suffix.

* g10/keyedit.c (menu_select_key): Use spacep and hexdigitp instead of
inline tests.  Don't compare P to the suffix of the fingerprint.  If P
appears to be a keyid, do an exact compare against the keyid.  If it
appears to be a fingerprint, do an exact compare against the
fingerprint.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Reflow long texts.
Neal H. Walfield [Mon, 23 Nov 2015 21:20:28 +0000 (22:20 +0100)]
gpg: Reflow long texts.

* common/stringhelp.c (format_text): New function.
* common/t-stringhelp.c (stresc): New function.
(test_format_text): New function.  Test format_text.
* g10/tofu.c (get_trust): Use format_text to reflow long texts.
(show_statistics): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agocommon: Extend utf8_charcount to include the string's length.
Neal H. Walfield [Mon, 23 Nov 2015 21:13:56 +0000 (22:13 +0100)]
common: Extend utf8_charcount to include the string's length.

* common/stringhelp.c (utf8_charcount): Take additional parameter,
len.  Process at most LEN bytes.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agodirmngr: Fix http lookups when libadns is used.
Justus Winter [Mon, 23 Nov 2015 14:41:36 +0000 (15:41 +0100)]
dirmngr: Fix http lookups when libadns is used.

* dirmngr/dns-stuff.c (resolve_name_adns): Fill in the port.
--
Previously, sin_port was set to zero, making connect fail.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Fix SRV record lookups when using the system resolver.
Justus Winter [Mon, 23 Nov 2015 14:46:33 +0000 (15:46 +0100)]
dirmngr: Fix SRV record lookups when using the system resolver.

* dirmngr/dns-stuff.c (getsrv): Fix error handling.
--
This fixes hkp server pools not using SRV records.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Honor ports specified in SRV records.
Justus Winter [Thu, 19 Nov 2015 14:03:30 +0000 (15:03 +0100)]
dirmngr: Honor ports specified in SRV records.

* dirmngr/ks-engine-hkp.c (struct hostinfo_s): New field 'port'.
(create_new_hostinfo): Initialize 'port'.
(add_host): Add host parameter and update the hosttable entry.
(map_host): Return port if known, adjust calls to 'add_host'.
(make_host_part): Let 'map_host' specify the port if known.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Support hkp server pools using SRV records.
Justus Winter [Thu, 19 Nov 2015 13:29:36 +0000 (14:29 +0100)]
dirmngr: Support hkp server pools using SRV records.

* dirmngr/ks-engine-hkp.c (map_host): Handle SRV records.
--
Signed-off-by: Justus Winter <justus@g10code.com>
GnuPG-bug-id: 1788

3 years agodirmngr: Refactor 'map_host'.
Justus Winter [Thu, 19 Nov 2015 12:00:59 +0000 (13:00 +0100)]
dirmngr: Refactor 'map_host'.

* dirmngr/ks-engine-hkp.c (add_host): New function.
(map_host): Use the new function.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Fix pool detection.
Justus Winter [Mon, 23 Nov 2015 12:59:01 +0000 (13:59 +0100)]
dirmngr: Fix pool detection.

* dirmngr/ks-engine-hkp (arecords_is_pool): Fix counting IP addresses.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Refactor 'map_host'.
Justus Winter [Thu, 19 Nov 2015 11:43:23 +0000 (12:43 +0100)]
dirmngr: Refactor 'map_host'.

* dirmngr/ks-engine-hkp.c (arecords_is_pool): New function.
(map_host): Use the new function.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Start dirmngr on demand.
Justus Winter [Mon, 23 Nov 2015 10:44:50 +0000 (11:44 +0100)]
dirmngr: Start dirmngr on demand.

* common/asshelp.h: Include 'util.h'.
* dirmngr/dirmngr-client.c (main): Use 'start_new_dirmngr' to connect
to the dirmngr.
(start_dirmngr): Drop now unused declaration and function.
--
Signed-off-by: Justus Winter <justus@g10code.com>
GnuPG-bug-id: 1843

3 years agogpg: If sqlite is not available, don't build things depending on it.
Neal H. Walfield [Mon, 23 Nov 2015 11:39:22 +0000 (12:39 +0100)]
gpg: If sqlite is not available, don't build things depending on it.

* configure.ac: Define the automake conditional SQLITE3.
* tests/openpgp/Makefile.am (TESTS): Move the sqlite3 dependent tests
to...
(sqlite3_dependent_tests): ... this new variable.  If SQLITE3 is not
defined, then clear this variable.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Allow updating the expiration time of multiple subkeys at once.
Neal H. Walfield [Mon, 23 Nov 2015 11:16:33 +0000 (12:16 +0100)]
gpg: Allow updating the expiration time of multiple subkeys at once.

* g10/keyedit.c (menu_expire): Allow updating the expiration time of
multiple subkeys at once.

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

3 years agogpg: Don't crash if key is not passed an argument.
Neal H. Walfield [Mon, 23 Nov 2015 10:21:24 +0000 (11:21 +0100)]
gpg: Don't crash if key is not passed an argument.

* g10/keyedit.c (menu_select_key): Don't crash if P is NULL.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Fail if the search description passed to --gen-revoke is ambiguous.
Neal H. Walfield [Fri, 20 Nov 2015 12:00:19 +0000 (13:00 +0100)]
gpg: Fail if the search description passed to --gen-revoke is ambiguous.

* g10/revoke.c (gen_revoke): Error out if the search description is
ambiguous.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Refactor print_seckey_info.
Neal H. Walfield [Fri, 20 Nov 2015 11:52:04 +0000 (12:52 +0100)]
gpg: Refactor print_seckey_info.

* g10/keylist.c (print_seckey_info): Break formatting functionality
into...
(format_seckey_info): ... this new function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Improve an error message.
Neal H. Walfield [Fri, 20 Nov 2015 11:17:13 +0000 (12:17 +0100)]
gpg: Improve an error message.

* g10/revoke.c (gen_revoke): Provide a more descriptive error message
if searching for a key fails.

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

3 years agodirmngr: Improve error handling.
Justus Winter [Thu, 19 Nov 2015 16:37:32 +0000 (17:37 +0100)]
dirmngr: Improve error handling.

* dirmngr/crlcache.c (crl_cache_cert_isvalid): Add missing break.
--
Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Fix memory leak.
Justus Winter [Thu, 19 Nov 2015 15:45:09 +0000 (16:45 +0100)]
dirmngr: Fix memory leak.

* dirmngr/ldap.c (start_cert_fetch_ldap): Avoid leaking all malloc'ed
arguments.
--
Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agoagent: Improve error handling.
Justus Winter [Thu, 19 Nov 2015 15:18:20 +0000 (16:18 +0100)]
agent: Improve error handling.

* agent/trustlist.c (istrusted_internal): Initialize 'err'.
--
There is a plausible path of execution so that a branch condition uses
the uninitialized value.

Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agocommon: Avoid undefined behavior.
Justus Winter [Thu, 19 Nov 2015 15:13:55 +0000 (16:13 +0100)]
common: Avoid undefined behavior.

* common/iobuf.c (iobuf_esopen): Initialize 'len' as 'file_es_filter'
will make use of it.
--
Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agog10: Avoid undefined behavior.
Justus Winter [Thu, 19 Nov 2015 14:48:01 +0000 (15:48 +0100)]
g10: Avoid undefined behavior.

* g10/trust.c (clean_one_uid): Avoid a computation involving an
uninitialized value.
--
Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agoscd: Improve error handling.
Justus Winter [Tue, 17 Nov 2015 17:05:51 +0000 (18:05 +0100)]
scd: Improve error handling.

* scd/app-openpgp.c (get_public_key): Improve error handling.
--
Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Fix typo.
Justus Winter [Thu, 19 Nov 2015 13:38:30 +0000 (14:38 +0100)]
dirmngr: Fix typo.

--
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodirmngr: Gracefully handle premature termination of TLS streams. fix-1950
Justus Winter [Wed, 18 Nov 2015 14:06:48 +0000 (15:06 +0100)]
dirmngr: Gracefully handle premature termination of TLS streams.

* dirmngr/http.c (close_tls_session): New function.
(session_unref): Use the new function to close the TLS stream.
(cookie_read): If the stream terminated prematurely, close it and
return a short read.
--
With this patch, I was able to update all the keys in the Debian
keyring over hkps.

Signed-off-by: Justus Winter <justus@g10code.com>
GnuPG-bug-id: 1950

3 years agotools: Fix option parsing for gpg-zip.
Neal H. Walfield [Tue, 17 Nov 2015 21:15:33 +0000 (22:15 +0100)]
tools: Fix option parsing for gpg-zip.

* tools/gpg-zip.in: Correctly set GPG when --gpg is specified.
Correctly set TAR when --tar is specified.  Pass TAR_ARGS to tar.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Co-authored-by: Michael Mönch <michael.moench@marktjagd.de>
GnuPG-bug-id 1351
GnuPG-bug-id 1442

3 years agogpg: Allow selecting subkeys using a keyid.
Neal H. Walfield [Tue, 17 Nov 2015 20:21:03 +0000 (21:21 +0100)]
gpg: Allow selecting subkeys using a keyid.

* g10/keyedit.c (menu_select_key): Take an additional argument, p.
Update callers.  If P is a hex string, then assume that P is a key id
or fingerprint and select subkeys with matching key ids or
fingerprints.
* doc/gpg.texi: Update documentation for the key subcommand.

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

3 years agodirmngr: Fix specifying keyservers by IP address.
Justus Winter [Mon, 16 Nov 2015 17:18:25 +0000 (18:18 +0100)]
dirmngr: Fix specifying keyservers by IP address.

* dirmngr/ks-engine-hkp.c (map_host): Update the original 'hosttable'
entry instead of creating another one.
--
Previously, if a keyserver was given using its IP address
(e.g. 'hkp://127.0.0.1'), 'map_host' would create two entries in the
'hosttable', one with the name '127.0.0.1', and the second one with
the name 'localhost' and 'v4addr' being set to '127.0.0.1'.  But the
first entry is the one being used for lookups, and since the 'v4' flag
is not set, the 'HTTP_FLAG_IGNORE_IPv4' is used when doing the http
request, making it fail.

Signed-off-by: Justus Winter <justus@g10code.com>
GnuPG-bug-id: 2012

3 years agogpg: Change keydb_search to not return legacy keys.
Neal H. Walfield [Tue, 17 Nov 2015 13:38:03 +0000 (14:38 +0100)]
gpg: Change keydb_search to not return legacy keys.

* g10/keyring.c (keyring_search): Take new argument, ignore_legacy.
If set, skip any legacy keys.  Update callers.
* g10/keydb.c (keydb_search): Skip any legacy keys.
(keydb_search_first): Don't skip legacy keys.  Treat them
as an error.
(keydb_search_next): Likewise.
(keydb_search_fpr): Likewise.
* g10/export.c (do_export_stream): Likewise.
* g10/getkey.c (lookup): Likewise.
(have_secret_key_with_kid): Likewise.
* g10/keylist.c (list_all): Likewise.
(keyring_rebuild_cache): Likewise.
* g10/keyserver.c (keyidlist): Likewise.
* g10/trustdb.c (validate_key_list): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Correctly handle an error.
Neal H. Walfield [Tue, 17 Nov 2015 11:56:55 +0000 (12:56 +0100)]
gpg: Correctly handle an error.

* g10/keyring.c (keyring_search): If a compare function returns an
error, treat it as an error.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Correctly handle keyblocks followed by legacy keys.
Neal H. Walfield [Tue, 17 Nov 2015 11:55:42 +0000 (12:55 +0100)]
gpg: Correctly handle keyblocks followed by legacy keys.

* g10/keyring.c (keyring_get_keyblock): If we encounter a legacy
packet after already having some non-legacy packets, then treat the
legacy packet as a keyblock boundary, not as part of the keyblock.
* g10/t-keydb-get-keyblock.c: New file.
* g10/t-keydb-get-keyblock.gpg: New file.
* g10/Makefile.am (EXTRA_DIST): Add t-keydb-get-keyblock.gpg.
(module_tests): Add t-keydb-get-keyblock.
(t_keydb_get_keyblock_SOURCES): New variable.
(t_keydb_get_keyblock_LDADD): Likewise.

--
Signed-off-by: Neal H. Walfield
GnuPG-bug-id: 2151

3 years agogpg: Add some debugging output.
Neal H. Walfield [Mon, 16 Nov 2015 19:55:34 +0000 (20:55 +0100)]
gpg: Add some debugging output.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Make debugging search descriptors easier.
Neal H. Walfield [Tue, 17 Nov 2015 10:36:38 +0000 (11:36 +0100)]
gpg: Make debugging search descriptors easier.

* g10/keydb.c (dump_search_desc): Rename from this...
(keydb_search_desc_dump): ... to this.  Only process a single search
descriptor.  Improve output.  Don't mark as static.  Update callers.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Add function format_keyid.
Neal H. Walfield [Tue, 17 Nov 2015 10:47:43 +0000 (11:47 +0100)]
gpg: Add function format_keyid.

* g10/options.h (opt.keyid_format): Add new value KF_DEFAULT.
* g10/keyid.c (format_keyid): New function.
(keystr): Use it.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agogpg: Use a more appropriate error code.
Neal H. Walfield [Tue, 17 Nov 2015 12:42:43 +0000 (13:42 +0100)]
gpg: Use a more appropriate error code.

* g10/gpg.c (check_user_ids): Return a more appropriate error code if
a user id is ambiguous.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
3 years agoFix typos found using codespell.
Justus Winter [Mon, 16 Nov 2015 11:41:46 +0000 (12:41 +0100)]
Fix typos found using codespell.

* agent/cache.c: Fix typos.
* agent/call-pinentry.c: Likewise.
* agent/call-scd.c: Likewise.
* agent/command-ssh.c: Likewise.
* agent/command.c: Likewise.
* agent/divert-scd.c: Likewise.
* agent/findkey.c: Likewise.
* agent/gpg-agent.c: Likewise.
* agent/w32main.c: Likewise.
* common/argparse.c: Likewise.
* common/audit.c: Likewise.
* common/audit.h: Likewise.
* common/convert.c: Likewise.
* common/dotlock.c: Likewise.
* common/exechelp-posix.c: Likewise.
* common/exechelp-w32.c: Likewise.
* common/exechelp-w32ce.c: Likewise.
* common/exechelp.h: Likewise.
* common/helpfile.c: Likewise.
* common/i18n.h: Likewise.
* common/iobuf.c: Likewise.
* common/iobuf.h: Likewise.
* common/localename.c: Likewise.
* common/logging.c: Likewise.
* common/openpgp-oid.c: Likewise.
* common/session-env.c: Likewise.
* common/sexputil.c: Likewise.
* common/sysutils.c: Likewise.
* common/t-sexputil.c: Likewise.
* common/ttyio.c: Likewise.
* common/util.h: Likewise.
* dirmngr/cdblib.c: Likewise.
* dirmngr/certcache.c: Likewise.
* dirmngr/crlcache.c: Likewise.
* dirmngr/dirmngr-client.c: Likewise.
* dirmngr/dirmngr.c: Likewise.
* dirmngr/dirmngr_ldap.c: Likewise.
* dirmngr/dns-stuff.c: Likewise.
* dirmngr/http.c: Likewise.
* dirmngr/ks-engine-hkp.c: Likewise.
* dirmngr/ks-engine-ldap.c: Likewise.
* dirmngr/ldap-wrapper.c: Likewise.
* dirmngr/ldap.c: Likewise.
* dirmngr/misc.c: Likewise.
* dirmngr/ocsp.c: Likewise.
* dirmngr/validate.c: Likewise.
* g10/encrypt.c: Likewise.
* g10/getkey.c: Likewise.
* g10/gpg.c: Likewise.
* g10/gpgv.c: Likewise.
* g10/import.c: Likewise.
* g10/keydb.c: Likewise.
* g10/keydb.h: Likewise.
* g10/keygen.c: Likewise.
* g10/keyid.c: Likewise.
* g10/keylist.c: Likewise.
* g10/keyring.c: Likewise.
* g10/mainproc.c: Likewise.
* g10/misc.c: Likewise.
* g10/options.h: Likewise.
* g10/packet.h: Likewise.
* g10/parse-packet.c: Likewise.
* g10/pkclist.c: Likewise.
* g10/pkglue.c: Likewise.
* g10/plaintext.c: Likewise.
* g10/server.c: Likewise.
* g10/sig-check.c: Likewise.
* g10/sqlite.c: Likewise.
* g10/tdbio.c: Likewise.
* g10/test-stubs.c: Likewise.
* g10/tofu.c: Likewise.
* g10/trust.c: Likewise.
* g10/trustdb.c: Likewise.
* g13/create.c: Likewise.
* g13/mountinfo.c: Likewise.
* kbx/keybox-blob.c: Likewise.
* kbx/keybox-file.c: Likewise.
* kbx/keybox-init.c: Likewise.
* kbx/keybox-search-desc.h: Likewise.
* kbx/keybox-search.c: Likewise.
* kbx/keybox-update.c: Likewise.
* scd/apdu.c: Likewise.
* scd/app-openpgp.c: Likewise.
* scd/app-p15.c: Likewise.
* scd/app.c: Likewise.
* scd/ccid-driver.c: Likewise.
* scd/command.c: Likewise.
* scd/iso7816.c: Likewise.
* sm/base64.c: Likewise.
* sm/call-agent.c: Likewise.
* sm/call-dirmngr.c: Likewise.
* sm/certchain.c: Likewise.
* sm/gpgsm.c: Likewise.
* sm/import.c: Likewise.
* sm/keydb.c: Likewise.
* sm/minip12.c: Likewise.
* sm/qualified.c: Likewise.
* sm/server.c: Likewise.
* tools/gpg-check-pattern.c: Likewise.
* tools/gpgconf-comp.c: Likewise.
* tools/gpgkey2ssh.c: Likewise.
* tools/gpgparsemail.c: Likewise.
* tools/gpgtar.c: Likewise.
* tools/rfc822parse.c: Likewise.
* tools/symcryptrun.c: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>