1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-01 22:28:02 +02:00
Commit Graph

6278 Commits

Author SHA1 Message Date
Werner Koch
6308c30019
dirmngr: Terminate on deletion of the socket file (Linux only).
* dirmngr/dirmngr.c [HAVE_INOTIFY_INIT]: Include sys/inotify.h.
(oDisableCheckOwnSocket): New.
(opts): Add --disable-check-own-socket.
(disable_check_own_socket): New var.
(parse_rereadable_options): Set that var.
(my_inotify_is_name) [HAVE_INOTIFY_INIT]: New.
(handle_connections) [HAVE_INOTIFY_INIT]: New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-07 12:36:48 +02:00
Neal H. Walfield
bde29a46ce g10: Use the time a signature was seen, not the embedded time, for stats
* g10/tofu.c (ask_about_binding): Use the time that a signature was
seen, not allegedly generated, when generating statistics.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-07 11:17:47 +02:00
Neal H. Walfield
a937eef2d4 tests: Don't use --tofu-db-format.
* tests/openpgp/tofu.scm: Remove use of --tofu-db-format, which is
deprecated.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-07 11:02:51 +02:00
Neal H. Walfield
ee06b3f788 g10: Check for a new binding a bit later.
* g10/tofu.c (build_conflict_set): Check for the current key after
looking for conflicts and removing any '!'.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Fixes-commit: 1f1f56e6
2016-09-07 10:53:28 +02:00
Neal H. Walfield
7b3e8572e3 g10: Change TOFU code to respect --faked-system-time.
* g10/tofu.c (record_binding): New parameter now.  Update callers.
Don't use SQLite's strftime('%s','now') to get the current time, use
NOW.
(ask_about_binding): Likewise.
(get_trust): New parameter now.  Update callers.
(show_statistics): Likewise.
(tofu_register_signature): Don't use SQLite's strftime('%s','now') to
get the current time, use gnupg_get_time().
(tofu_register_encryption): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-07 10:28:39 +02:00
Neal H. Walfield
56c18408d4 g10: Use the correct conversion function.
* g10/tofu.c (show_statistics): Use string_to_ulong, not
string_to_long.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Fixes-commit: 875ac921
2016-09-07 10:06:58 +02:00
Neal H. Walfield
1f90d3c71e g10: Add missing sqrtu32.h and sqrtu32.c.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Fixes-commit: 875ac92.
2016-09-07 08:55:17 +02:00
Werner Koch
97a67d42dc
gpg: Fix format string issues in tofu.
* g10/tofu.c (write_stats_status): Use ulong for MESSSAGES.  Fix
format strings.  Simplify by using the new write_status_printf.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-07 08:41:48 +02:00
Werner Koch
c894fa8d37
g10: Temporary hack to repalce missing sqrtu32.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-07 08:40:18 +02:00
Neal H. Walfield
13ddc17ddb g10: Make sure some functions are passed a primary key.
* g10/tofu.c (get_trust): Make sure the caller provides a primary key.
(tofu_register_signature): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-06 22:40:59 +02:00
Neal H. Walfield
ee19eacd1d g10: Tweak TOFU's verbosity.
* g10/tofu.c (time_ago_str): Only show the most significant unit.
* g10/tofu.c (show_statistics): Tweak the output.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-06 22:40:01 +02:00
Neal H. Walfield
67cef405cb g10: Only show the TOFU warning once per key.
* g10/tofu.c (show_statistics): Return whether to call show_warning.
Move the warning from here...
(show_warning): ... to this new function.
(tofu_get_validity): If show_statistics returns a non-zero value, call
show_warning.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-06 22:10:57 +02:00
Neal H. Walfield
875ac9216f g10: Record and show statistics for encrypted messages when using TOFU
* g10/tofu.c: Include "sqrtu32.h".
(struct tofu_dbs_s.s): Rename get_trust_gather_other_keys to
get_trust_gather_signature_stats.  Add new field
get_trust_gather_encryption_stats.
(initdb): Create the encryptions table.
(ask_about_binding): Show the encryption statistics too.
(tofu_register): Rename from this...
(tofu_register_signature): ... to this and update callers.
(tofu_register_encryption): New function.
(write_stats_status): Add parameters encryption_count,
encryption_first_done and encryption_most_recent.  Update callers.
Compute the trust using the euclidean distance of the signature and
signature count.  Compare with twice the threshold.  Include
encryption count information in the TFS and TOFU_STATS lines.
(show_statistics): Also get information about the encrypted messages.
* g10/trustdb.c (tdb_get_validity_core): Use it.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-06 21:37:48 +02:00
Neal H. Walfield
a9e6db6c7e g10: Simplify the binding statistics shown for a TOFU conflict.
* g10/tofu.c (ask_about_binding): Simplify binding statistics.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-06 21:37:47 +02:00
Justus Winter
f2249b7370 gpgscm: Fix detection of unbalanced parenthesis.
* tests/gpgscm/main.c (load): Print error message.
* tests/gpgscm/scheme.c (opexe_0): Correctly report nesting level when
loading files.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-06 16:46:31 +02:00
Justus Winter
213b3cf465 tests: Fix test.
* tests/openpgp/multisig.scm: Add missing parenthesis.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-06 16:46:31 +02:00
Werner Koch
650356148a
agent: Terminate on deletion of the socket file (Linux only).
* configure.ac (AC_CHECK_FUNCS): Chec for inotify_init.
* agent/gpg-agent.c [HAVE_INOTIFY_INIT]: Include sys/inotify.h.
(my_inotify_is_name) [HAVE_INOTIFY_INIT]: New.
(handle_connections) [HAVE_INOTIFY_INIT]: New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-06 11:00:12 +02:00
Justus Winter
46c4333c37 tests: Speed up the test suite.
* tests/openpgp/run-tests.scm (test::run-sync): Pass additional
arguments to the test.
(test::run-sync-quiet): Likewise.
(test::run-async): Likewise.
(run-tests-{parallel,sequential}-isolated): Create a tarball of the
gnupghome, then extract it for each test.
* tests/openpgp/setup.scm: Refactor into functions, add an interface
to tar-up the created environment, and untar it multiple times.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 17:26:50 +02:00
Justus Winter
c97bde2dfe common: Restore a simpler variant of 'gnupg_wait_process'.
* common/exechelp-posix.c (gnupg_wait_process): Use the code prior to
5ba4f604.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 17:26:50 +02:00
Justus Winter
845e2cc201 common: Fix error handling.
* common/exechelp-posix.c (store_result): Use xtrymalloc.
(gnupg_wait_processes): Likewise, and check result.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 17:26:50 +02:00
Neal H. Walfield
9082bde01c g10: Don't add user attributes to the TOFU DB.
* g10/trustdb.c (tdb_get_validity_core): Skip user attributes.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-05 16:48:51 +02:00
Werner Koch
0b99d1fd2a
agent: Silence --debug IPC output for connections from self.
* agent/command.c (server_local_s): Add fields 'greeting_seen' and
'connect_from_self'.
(io_monitor): Do not log connections from self.
(start_command_handler): Set flag 'connect_from_self'.
* agent/gpg-agent.c (check_own_socket_thread): Disable logging.
(do_start_connection_thread): Do not log conection start and
termination if IPC debugging is enabled.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-05 16:24:14 +02:00
Werner Koch
2eeb5551c3
agent: Small improvement of the server's local state.
* agent/command.c (sserver_local_s): Change flags to use only one bit.
(option_handler): Make an atoi return 1 or 0.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-05 16:24:14 +02:00
Neal H. Walfield
1f1f56e606 g10: Refactor cross sig check code.
* g10/tofu.c (BINDING_NEW): New enum value.
(BINDING_CONFLICT): Likewise.
(BINDING_EXPIRED): Likewise.
(BINDING_REVOKED): Likewise.
(ask_about_binding): Move cross sig check from here...
(get_trust): ... and the conflict set building from here...
(build_conflict_set): ... to this new function.
(format_conflict_msg_part1): Replace parameter conflict with
conflict_set.  Drop parameter fingerprint.  Update callers.
(ask_about_binding): Drop unused parameter conflict and redundant
parameter bindings_with_this_email_count.  Rename parameter
bindings_with_this_email to conflict_set.  Update callers.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-05 15:14:27 +02:00
Justus Winter
65a7563edb tests: Update README.
* tests/openpgp/README: Update.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 14:05:19 +02:00
Justus Winter
059c79d8b4 tests: Pass flags to test driver.
* tests/openpgp/Makefile.am (xcheck): Pass flags to 'run-tests.scm'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 14:05:19 +02:00
Justus Winter
e33111fcda common: Improve waiting for processes on POSIX.
* common/exechelp-posix.c (struct terminated_child): New definition.
(terminated_children): New variable.
(store_result): New function.
(get_result): Likewise.
(gnupg_wait_process): Store results that were not requested and
consider previously stored results.

