From 41a882443622fe08ebaa75bf358e83630bbb8631 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 7 Jan 2020 17:12:25 +0100 Subject: [PATCH] kbx: Make sure the tables are joined in a select. * kbx/backend-sqlite.c (run_select_statement): Join the tables. -- For whatever reasons that part was missing or got lost before committing. --- kbx/backend-sqlite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kbx/backend-sqlite.c b/kbx/backend-sqlite.c index e5fda9458..5f716e22c 100644 --- a/kbx/backend-sqlite.c +++ b/kbx/backend-sqlite.c @@ -775,7 +775,7 @@ run_select_statement (be_sqlite_local_t ctx, if (!ctx->select_stmt) err = run_sql_prepare ("SELECT p.ubid, p.type, p.keyblob" " FROM pubkey as p, fingerprint as f" - " WHERE f.kid = ?1", + " WHERE p.ubid = f.ubid AND f.kid = ?1", &ctx->select_stmt); if (!err) err = run_sql_bind_int64 (ctx->select_stmt, 1, @@ -786,7 +786,7 @@ run_select_statement (be_sqlite_local_t ctx, if (!ctx->select_stmt) err = run_sql_prepare ("SELECT p.ubid, p.type, p.keyblob" " FROM pubkey as p, fingerprint as f" - " WHERE f.fpr = ?1", + " WHERE p.ubid = f.ubid AND f.fpr = ?1", &ctx->select_stmt); if (!err) err = run_sql_bind_blob (ctx->select_stmt, 1, @@ -797,7 +797,7 @@ run_select_statement (be_sqlite_local_t ctx, if (!ctx->select_stmt) err = run_sql_prepare ("SELECT p.ubid, p.type, p.keyblob" " FROM pubkey as p, fingerprint as f" - " WHERE f.keygrip = ?1", + " WHERE p.ubid = f.ubid AND f.keygrip = ?1", &ctx->select_stmt); if (!err) err = run_sql_bind_blob (ctx->select_stmt, 1,