aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2016-10-13 10:32:03 +0000
committerNeal H. Walfield <[email protected]>2016-10-13 10:32:03 +0000
commit5bf92e51dfdfb4f4746ecd817d8d2240ed27ea74 (patch)
treea7b6a6c216007b6fea196a2919f254b21a02da9d
parenttests: Remove support for deprecated functionality. (diff)
downloadgnupg-5bf92e51dfdfb4f4746ecd817d8d2240ed27ea74.tar.gz
gnupg-5bf92e51dfdfb4f4746ecd817d8d2240ed27ea74.zip
g10: If an sqlite operation fails, map the error code to GPG_ERR_GENERAL
* g10/tofu.c (get_policy): If an sqlite operation fails, map the error code to GPG_ERR_GENERAL. (ask_about_binding): Likewise. (build_conflict_set): Likewise. (get_trust): Likewise. (show_statistics): Likewise. (tofu_register_signature): Likewise. (tofu_register_encryption): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>
-rw-r--r--g10/tofu.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/g10/tofu.c b/g10/tofu.c
index d7f4e4c38..b9416d55b 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -1082,6 +1082,7 @@ get_policy (tofu_dbs_t dbs, const char *fingerprint, const char *email,
log_error (_("error reading TOFU database: %s\n"), err);
print_further_info ("checking for existing bad bindings");
sqlite3_free (err);
+ rc = gpg_error (GPG_ERR_GENERAL);
goto out;
}
@@ -1404,6 +1405,7 @@ ask_about_binding (ctrl_t ctrl,
log_error (_("error gathering other user IDs: %s\n"), sqerr);
sqlite3_free (sqerr);
sqerr = NULL;
+ rc = gpg_error (GPG_ERR_GENERAL);
}
if (other_user_ids)
@@ -1481,7 +1483,10 @@ ask_about_binding (ctrl_t ctrl,
GPGSQL_ARG_STRING, iter->d,
GPGSQL_ARG_END);
if (rc)
- break;
+ {
+ rc = gpg_error (GPG_ERR_GENERAL);
+ break;
+ }
if (!stats || strcmp (iter->d, stats->fingerprint) != 0)
/* No stats for this binding. Add a dummy entry. */
@@ -1496,7 +1501,10 @@ ask_about_binding (ctrl_t ctrl,
GPGSQL_ARG_STRING, iter->d,
GPGSQL_ARG_END);
if (rc)
- break;
+ {
+ rc = gpg_error (GPG_ERR_GENERAL);
+ break;
+ }
#undef STATS_SQL
@@ -1803,6 +1811,7 @@ build_conflict_set (tofu_dbs_t dbs, const char *fingerprint, const char *email)
log_error (_("error reading TOFU database: %s\n"), sqerr);
print_further_info ("listing fingerprints");
sqlite3_free (sqerr);
+ rc = gpg_error (GPG_ERR_GENERAL);
return NULL;
}
@@ -2349,6 +2358,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk,
fingerprint, user_id);
sqlite3_free (sqerr);
sqerr = NULL;
+ rc = gpg_error (GPG_ERR_GENERAL);
}
else if (DBG_TRUST)
log_debug ("Set %s to conflict with %s\n",
@@ -2597,6 +2607,7 @@ show_statistics (tofu_dbs_t dbs, const char *fingerprint,
log_error (_("error reading TOFU database: %s\n"), err);
print_further_info ("getting signature statistics");
sqlite3_free (err);
+ rc = gpg_error (GPG_ERR_GENERAL);
goto out;
}
@@ -2629,6 +2640,7 @@ show_statistics (tofu_dbs_t dbs, const char *fingerprint,
log_error (_("error reading TOFU database: %s\n"), err);
print_further_info ("getting encryption statistics");
sqlite3_free (err);
+ rc = gpg_error (GPG_ERR_GENERAL);
goto out;
}
@@ -2927,6 +2939,7 @@ tofu_register_signature (ctrl_t ctrl,
log_error (_("error reading TOFU database: %s\n"), err);
print_further_info ("checking existence");
sqlite3_free (err);
+ rc = gpg_error (GPG_ERR_GENERAL);
}
else if (c > 1)
/* Duplicates! This should not happen. In particular,
@@ -2980,6 +2993,7 @@ tofu_register_signature (ctrl_t ctrl,
log_error (_("error updating TOFU database: %s\n"), err);
print_further_info ("insert signatures");
sqlite3_free (err);
+ rc = gpg_error (GPG_ERR_GENERAL);
}
}
@@ -3093,6 +3107,7 @@ tofu_register_encryption (ctrl_t ctrl,
log_error (_("error updating TOFU database: %s\n"), err);
print_further_info ("insert encryption");
sqlite3_free (err);
+ rc = gpg_error (GPG_ERR_GENERAL);
}
xfree (email);