waitpid(2) may return information about terminated children that we
did not yet request, and there is no portable way to wait for a
specific set of children.  As a workaround, we store the results of
children for later use.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 14:05:19 +02:00
Justus Winter
c39be0add8 common: Fix typo.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-05 14:05:19 +02:00
Werner Koch
de623474db
dirmngr: Exclude D lines from the IPC debug output.
* dirmngr/dirmngr.h: Include asshelp.h.
* dirmngr/server.c (server_local_s): Add inhibit_dara_logging fields.
(data_line_write): Implement logging inhibit.
(data_line_cookie_close): Print non-logged D lines.
(cmd_wkd_get, cmd_ks_get, cmd_ks_fetch): Do not log D lines.
(dirmngr_assuan_log_monitor): New.
* dirmngr/dirmngr.c (main): Register monitor function.
--

In particular with large keys the D lines clutter the log output and
make it unusable.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-05 13:06:24 +02:00
Werner Koch
0ac671f8a2
common: Add an assuan logging monitor.
* common/asshelp.c (my_log_monitor): New var.
(my_libassuan_log_handler): Run that monitor.
(setup_libassuan_logging): Add arg to set a log monitor and change all
callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-05 11:58:48 +02:00
Werner Koch
0a4a03e531
gpg: New export filter drop-subkey.
* g10/import.c (impex_filter_getval): Add properties for key packets.
* g10/export.c (export_drop_subkey): New var.
(cleanup_export_globals): Release that var.
(parse_and_set_export_filter): Add filter "drop-subkey".
(apply_drop_subkey_filter): New.
(do_export_stream): Run that filter.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-05 09:52:04 +02:00
Werner Koch
959cd8903f
common: Add string operator gt,ge,le,lt to recsel.
* common/recsel.c (recsel_parse_expr): Add them.
(recsel_dump): Print them.
(recsel_select): Evaluate them.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-05 09:52:04 +02:00
Werner Koch
c8e0d37f41
gpg: Use a common filter_getval for import and export.
* g10/import.c (filter_getval): Rename to ...
(impex_filter_getval): this.  Make global.
(apply_keep_uid_filter, apply_drop_sig_filter): Adjust.
* g10/export.c (filter_getval): Remove.
(apply_drop_sig_filter): Use impex_filter_getval.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-05 09:52:04 +02:00
NIIBE Yutaka
f9e49c80e7 scd: Fix an action after card removal.
* scd/command.c (update_card_removed): Call apdu_close_reader here.

