From b1ba460d8f3358342c2ee2927114d36e767a439f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sat, 21 May 2016 20:06:59 +0200 Subject: gpg: Avoid name spaces clash with future sqlite versions. * g10/sqlite.c: Rename to gpgsql.c. Change function prefixes to gpgsql_. * g10/sqlite.h: Rename to gpgsql.h. * g10/tofu.c: Adjust for changes. -- We used for our own extensions symbols with an sqlite_ names prefix. This may in theory lead to duplicated symbols but more important, it is harder to understand what is from gpg and what is from libsqlite. Signed-off-by: Werner Koch --- g10/Makefile.am | 2 +- g10/gpgsql.c | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ g10/gpgsql.h | 61 ++++++++++++++ g10/sqlite.c | 251 -------------------------------------------------------- g10/sqlite.h | 62 -------------- g10/tofu.c | 38 ++++----- 6 files changed, 332 insertions(+), 333 deletions(-) create mode 100644 g10/gpgsql.c create mode 100644 g10/gpgsql.h delete mode 100644 g10/sqlite.c delete mode 100644 g10/sqlite.h diff --git a/g10/Makefile.am b/g10/Makefile.am index 18a1b69b8..fc33e838f 100644 --- a/g10/Makefile.am +++ b/g10/Makefile.am @@ -74,7 +74,7 @@ trust_source = trustdb.c trustdb.h tdbdump.c tdbio.c tdbio.h endif if USE_TOFU -tofu_source = tofu.h tofu.c sqlite.c sqlite.h +tofu_source = tofu.h tofu.c gpgsql.c gpgsql.h else tofu_source = endif diff --git a/g10/gpgsql.c b/g10/gpgsql.c new file mode 100644 index 000000000..72f51b5b7 --- /dev/null +++ b/g10/gpgsql.c @@ -0,0 +1,251 @@ +/* gpgsql.c - SQLite helper functions. + * Copyright (C) 2015 g10 Code GmbH + * + * This file is part of GnuPG. + * + * GnuPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GnuPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include +#include +#include + +#include "gpg.h" +#include "util.h" +#include "logging.h" + +#include "gpgsql.h" + +/* This is a convenience function that combines sqlite3_mprintf and + sqlite3_exec. */ +int +gpgsql_exec_printf (sqlite3 *db, + int (*callback)(void*,int,char**,char**), void *cookie, + char **errmsg, + const char *sql, ...) +{ + va_list ap; + int rc; + char *sql2; + + va_start (ap, sql); + sql2 = sqlite3_vmprintf (sql, ap); + va_end (ap); + +#if 0 + log_debug ("tofo db: executing: '%s'\n", sql2); +#endif + + rc = sqlite3_exec (db, sql2, callback, cookie, errmsg); + + sqlite3_free (sql2); + + return rc; +} + +int +gpgsql_stepx (sqlite3 *db, + sqlite3_stmt **stmtp, + gpgsql_stepx_callback callback, + void *cookie, + char **errmsg, + const char *sql, ...) +{ + int rc; + int err = 0; + sqlite3_stmt *stmt = NULL; + + va_list va; + int args; + enum gpgsql_arg_type t; + int i; + + int cols; + /* Names of the columns. We initialize this lazily to avoid the + overhead in case the query doesn't return any results. */ + const char **azColName = 0; + int callback_initialized = 0; + + const char **azVals = 0; + + callback_initialized = 0; + + if (stmtp && *stmtp) + { + stmt = *stmtp; + + /* Make sure this statement is associated with the supplied db. */ + log_assert (db == sqlite3_db_handle (stmt)); + +#if DEBUG_TOFU_CACHE + prepares_saved ++; +#endif + } + else + { + const char *tail = NULL; + + rc = sqlite3_prepare_v2 (db, sql, -1, &stmt, &tail); + if (rc) + log_fatal ("failed to prepare SQL: %s", sql); + + /* We can only process a single statement. */ + if (tail) + { + while (*tail == ' ' || *tail == ';' || *tail == '\n') + tail ++; + + if (*tail) + log_fatal + ("sqlite3_stepx can only process a single SQL statement." + " Second statement starts with: '%s'\n", + tail); + } + + if (stmtp) + *stmtp = stmt; + } + +#if DEBUG_TOFU_CACHE + queries ++; +#endif + + args = sqlite3_bind_parameter_count (stmt); + va_start (va, sql); + if (args) + { + for (i = 1; i <= args; i ++) + { + t = va_arg (va, enum gpgsql_arg_type); + switch (t) + { + case SQLITE_ARG_INT: + { + int value = va_arg (va, int); + err = sqlite3_bind_int (stmt, i, value); + break; + } + case SQLITE_ARG_LONG_LONG: + { + long long value = va_arg (va, long long); + err = sqlite3_bind_int64 (stmt, i, value); + break; + } + case SQLITE_ARG_STRING: + { + char *text = va_arg (va, char *); + err = sqlite3_bind_text (stmt, i, text, -1, SQLITE_STATIC); + break; + } + case SQLITE_ARG_BLOB: + { + char *blob = va_arg (va, void *); + long long length = va_arg (va, long long); + err = sqlite3_bind_blob (stmt, i, blob, length, SQLITE_STATIC); + break; + } + default: + /* Internal error. Likely corruption. */ + log_fatal ("Bad value for parameter type %d.\n", t); + } + + if (err) + { + log_fatal ("Error binding parameter %d\n", i); + goto out; + } + } + + } + t = va_arg (va, enum gpgsql_arg_type); + log_assert (t == SQLITE_ARG_END); + va_end (va); + + for (;;) + { + rc = sqlite3_step (stmt); + + if (rc != SQLITE_ROW) + /* No more data (SQLITE_DONE) or an error occurred. */ + break; + + if (! callback) + continue; + + if (! callback_initialized) + { + cols = sqlite3_column_count (stmt); + azColName = xmalloc (2 * cols * sizeof (const char *) + 1); + + for (i = 0; i < cols; i ++) + azColName[i] = sqlite3_column_name (stmt, i); + + callback_initialized = 1; + } + + azVals = &azColName[cols]; + for (i = 0; i < cols; i ++) + { + azVals[i] = sqlite3_column_text (stmt, i); + if (! azVals[i] && sqlite3_column_type (stmt, i) != SQLITE_NULL) + /* Out of memory. */ + { + err = SQLITE_NOMEM; + break; + } + } + + if (callback (cookie, cols, (char **) azVals, (char **) azColName, stmt)) + /* A non-zero result means to abort. */ + { + err = SQLITE_ABORT; + break; + } + } + + out: + xfree (azColName); + + if (stmtp) + rc = sqlite3_reset (stmt); + else + rc = sqlite3_finalize (stmt); + if (rc == SQLITE_OK && err) + /* Local error. */ + { + rc = err; + if (errmsg) + { + const char *e = sqlite3_errstr (err); + size_t l = strlen (e) + 1; + *errmsg = sqlite3_malloc (l); + if (! *errmsg) + log_fatal ("Out of memory.\n"); + memcpy (*errmsg, e, l); + } + } + else if (rc != SQLITE_OK && errmsg) + /* Error reported by sqlite. */ + { + const char * e = sqlite3_errmsg (db); + size_t l = strlen (e) + 1; + *errmsg = sqlite3_malloc (l); + if (! *errmsg) + log_fatal ("Out of memory.\n"); + memcpy (*errmsg, e, l); + } + + return rc; +} diff --git a/g10/gpgsql.h b/g10/gpgsql.h new file mode 100644 index 000000000..a540684eb --- /dev/null +++ b/g10/gpgsql.h @@ -0,0 +1,61 @@ +/* gpgsql.h - SQLite helper functions. + * Copyright (C) 2015 g10 Code GmbH + * + * This file is part of GnuPG. + * + * GnuPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GnuPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef GNUPG_GPGSQL_H +#define GNUPG_GPGSQL_H + +#include + +enum gpgsql_arg_type + { + SQLITE_ARG_END = 0xdead001, + SQLITE_ARG_INT, + SQLITE_ARG_LONG_LONG, + SQLITE_ARG_STRING, + /* This takes two arguments: the blob as a void * and the length + of the blob as a long long. */ + SQLITE_ARG_BLOB + }; + +int gpgsql_exec_printf (sqlite3 *db, + int (*callback)(void*,int,char**,char**), void *cookie, + char **errmsg, + const char *sql, ...); + +typedef int (*gpgsql_stepx_callback) (void *cookie, + /* number of columns. */ + int cols, + /* columns as text. */ + char **values, + /* column names. */ + char **names, + /* The prepared statement so + * that it is possible to use + * something like + * sqlite3_column_blob(). */ + sqlite3_stmt *statement); + +int gpgsql_stepx (sqlite3 *db, + sqlite3_stmt **stmtp, + gpgsql_stepx_callback callback, + void *cookie, + char **errmsg, + const char *sql, ...); + +#endif /*GNUPG_GPGSQL_H*/ diff --git a/g10/sqlite.c b/g10/sqlite.c deleted file mode 100644 index 90490c297..000000000 --- a/g10/sqlite.c +++ /dev/null @@ -1,251 +0,0 @@ -/* sqlite.c - SQLite helper functions. - * Copyright (C) 2015 g10 Code GmbH - * - * This file is part of GnuPG. - * - * GnuPG is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GnuPG is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include -#include -#include -#include - -#include "gpg.h" -#include "util.h" -#include "logging.h" - -#include "sqlite.h" - -/* This is a convenience function that combines sqlite3_mprintf and - sqlite3_exec. */ -int -sqlite3_exec_printf (sqlite3 *db, - int (*callback)(void*,int,char**,char**), void *cookie, - char **errmsg, - const char *sql, ...) -{ - va_list ap; - int rc; - char *sql2; - - va_start (ap, sql); - sql2 = sqlite3_vmprintf (sql, ap); - va_end (ap); - -#if 0 - log_debug ("tofo db: executing: '%s'\n", sql2); -#endif - - rc = sqlite3_exec (db, sql2, callback, cookie, errmsg); - - sqlite3_free (sql2); - - return rc; -} - -int -sqlite3_stepx (sqlite3 *db, - sqlite3_stmt **stmtp, - sqlite3_stepx_callback callback, - void *cookie, - char **errmsg, - const char *sql, ...) -{ - int rc; - int err = 0; - sqlite3_stmt *stmt = NULL; - - va_list va; - int args; - enum sqlite_arg_type t; - int i; - - int cols; - /* Names of the columns. We initialize this lazily to avoid the - overhead in case the query doesn't return any results. */ - const char **azColName = 0; - int callback_initialized = 0; - - const char **azVals = 0; - - callback_initialized = 0; - - if (stmtp && *stmtp) - { - stmt = *stmtp; - - /* Make sure this statement is associated with the supplied db. */ - log_assert (db == sqlite3_db_handle (stmt)); - -#if DEBUG_TOFU_CACHE - prepares_saved ++; -#endif - } - else - { - const char *tail = NULL; - - rc = sqlite3_prepare_v2 (db, sql, -1, &stmt, &tail); - if (rc) - log_fatal ("failed to prepare SQL: %s", sql); - - /* We can only process a single statement. */ - if (tail) - { - while (*tail == ' ' || *tail == ';' || *tail == '\n') - tail ++; - - if (*tail) - log_fatal - ("sqlite3_stepx can only process a single SQL statement." - " Second statement starts with: '%s'\n", - tail); - } - - if (stmtp) - *stmtp = stmt; - } - -#if DEBUG_TOFU_CACHE - queries ++; -#endif - - args = sqlite3_bind_parameter_count (stmt); - va_start (va, sql); - if (args) - { - for (i = 1; i <= args; i ++) - { - t = va_arg (va, enum sqlite_arg_type); - switch (t) - { - case SQLITE_ARG_INT: - { - int value = va_arg (va, int); - err = sqlite3_bind_int (stmt, i, value); - break; - } - case SQLITE_ARG_LONG_LONG: - { - long long value = va_arg (va, long long); - err = sqlite3_bind_int64 (stmt, i, value); - break; - } - case SQLITE_ARG_STRING: - { - char *text = va_arg (va, char *); - err = sqlite3_bind_text (stmt, i, text, -1, SQLITE_STATIC); - break; - } - case SQLITE_ARG_BLOB: - { - char *blob = va_arg (va, void *); - long long length = va_arg (va, long long); - err = sqlite3_bind_blob (stmt, i, blob, length, SQLITE_STATIC); - break; - } - default: - /* Internal error. Likely corruption. */ - log_fatal ("Bad value for parameter type %d.\n", t); - } - - if (err) - { - log_fatal ("Error binding parameter %d\n", i); - goto out; - } - } - - } - t = va_arg (va, enum sqlite_arg_type); - log_assert (t == SQLITE_ARG_END); - va_end (va); - - for (;;) - { - rc = sqlite3_step (stmt); - - if (rc != SQLITE_ROW) - /* No more data (SQLITE_DONE) or an error occurred. */ - break; - - if (! callback) - continue; - - if (! callback_initialized) - { - cols = sqlite3_column_count (stmt); - azColName = xmalloc (2 * cols * sizeof (const char *) + 1); - - for (i = 0; i < cols; i ++) - azColName[i] = sqlite3_column_name (stmt, i); - - callback_initialized = 1; - } - - azVals = &azColName[cols]; - for (i = 0; i < cols; i ++) - { - azVals[i] = sqlite3_column_text (stmt, i); - if (! azVals[i] && sqlite3_column_type (stmt, i) != SQLITE_NULL) - /* Out of memory. */ - { - err = SQLITE_NOMEM; - break; - } - } - - if (callback (cookie, cols, (char **) azVals, (char **) azColName, stmt)) - /* A non-zero result means to abort. */ - { - err = SQLITE_ABORT; - break; - } - } - - out: - xfree (azColName); - - if (stmtp) - rc = sqlite3_reset (stmt); - else - rc = sqlite3_finalize (stmt); - if (rc == SQLITE_OK && err) - /* Local error. */ - { - rc = err; - if (errmsg) - { - const char *e = sqlite3_errstr (err); - size_t l = strlen (e) + 1; - *errmsg = sqlite3_malloc (l); - if (! *errmsg) - log_fatal ("Out of memory.\n"); - memcpy (*errmsg, e, l); - } - } - else if (rc != SQLITE_OK && errmsg) - /* Error reported by sqlite. */ - { - const char * e = sqlite3_errmsg (db); - size_t l = strlen (e) + 1; - *errmsg = sqlite3_malloc (l); - if (! *errmsg) - log_fatal ("Out of memory.\n"); - memcpy (*errmsg, e, l); - } - - return rc; -} diff --git a/g10/sqlite.h b/g10/sqlite.h deleted file mode 100644 index 753e37a73..000000000 --- a/g10/sqlite.h +++ /dev/null @@ -1,62 +0,0 @@ -/* sqlite.h - SQLite helper functions. - * Copyright (C) 2015 g10 Code GmbH - * - * This file is part of GnuPG. - * - * GnuPG is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GnuPG is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef GNUPG_SQLITE_H -#define GNUPG_SQLITE_H - -#include - -enum sqlite_arg_type - { - SQLITE_ARG_END = 0xdead001, - SQLITE_ARG_INT, - SQLITE_ARG_LONG_LONG, - SQLITE_ARG_STRING, - /* This takes two arguments: the blob as a void * and the length - of the blob as a long long. */ - SQLITE_ARG_BLOB - }; - - -int sqlite3_exec_printf (sqlite3 *db, - int (*callback)(void*,int,char**,char**), void *cookie, - char **errmsg, - const char *sql, ...); - -typedef int (*sqlite3_stepx_callback) (void *cookie, - /* number of columns. */ - int cols, - /* columns as text. */ - char **values, - /* column names. */ - char **names, - /* The prepared statement so - that it is possible to use - something like - sqlite3_column_blob(). */ - sqlite3_stmt *statement); - -int sqlite3_stepx (sqlite3 *db, - sqlite3_stmt **stmtp, - sqlite3_stepx_callback callback, - void *cookie, - char **errmsg, - const char *sql, ...); - -#endif diff --git a/g10/tofu.c b/g10/tofu.c index 8c639db1c..78bc02c86 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -39,7 +39,7 @@ #include "ttyio.h" #include "trustdb.h" #include "mkdir_p.h" -#include "sqlite.h" +#include "gpgsql.h" #include "status.h" #include "tofu.h" @@ -262,7 +262,7 @@ begin_transaction (struct db *db, int only_batch) if (batch_update && ! db->batch_update) { - rc = sqlite3_stepx (db->db, &db->s.savepoint_batch, + rc = gpgsql_stepx (db->db, &db->s.savepoint_batch, NULL, NULL, &err, "savepoint batch;", SQLITE_ARG_END); if (rc) @@ -281,7 +281,7 @@ begin_transaction (struct db *db, int only_batch) if (only_batch) return 0; - rc = sqlite3_stepx (db->db, &db->s.savepoint_inner, + rc = gpgsql_stepx (db->db, &db->s.savepoint_inner, NULL, NULL, &err, "savepoint inner;", SQLITE_ARG_END); if (rc) @@ -316,7 +316,7 @@ end_transaction (struct db *db, int only_batch) { db->batch_update = 0; - rc = sqlite3_stepx (db->db, &db->s.savepoint_batch_commit, + rc = gpgsql_stepx (db->db, &db->s.savepoint_batch_commit, NULL, NULL, &err, "release batch;", SQLITE_ARG_END); if (rc) @@ -337,7 +337,7 @@ end_transaction (struct db *db, int only_batch) if (only_batch) return 0; - rc = sqlite3_stepx (db->db, &db->s.savepoint_inner_commit, + rc = gpgsql_stepx (db->db, &db->s.savepoint_inner_commit, NULL, NULL, &err, "release inner;", SQLITE_ARG_END); if (rc) @@ -640,7 +640,7 @@ initdb (sqlite3 *db, enum db_type type) * know why this occurred, we also set conflict to 0xbaddecaf. */ if (type == DB_EMAIL || type == DB_COMBINED) - rc = sqlite3_exec_printf + rc = gpgsql_exec_printf (db, NULL, NULL, &err, "create table bindings\n" " (oid INTEGER PRIMARY KEY AUTOINCREMENT,\n" @@ -659,7 +659,7 @@ initdb (sqlite3 *db, enum db_type type) Note: since the data is split on the email address, there is no need to index the email column. */ - rc = sqlite3_exec_printf + rc = gpgsql_exec_printf (db, NULL, NULL, &err, "create table bindings\n" " (oid INTEGER PRIMARY KEY AUTOINCREMENT,\n" @@ -1220,7 +1220,7 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email, purposes, there is no need to start a transaction or to die if there is a failure. */ { - rc = sqlite3_stepx + rc = gpgsql_stepx (db_email->db, &db_email->s.record_binding_get_old_policy, get_single_long_cb2, &policy_old, &err, "select policy from bindings where fingerprint = ? and email = ?", @@ -1259,7 +1259,7 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email, goto out; } - rc = sqlite3_stepx + rc = gpgsql_stepx (db_email->db, &db_email->s.record_binding_update, NULL, NULL, &err, "insert or replace into bindings\n" " (oid, fingerprint, email, user_id, time, policy)\n" @@ -1287,7 +1287,7 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email, { log_assert (opt.tofu_db_format == TOFU_DB_SPLIT); - rc = sqlite3_stepx + rc = gpgsql_stepx (db_key->db, &db_key->s.record_binding_update2, NULL, NULL, &err, "insert or replace into bindings\n" " (oid, fingerprint, email, user_id)\n" @@ -1520,7 +1520,7 @@ get_policy (tofu_dbs_t dbs, const char *fingerprint, const char *email, (TOFU_POLICY_NONE cannot appear in the DB. Thus, if POLICY is still TOFU_POLICY_NONE after executing the query, then the result set was empty.) */ - rc = sqlite3_stepx (db->db, &db->s.get_policy_select_policy_and_conflict, + rc = gpgsql_stepx (db->db, &db->s.get_policy_select_policy_and_conflict, strings_collect_cb2, &strlist, &err, "select policy, conflict from bindings\n" " where fingerprint = ? and email = ?", @@ -1773,7 +1773,7 @@ get_trust (tofu_dbs_t dbs, const char *fingerprint, const char *email, address. Note: if the binding in question is in the DB, it will also be returned. Thus, if the result set is empty, then this is a new binding. */ - rc = sqlite3_stepx + rc = gpgsql_stepx (db->db, &db->s.get_trust_bindings_with_this_email, strings_collect_cb2, &bindings_with_this_email, &err, "select distinct fingerprint from bindings where email = ?;", @@ -1942,7 +1942,7 @@ get_trust (tofu_dbs_t dbs, const char *fingerprint, const char *email, if (db_key) { - rc = sqlite3_stepx + rc = gpgsql_stepx (db_key->db, &db_key->s.get_trust_gather_other_user_ids, strings_collect_cb2, &other_user_ids, &err, opt.tofu_db_format == TOFU_DB_SPLIT @@ -1993,7 +1993,7 @@ get_trust (tofu_dbs_t dbs, const char *fingerprint, const char *email, /* XXX: When generating the statistics, do we want the time embedded in the signature (column 'sig_time') or the time that we first verified the signature (column 'time'). */ - rc = sqlite3_stepx + rc = gpgsql_stepx (db->db, &db->s.get_trust_gather_other_keys, signature_stats_collect_cb, &stats, &err, "select fingerprint, policy, time_ago, count(*)\n" @@ -2223,7 +2223,7 @@ get_trust (tofu_dbs_t dbs, const char *fingerprint, const char *email, if (! may_ask) /* If we weren't allowed to ask, also update this key as conflicting with itself. */ - rc = sqlite3_exec_printf + rc = gpgsql_exec_printf (db->db, NULL, NULL, &err, "update bindings set policy = %d, conflict = %Q" " where email = %Q" @@ -2231,7 +2231,7 @@ get_trust (tofu_dbs_t dbs, const char *fingerprint, const char *email, TOFU_POLICY_ASK, fingerprint, email, TOFU_POLICY_AUTO, TOFU_POLICY_ASK, fingerprint); else - rc = sqlite3_exec_printf + rc = gpgsql_exec_printf (db->db, NULL, NULL, &err, "update bindings set policy = %d, conflict = %Q" " where email = %Q and fingerprint != %Q and policy = %d;", @@ -2438,7 +2438,7 @@ show_statistics (tofu_dbs_t dbs, const char *fingerprint, fingerprint_pp = format_hexfingerprint (fingerprint, NULL, 0); - rc = sqlite3_exec_printf + rc = gpgsql_exec_printf (db->db, strings_collect_cb, &strlist, &err, "select count (*), strftime('%%s','now') - min (signatures.time),\n" " strftime('%%s','now') - max (signatures.time)\n" @@ -2731,7 +2731,7 @@ tofu_register (ctrl_t ctrl, PKT_public_key *pk, const char *user_id, /* If we've already seen this signature before, then don't add it again. */ - rc = sqlite3_stepx + rc = gpgsql_stepx (db->db, &db->s.register_already_seen, get_single_unsigned_long_cb2, &c, &err, "select count (*)\n" @@ -2781,7 +2781,7 @@ tofu_register (ctrl_t ctrl, PKT_public_key *pk, const char *user_id, log_assert (c == 0); - rc = sqlite3_stepx + rc = gpgsql_stepx (db->db, &db->s.register_insert, NULL, NULL, &err, "insert into signatures\n" " (binding, sig_digest, origin, sig_time, time)\n" -- cgit v1.2.3