mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-11 21:48:50 +01:00
g10: Improve TOFU debugging output and some comments.
-- Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
parent
d0451440c0
commit
3beeaa70bd
24
g10/tofu.c
24
g10/tofu.c
@ -777,25 +777,26 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email,
|
|||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_debug ("TOFU: Error reading from binding database"
|
log_debug ("TOFU: Error reading from binding database"
|
||||||
" (reading policy for <%s, %s>): %s\n",
|
" (reading policy for <key: %s, user id: %s>): %s\n",
|
||||||
fingerprint, email, err);
|
fingerprint, email, err);
|
||||||
sqlite3_free (err);
|
sqlite3_free (err);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (DBG_TRUST)
|
if (DBG_TRUST)
|
||||||
{
|
{
|
||||||
if (policy_old != TOFU_POLICY_NONE)
|
if (policy_old != TOFU_POLICY_NONE)
|
||||||
log_debug ("Changing TOFU trust policy for binding <%s, %s>"
|
log_debug ("Changing TOFU trust policy for binding"
|
||||||
" from %s to %s.\n",
|
" <key: %s, user id: %s> from %s to %s.\n",
|
||||||
fingerprint, email,
|
fingerprint, email,
|
||||||
tofu_policy_str (policy_old),
|
tofu_policy_str (policy_old),
|
||||||
tofu_policy_str (policy));
|
tofu_policy_str (policy));
|
||||||
else
|
else
|
||||||
log_debug ("Set TOFU trust policy for binding <%s, %s> to %s.\n",
|
log_debug ("Setting TOFU trust policy for new binding"
|
||||||
|
" <key: %s, user id: %s> to %s.\n",
|
||||||
fingerprint, email,
|
fingerprint, email,
|
||||||
tofu_policy_str (policy));
|
tofu_policy_str (policy));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (policy_old == policy)
|
if (policy_old == policy)
|
||||||
{
|
{
|
||||||
@ -827,7 +828,7 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email,
|
|||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error updating TOFU database: %s\n"), err);
|
log_error (_("error updating TOFU database: %s\n"), err);
|
||||||
print_further_info (" insert bindings <%s, %s> = %s",
|
print_further_info (" insert bindings <key: %s, user id: %s> = %s",
|
||||||
fingerprint, email, tofu_policy_str (policy));
|
fingerprint, email, tofu_policy_str (policy));
|
||||||
sqlite3_free (err);
|
sqlite3_free (err);
|
||||||
goto leave;
|
goto leave;
|
||||||
@ -1072,7 +1073,7 @@ get_policy (tofu_dbs_t dbs, const char *fingerprint, const char *email,
|
|||||||
|
|
||||||
/* If CONFLICT is set, then policy should be TOFU_POLICY_ASK. But,
|
/* If CONFLICT is set, then policy should be TOFU_POLICY_ASK. But,
|
||||||
just in case, we do the check again here and ignore the conflict
|
just in case, we do the check again here and ignore the conflict
|
||||||
is POLICY is not TOFU_POLICY_ASK. */
|
if POLICY is not TOFU_POLICY_ASK. */
|
||||||
if (conflict)
|
if (conflict)
|
||||||
{
|
{
|
||||||
if (policy == TOFU_POLICY_ASK && *strlist->next->d)
|
if (policy == TOFU_POLICY_ASK && *strlist->next->d)
|
||||||
@ -1553,7 +1554,8 @@ get_trust (tofu_dbs_t dbs, PKT_public_key *pk,
|
|||||||
{
|
{
|
||||||
policy = opt.tofu_default_policy;
|
policy = opt.tofu_default_policy;
|
||||||
if (DBG_TRUST)
|
if (DBG_TRUST)
|
||||||
log_debug ("TOFU: binding <%s, %s>'s policy is auto (default: %s).\n",
|
log_debug ("TOFU: binding <key: %s, user id: %s>'s policy is "
|
||||||
|
" auto (default: %s).\n",
|
||||||
fingerprint, email,
|
fingerprint, email,
|
||||||
tofu_policy_str (opt.tofu_default_policy));
|
tofu_policy_str (opt.tofu_default_policy));
|
||||||
}
|
}
|
||||||
@ -1566,7 +1568,7 @@ get_trust (tofu_dbs_t dbs, PKT_public_key *pk,
|
|||||||
/* The saved judgement is auto -> auto, good, unknown or bad.
|
/* The saved judgement is auto -> auto, good, unknown or bad.
|
||||||
* We don't need to ask the user anything. */
|
* We don't need to ask the user anything. */
|
||||||
if (DBG_TRUST)
|
if (DBG_TRUST)
|
||||||
log_debug ("TOFU: Known binding <%s, %s>'s policy: %s\n",
|
log_debug ("TOFU: Known binding <key: %s, user id: %s>'s policy: %s\n",
|
||||||
fingerprint, email, tofu_policy_str (policy));
|
fingerprint, email, tofu_policy_str (policy));
|
||||||
trust_level = tofu_policy_to_trust_level (policy);
|
trust_level = tofu_policy_to_trust_level (policy);
|
||||||
goto out;
|
goto out;
|
||||||
@ -1646,8 +1648,8 @@ get_trust (tofu_dbs_t dbs, PKT_public_key *pk,
|
|||||||
log_assert (policy == TOFU_POLICY_NONE);
|
log_assert (policy == TOFU_POLICY_NONE);
|
||||||
|
|
||||||
if (DBG_TRUST)
|
if (DBG_TRUST)
|
||||||
log_debug ("TOFU: New binding <%s, %s>, no conflict.\n",
|
log_debug ("TOFU: New binding <key: %s, user id: %s>, no conflict.\n",
|
||||||
email, fingerprint);
|
fingerprint, email);
|
||||||
|
|
||||||
if (record_binding (dbs, fingerprint, email, user_id,
|
if (record_binding (dbs, fingerprint, email, user_id,
|
||||||
TOFU_POLICY_AUTO, 0) != 0)
|
TOFU_POLICY_AUTO, 0) != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user