--

This is update of the commit 8fe8105576
It is better apdu_close_reader is called in update_card_removed.

The commit 1598a44764 introduced a
regression, it doesn't close the reader after removal of the card, while
the code before the commit call apdu_close_reader in do_reset.
So, this fix.

GnuPG-bug-id: 2449
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-09-03 15:27:30 +09:00
Werner Koch
18a808bccf
po: Fix line ending mismatch in Japanese translation.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-02 16:59:49 +02:00
Werner Koch
46362cbc0e
wks: Add framework for policy flags.
* tools/call-dirmngr.c (wkd_get_policy_flags): New.
* tools/gpg-wks.h (struct policy_flags_s, policy_flags_t): New.
* tools/wks-util.c (wks_parse_policy): New.
* tools/gpg-wks-client.c (command_send): Get the policy flags to show
a new info line.
* tools/gpg-wks-server.c (get_policy_flags): New.
(process_new_key): get policy flag and add a stub for "auth-submit".
(command_list_domains): Check policy flags.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-02 16:56:04 +02:00
Werner Koch
505ee45106
dirmngr: Add --policy-flags option to WKD_GET.
* dirmngr/server.c (cmd_wkd_get): Add new option.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-02 16:56:04 +02:00
Werner Koch
fc445b36fa
common: Check read errors in name-value.c
* common/name-value.c: Check for read errors.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-02 16:56:04 +02:00
NIIBE Yutaka
8fe8105576 scd: Release the card reader after card removal.
* scd/command.c (update_reader_status_file): Call apdu_close_reader.

--

GnuPG-bug-id: 2651
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-09-02 14:45:26 +09:00
NIIBE Yutaka
d1ae710335 scd: Clean up unused shutdown method.
* scd/apdu.c (shutdown_ccid_reader, apdu_shutdown_reader): Remove.
(reset_ccid_reader): Don't set shutdown_reader.
* scd/ccid-driver.c (ccid_shutdown_reader): Remove.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-09-02 13:58:33 +09:00
NIIBE Yutaka
8b6c0bae33 agent: invoke scdaemon with --homedir.
* agent/call-scd.c (start_scd): Supply --homedir option when it's not
default homedir.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-09-02 13:41:19 +09:00
NIIBE Yutaka
afdfc954b3 po: Update Japanese translation. 2016-09-02 10:08:02 +09:00
Neal H. Walfield
85fad6c34c g10: End transaction earlier.
* g10/tofu.c (ask_about_binding): End the transaction earlier.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-01 23:32:00 +02:00
Neal H. Walfield
b410a3cb76 g10: Don't consider cross-signed keys to be in conflict.
* g10/tofu.c (cross_sigs): New function.
(ask_about_binding): If apparently conflicting keys are cross signed,
then don't mark them as conflicting.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>

If two keys are cross signed, then the same person (probably)
controlled them both.  In this case, don't raise a TOFU conflict.
This usually occurs when someone transitions to a new key.  When that
person rotates to a third key, she will typically only cross sign it
with the second key.  As such, we check this transitively to avoid
declaring a conflict between the 1st and 3rd key.
2016-09-01 23:32:00 +02:00
Werner Koch
38d369de13
gpg: Avoid homedir creation by --list-config
* g10/gpg.c (main): Do not register a key for the list config
commands.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-01 19:22:48 +02:00
Werner Koch
fde9fa81d3
gpg: Simplify code to print VALIDSIG.
* g10/mainproc.c (check_sig_and_print): Use hexfingerprint and
write_status_printf.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-01 16:39:41 +02:00
Werner Koch
6bdadae005
gpg: Add new function write_status_printf.
* g10/cpr.c (write_status_printf): New.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-01 16:39:41 +02:00
Werner Koch
37e3c89725
gpg: Fix printing of pubkey algo in --verbose signature verify.
* g10/sig-check.c (check_signature2): Replace arg PK by R_PK and
change the semantics.  Also clear the other R_ args on function entry,
use gpg_error() and change retturn type to gpg_error_t.
* g10/mainproc.c (do_check_sig): Add arg R_PK.
(list_node): Pass NULL for new arg.
(check_sig_and_print): Rework to make use of the returned PK.
--

The output

gpg: textmode signature, digest algorithm SHA256, key algorithm rsa2048

showed the pubkey algo of the primary key which was surprising.
Changed to print the algo of the subkey used for verification.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-01 16:39:41 +02:00
Neal H. Walfield
44690befad g10: Fix typo.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-01 14:31:55 +02:00
Neal H. Walfield
3d44e5e8a8 g10: When asking about a TOFU binding conflict, default to unknown.
* g10/tofu.c (ask_about_binding): Default to unknown.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-09-01 14:31:31 +02:00