NeoMutt  2021-02-05
Teaching an old dog new tricks
DOXYGEN
db.c File Reference

Autocrypt database handling. More...

#include "config.h"
#include <stddef.h>
#include <sqlite3.h>
#include <stdbool.h>
#include <sys/stat.h>
#include "private.h"
#include "mutt/lib.h"
#include "address/lib.h"
#include "autocrypt/lib.h"
+ Include dependency graph for db.c:

Go to the source code of this file.

Functions

static int autocrypt_db_create (const char *db_path)
 Create an Autocrypt SQLite database. More...
 
int mutt_autocrypt_db_init (bool can_create)
 Initialise the Autocrypt SQLite database. More...
 
void mutt_autocrypt_db_close (void)
 Close the Autocrypt SQLite database connection. More...
 
void mutt_autocrypt_db_normalize_addr (struct Address *a)
 Normalise an Email Address. More...
 
void mutt_autocrypt_db_normalize_addrlist (struct AddressList *al)
 Normalise a list of Email Addresses. More...
 
static struct Addresscopy_normalize_addr (struct Address *addr)
 Copy a normalised Email Address. More...
 
static char * strdup_column_text (sqlite3_stmt *stmt, int index)
 Copy a string from the database. More...
 
struct AutocryptAccountmutt_autocrypt_db_account_new (void)
 Create a new AutocryptAccount. More...
 
void mutt_autocrypt_db_account_free (struct AutocryptAccount **ptr)
 Free an AutocryptAccount. More...
 
int mutt_autocrypt_db_account_get (struct Address *addr, struct AutocryptAccount **account)
 Get Autocrypt Account data from the database. More...
 
int mutt_autocrypt_db_account_insert (struct Address *addr, const char *keyid, const char *keydata, bool prefer_encrypt)
 Insert an Account into the Autocrypt database. More...
 
int mutt_autocrypt_db_account_update (struct AutocryptAccount *acct)
 Update Account info in the Autocrypt database. More...
 
int mutt_autocrypt_db_account_delete (struct AutocryptAccount *acct)
 Delete an Account from the Autocrypt database. More...
 
int mutt_autocrypt_db_account_get_all (struct AutocryptAccount ***accounts, int *num_accounts)
 Get all accounts from an Autocrypt database. More...
 
struct AutocryptPeermutt_autocrypt_db_peer_new (void)
 Create a new AutocryptPeer. More...
 
void mutt_autocrypt_db_peer_free (struct AutocryptPeer **ptr)
 Free an AutocryptPeer. More...
 
int mutt_autocrypt_db_peer_get (struct Address *addr, struct AutocryptPeer **peer)
 Get peer info from the Autocrypt database. More...
 
int mutt_autocrypt_db_peer_insert (struct Address *addr, struct AutocryptPeer *peer)
 Insert a peer into the Autocrypt database. More...
 
int mutt_autocrypt_db_peer_update (struct AutocryptPeer *peer)
 Update the peer info in an Autocrypt database. More...
 
struct AutocryptPeerHistorymutt_autocrypt_db_peer_history_new (void)
 Create a new AutocryptPeerHistory. More...
 
void mutt_autocrypt_db_peer_history_free (struct AutocryptPeerHistory **ptr)
 Free an AutocryptPeerHistory. More...
 
int mutt_autocrypt_db_peer_history_insert (struct Address *addr, struct AutocryptPeerHistory *peerhist)
 Insert peer history into the Autocrypt database. More...
 
struct AutocryptGossipHistorymutt_autocrypt_db_gossip_history_new (void)
 Create a new AutocryptGossipHistory. More...
 
void mutt_autocrypt_db_gossip_history_free (struct AutocryptGossipHistory **ptr)
 Free an AutocryptGossipHistory. More...
 
int mutt_autocrypt_db_gossip_history_insert (struct Address *addr, struct AutocryptGossipHistory *gossip_hist)
 Insert a gossip history into the Autocrypt database. More...
 

Variables

static sqlite3_stmt * AccountGetStmt
 
static sqlite3_stmt * AccountInsertStmt
 
static sqlite3_stmt * AccountUpdateStmt
 
static sqlite3_stmt * AccountDeleteStmt
 
static sqlite3_stmt * PeerGetStmt
 
static sqlite3_stmt * PeerInsertStmt
 
static sqlite3_stmt * PeerUpdateStmt
 
static sqlite3_stmt * PeerHistoryInsertStmt
 
static sqlite3_stmt * GossipHistoryInsertStmt
 
sqlite3 * AutocryptDB = NULL
 

Detailed Description

Autocrypt database handling.

Authors
  • Kevin J. McCarthy

This program 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 http://www.gnu.org/licenses/.

Definition in file db.c.

Function Documentation

◆ autocrypt_db_create()

static int autocrypt_db_create ( const char *  db_path)
static

Create an Autocrypt SQLite database.

Parameters
db_pathPath to database file
Return values
0Success
-1Error

Definition at line 58 of file db.c.

59 {
60  if (sqlite3_open_v2(db_path, &AutocryptDB,
61  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK)
62  {
63  /* L10N: s is the path to the database.
64  For some reason sqlite3 failed to open that database file. */
65  mutt_error(_("Unable to open autocrypt database %s"), db_path);
66  return -1;
67  }
69 }
sqlite3 * AutocryptDB
Definition: db.c:50
#define _(a)
Definition: message.h:28
int mutt_autocrypt_schema_init(void)
Set up an Autocrypt database.
Definition: schema.c:39
#define mutt_error(...)
Definition: logging.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_init()

int mutt_autocrypt_db_init ( bool  can_create)

Initialise the Autocrypt SQLite database.

Parameters
can_createIf true, the directory may be created
Return values
0Success
-1Error

Definition at line 77 of file db.c.

78 {
79  int rc = -1;
80 
81  if (AutocryptDB)
82  return 0;
83 
84  if (!C_Autocrypt || !C_AutocryptDir)
85  return -1;
86 
87  struct Buffer *db_path = mutt_buffer_pool_get();
88  mutt_buffer_concat_path(db_path, C_AutocryptDir, "autocrypt.db");
89 
90  struct stat sb;
91  if (stat(mutt_buffer_string(db_path), &sb) == 0)
92  {
93  if (sqlite3_open_v2(mutt_buffer_string(db_path), &AutocryptDB,
94  SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK)
95  {
96  /* L10N: Error message if autocrypt couldn't open the SQLite database
97  for some reason. The %s is the full path of the database file. */
98  mutt_error(_("Unable to open autocrypt database %s"), mutt_buffer_string(db_path));
99  goto cleanup;
100  }
101 
103  goto cleanup;
104  }
105  else
106  {
107  if (!can_create)
108  goto cleanup;
110  goto cleanup;
111  /* Don't abort the whole init process because account creation failed */
114  }
115 
116  rc = 0;
117 
118 cleanup:
119  mutt_buffer_pool_release(&db_path);
120  return rc;
121 }
char * C_AutocryptDir
Config: Location of autocrypt files, including the GPG keyring and SQLite database.
Definition: config.c:40
sqlite3 * AutocryptDB
Definition: db.c:50
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
bool C_Autocrypt
Config: Enables the Autocrypt feature.
Definition: config.c:37
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
String manipulation buffer.
Definition: buffer.h:33
#define _(a)
Definition: message.h:28
int mutt_autocrypt_account_init(bool prompt)
Create a new Autocrypt account.
Definition: autocrypt.c:147
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
void mutt_autocrypt_scan_mailboxes(void)
Scan mailboxes for Autocrypt headers.
Definition: autocrypt.c:901
static int autocrypt_db_create(const char *db_path)
Create an Autocrypt SQLite database.
Definition: db.c:58
#define mutt_error(...)
Definition: logging.h:84
size_t mutt_buffer_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
Definition: buffer.c:374
int mutt_autocrypt_schema_update(void)
Update the version number of the Autocrypt database schema.
Definition: schema.c:105
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_close()

void mutt_autocrypt_db_close ( void  )

Close the Autocrypt SQLite database connection.

Definition at line 126 of file db.c.

127 {
128  if (!AutocryptDB)
129  return;
130 
131  sqlite3_finalize(AccountGetStmt);
132  AccountGetStmt = NULL;
133  sqlite3_finalize(AccountInsertStmt);
134  AccountInsertStmt = NULL;
135  sqlite3_finalize(AccountUpdateStmt);
136  AccountUpdateStmt = NULL;
137  sqlite3_finalize(AccountDeleteStmt);
138  AccountDeleteStmt = NULL;
139 
140  sqlite3_finalize(PeerGetStmt);
141  PeerGetStmt = NULL;
142  sqlite3_finalize(PeerInsertStmt);
143  PeerInsertStmt = NULL;
144  sqlite3_finalize(PeerUpdateStmt);
145  PeerUpdateStmt = NULL;
146 
147  sqlite3_finalize(PeerHistoryInsertStmt);
148  PeerHistoryInsertStmt = NULL;
149 
150  sqlite3_finalize(GossipHistoryInsertStmt);
152 
153  sqlite3_close_v2(AutocryptDB);
154  AutocryptDB = NULL;
155 }
sqlite3 * AutocryptDB
Definition: db.c:50
static sqlite3_stmt * AccountUpdateStmt
Definition: db.c:42
static sqlite3_stmt * AccountInsertStmt
Definition: db.c:41
static sqlite3_stmt * PeerGetStmt
Definition: db.c:44
static sqlite3_stmt * GossipHistoryInsertStmt
Definition: db.c:48
static sqlite3_stmt * PeerUpdateStmt
Definition: db.c:46
static sqlite3_stmt * AccountDeleteStmt
Definition: db.c:43
static sqlite3_stmt * AccountGetStmt
Definition: db.c:40
static sqlite3_stmt * PeerInsertStmt
Definition: db.c:45
static sqlite3_stmt * PeerHistoryInsertStmt
Definition: db.c:47
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_normalize_addr()

void mutt_autocrypt_db_normalize_addr ( struct Address a)

Normalise an Email Address.

Parameters
aAddress to normalise

Definition at line 161 of file db.c.

162 {
166 }
char * mailbox
Mailbox and host address.
Definition: address.h:37
bool mutt_addr_to_local(struct Address *a)
Convert an Address from Punycode.
Definition: address.c:1349
char * mutt_str_lower(char *s)
Convert all characters in the string to lowercase.
Definition: string.c:504
bool mutt_addr_to_intl(struct Address *a)
Convert an Address to Punycode.
Definition: address.c:1275
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_normalize_addrlist()

void mutt_autocrypt_db_normalize_addrlist ( struct AddressList *  al)

Normalise a list of Email Addresses.

Parameters
alList of Addresses to normalise

Definition at line 172 of file db.c.

173 {
175 
176  struct Address *np = NULL;
177  TAILQ_FOREACH(np, al, entries)
178  {
179  mutt_str_lower(np->mailbox);
180  }
181 
182  mutt_addrlist_to_intl(al, NULL);
183 }
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
Definition: address.c:1386
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
char * mutt_str_lower(char *s)
Convert all characters in the string to lowercase.
Definition: string.c:504
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1304
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy_normalize_addr()

static struct Address* copy_normalize_addr ( struct Address addr)
static

Copy a normalised Email Address.

Parameters
addrAddress to normalise and copy
Return values
ptrCopy of the Address

The autocrypt spec says email addresses should be normalized to lower case and stored in idna form.

In order to avoid visible changes to addresses in the index, we make a copy of the address before lowercasing it.

Note
The return value must be freed

Definition at line 198 of file db.c.

199 {
200  /* NOTE: the db functions expect a single address, so in
201  * this function we copy only the address passed in.
202  *
203  * The normalize_addrlist above is extended to work on a list
204  * because of requirements in autocrypt.c */
205 
206  struct Address *norm_addr = mutt_addr_new();
207  norm_addr->mailbox = mutt_str_dup(addr->mailbox);
208  norm_addr->is_intl = addr->is_intl;
209  norm_addr->intl_checked = addr->intl_checked;
210 
212  return norm_addr;
213 }
void mutt_autocrypt_db_normalize_addr(struct Address *a)
Normalise an Email Address.
Definition: db.c:161
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
struct Address * mutt_addr_new(void)
Create a new Address.
Definition: address.c:385
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
bool is_intl
International Domain Name.
Definition: address.h:39
bool intl_checked
Checked for IDN?
Definition: address.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strdup_column_text()

static char* strdup_column_text ( sqlite3_stmt *  stmt,
int  index 
)
static

Copy a string from the database.

Parameters
stmtSQLite database statement
indexDatabase row
Return values
ptrCopy of string

Definition at line 221 of file db.c.

222 {
223  const char *val = (const char *) sqlite3_column_text(stmt, index);
224  return mutt_str_dup(val);
225 }
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_account_new()

struct AutocryptAccount* mutt_autocrypt_db_account_new ( void  )

Create a new AutocryptAccount.

Return values
ptrNew AutocryptAccount

Definition at line 231 of file db.c.

232 {
233  return mutt_mem_calloc(1, sizeof(struct AutocryptAccount));
234 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Autocrypt account.
Definition: lib.h:103
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_account_free()

void mutt_autocrypt_db_account_free ( struct AutocryptAccount **  ptr)

Free an AutocryptAccount.

Parameters
ptrAccount to free

Definition at line 240 of file db.c.

241 {
242  if (!ptr || !*ptr)
243  return;
244 
245  struct AutocryptAccount *ac = *ptr;
246  FREE(&ac->email_addr);
247  FREE(&ac->keyid);
248  FREE(&ac->keydata);
249  FREE(ptr);
250 }
char * email_addr
Definition: lib.h:105
char * keyid
Definition: lib.h:106
Autocrypt account.
Definition: lib.h:103
char * keydata
Definition: lib.h:107
#define FREE(x)
Definition: memory.h:40
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_account_get()

int mutt_autocrypt_db_account_get ( struct Address addr,
struct AutocryptAccount **  account 
)

Get Autocrypt Account data from the database.

Parameters
[in]addrEmail Address to lookup
[out]accountMatched account
Return values
0Success
-1Error

Definition at line 259 of file db.c.

260 {
261  int rc = -1;
262 
263  struct Address *norm_addr = copy_normalize_addr(addr);
264  *account = NULL;
265 
266  if (!AccountGetStmt)
267  {
268  if (sqlite3_prepare_v3(AutocryptDB,
269  "SELECT "
270  "email_addr, "
271  "keyid, "
272  "keydata, "
273  "prefer_encrypt, "
274  "enabled "
275  "FROM account "
276  "WHERE email_addr = ?",
277  -1, SQLITE_PREPARE_PERSISTENT, &AccountGetStmt, NULL) != SQLITE_OK)
278  {
279  goto cleanup;
280  }
281  }
282 
283  if (sqlite3_bind_text(AccountGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
284  goto cleanup;
285 
286  int result = sqlite3_step(AccountGetStmt);
287  if (result != SQLITE_ROW)
288  {
289  if (result == SQLITE_DONE)
290  rc = 0;
291  goto cleanup;
292  }
293 
294  *account = mutt_autocrypt_db_account_new();
295  (*account)->email_addr = strdup_column_text(AccountGetStmt, 0);
296  (*account)->keyid = strdup_column_text(AccountGetStmt, 1);
297  (*account)->keydata = strdup_column_text(AccountGetStmt, 2);
298  (*account)->prefer_encrypt = sqlite3_column_int(AccountGetStmt, 3);
299  (*account)->enabled = sqlite3_column_int(AccountGetStmt, 4);
300 
301  rc = 1;
302 
303 cleanup:
304  mutt_addr_free(&norm_addr);
305  sqlite3_reset(AccountGetStmt);
306  return rc;
307 }
sqlite3 * AutocryptDB
Definition: db.c:50
struct AutocryptAccount * mutt_autocrypt_db_account_new(void)
Create a new AutocryptAccount.
Definition: db.c:231
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
static struct Address * copy_normalize_addr(struct Address *addr)
Copy a normalised Email Address.
Definition: db.c:198
static sqlite3_stmt * AccountGetStmt
Definition: db.c:40
static char * strdup_column_text(sqlite3_stmt *stmt, int index)
Copy a string from the database.
Definition: db.c:221
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_account_insert()

int mutt_autocrypt_db_account_insert ( struct Address addr,
const char *  keyid,
const char *  keydata,
bool  prefer_encrypt 
)

Insert an Account into the Autocrypt database.

Parameters
addrEmail Address for the account
keyidAutocrypt KeyID
keydataAutocrypt key data
prefer_encryptWhether the account prefers encryption
Return values
0Success
-1Error

Definition at line 318 of file db.c.

320 {
321  int rc = -1;
322 
323  struct Address *norm_addr = copy_normalize_addr(addr);
324 
325  if (!AccountInsertStmt)
326  {
327  if (sqlite3_prepare_v3(AutocryptDB,
328  "INSERT INTO account "
329  "(email_addr, "
330  "keyid, "
331  "keydata, "
332  "prefer_encrypt, "
333  "enabled) "
334  "VALUES (?, ?, ?, ?, ?);",
335  -1, SQLITE_PREPARE_PERSISTENT, &AccountInsertStmt, NULL) != SQLITE_OK)
336  {
337  goto cleanup;
338  }
339  }
340 
341  if (sqlite3_bind_text(AccountInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
342  goto cleanup;
343  if (sqlite3_bind_text(AccountInsertStmt, 2, keyid, -1, SQLITE_STATIC) != SQLITE_OK)
344  goto cleanup;
345  if (sqlite3_bind_text(AccountInsertStmt, 3, keydata, -1, SQLITE_STATIC) != SQLITE_OK)
346  goto cleanup;
347  if (sqlite3_bind_int(AccountInsertStmt, 4, prefer_encrypt) != SQLITE_OK)
348  goto cleanup;
349  if (sqlite3_bind_int(AccountInsertStmt, 5, 1) != SQLITE_OK)
350  goto cleanup;
351 
352  if (sqlite3_step(AccountInsertStmt) != SQLITE_DONE)
353  goto cleanup;
354 
355  rc = 0;
356 
357 cleanup:
358  mutt_addr_free(&norm_addr);
359  sqlite3_reset(AccountInsertStmt);
360  return rc;
361 }
sqlite3 * AutocryptDB
Definition: db.c:50
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
static sqlite3_stmt * AccountInsertStmt
Definition: db.c:41
static struct Address * copy_normalize_addr(struct Address *addr)
Copy a normalised Email Address.
Definition: db.c:198
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_account_update()

int mutt_autocrypt_db_account_update ( struct AutocryptAccount acct)

Update Account info in the Autocrypt database.

Parameters
acctAutocrypt Account data
Return values
0Success
-1Error

Definition at line 369 of file db.c.

370 {
371  int rc = -1;
372 
373  if (!AccountUpdateStmt)
374  {
375  if (sqlite3_prepare_v3(AutocryptDB,
376  "UPDATE account SET "
377  "keyid = ?, "
378  "keydata = ?, "
379  "prefer_encrypt = ?, "
380  "enabled = ? "
381  "WHERE email_addr = ?;",
382  -1, SQLITE_PREPARE_PERSISTENT, &AccountUpdateStmt, NULL) != SQLITE_OK)
383  {
384  goto cleanup;
385  }
386  }
387 
388  if (sqlite3_bind_text(AccountUpdateStmt, 1, acct->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
389  goto cleanup;
390  if (sqlite3_bind_text(AccountUpdateStmt, 2, acct->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
391  goto cleanup;
392  if (sqlite3_bind_int(AccountUpdateStmt, 3, acct->prefer_encrypt) != SQLITE_OK)
393  goto cleanup;
394  if (sqlite3_bind_int(AccountUpdateStmt, 4, acct->enabled) != SQLITE_OK)
395  goto cleanup;
396  if (sqlite3_bind_text(AccountUpdateStmt, 5, acct->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
397  goto cleanup;
398 
399  if (sqlite3_step(AccountUpdateStmt) != SQLITE_DONE)
400  goto cleanup;
401 
402  rc = 0;
403 
404 cleanup:
405  sqlite3_reset(AccountUpdateStmt);
406  return rc;
407 }
sqlite3 * AutocryptDB
Definition: db.c:50
char * email_addr
Definition: lib.h:105
char * keyid
Definition: lib.h:106
static sqlite3_stmt * AccountUpdateStmt
Definition: db.c:42
bool enabled
Definition: lib.h:109
bool prefer_encrypt
false = nopref, true = mutual
Definition: lib.h:108
char * keydata
Definition: lib.h:107
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_account_delete()

int mutt_autocrypt_db_account_delete ( struct AutocryptAccount acct)

Delete an Account from the Autocrypt database.

Parameters
acctAccount to delete
Return values
0Success
-1Error

Definition at line 415 of file db.c.

416 {
417  int rc = -1;
418 
419  if (!AccountDeleteStmt)
420  {
421  if (sqlite3_prepare_v3(AutocryptDB,
422  "DELETE from account "
423  "WHERE email_addr = ?;",
424  -1, SQLITE_PREPARE_PERSISTENT, &AccountDeleteStmt, NULL) != SQLITE_OK)
425  {
426  goto cleanup;
427  }
428  }
429 
430  if (sqlite3_bind_text(AccountDeleteStmt, 1, acct->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
431  goto cleanup;
432 
433  if (sqlite3_step(AccountDeleteStmt) != SQLITE_DONE)
434  goto cleanup;
435 
436  rc = 0;
437 
438 cleanup:
439  sqlite3_reset(AccountDeleteStmt);
440  return rc;
441 }
sqlite3 * AutocryptDB
Definition: db.c:50
char * email_addr
Definition: lib.h:105
static sqlite3_stmt * AccountDeleteStmt
Definition: db.c:43
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_account_get_all()

int mutt_autocrypt_db_account_get_all ( struct AutocryptAccount ***  accounts,
int *  num_accounts 
)

Get all accounts from an Autocrypt database.

Parameters
[out]accountsList of accounts
[out]num_accountsNumber of accounts
Return values
0Success
-1Error

Definition at line 450 of file db.c.

451 {
452  int rc = -1, result;
453  sqlite3_stmt *stmt = NULL;
454  struct AutocryptAccount **results = NULL;
455  int results_len = 0, results_count = 0;
456 
457  *accounts = NULL;
458  *num_accounts = 0;
459 
460  /* Note, speed is not of the essence for the account management screen,
461  * so we don't bother with a persistent prepared statement */
462  if (sqlite3_prepare_v2(AutocryptDB,
463  "SELECT "
464  "email_addr, "
465  "keyid, "
466  "keydata, "
467  "prefer_encrypt, "
468  "enabled "
469  "FROM account "
470  "ORDER BY email_addr",
471  -1, &stmt, NULL) != SQLITE_OK)
472  {
473  goto cleanup;
474  }
475 
476  while ((result = sqlite3_step(stmt)) == SQLITE_ROW)
477  {
478  if (results_count == results_len)
479  {
480  results_len += 5;
481  mutt_mem_realloc(&results, results_len * sizeof(struct AutocryptAccount *));
482  }
483 
485  results[results_count++] = account;
486 
487  account->email_addr = strdup_column_text(stmt, 0);
488  account->keyid = strdup_column_text(stmt, 1);
489  account->keydata = strdup_column_text(stmt, 2);
490  account->prefer_encrypt = sqlite3_column_int(stmt, 3);
491  account->enabled = sqlite3_column_int(stmt, 4);
492  }
493 
494  if (result == SQLITE_DONE)
495  {
496  *accounts = results;
497  rc = *num_accounts = results_count;
498  }
499  else
500  {
501  while (results_count > 0)
502  mutt_autocrypt_db_account_free(&results[--results_count]);
503  FREE(&results);
504  }
505 
506 cleanup:
507  sqlite3_finalize(stmt);
508  return rc;
509 }
sqlite3 * AutocryptDB
Definition: db.c:50
void mutt_autocrypt_db_account_free(struct AutocryptAccount **ptr)
Free an AutocryptAccount.
Definition: db.c:240
struct AutocryptAccount * mutt_autocrypt_db_account_new(void)
Create a new AutocryptAccount.
Definition: db.c:231
char * email_addr
Definition: lib.h:105
char * keyid
Definition: lib.h:106
bool enabled
Definition: lib.h:109
bool prefer_encrypt
false = nopref, true = mutual
Definition: lib.h:108
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
Autocrypt account.
Definition: lib.h:103
char * keydata
Definition: lib.h:107
#define FREE(x)
Definition: memory.h:40
static char * strdup_column_text(sqlite3_stmt *stmt, int index)
Copy a string from the database.
Definition: db.c:221
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_new()

struct AutocryptPeer* mutt_autocrypt_db_peer_new ( void  )

Create a new AutocryptPeer.

Return values
ptrNew AutocryptPeer

Definition at line 515 of file db.c.

516 {
517  return mutt_mem_calloc(1, sizeof(struct AutocryptPeer));
518 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Autocrypt peer.
Definition: lib.h:115
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_free()

void mutt_autocrypt_db_peer_free ( struct AutocryptPeer **  ptr)

Free an AutocryptPeer.

Parameters
ptrAutocryptPeer to free

Definition at line 524 of file db.c.

525 {
526  if (!ptr || !*ptr)
527  return;
528 
529  struct AutocryptPeer *peer = *ptr;
530  FREE(&peer->email_addr);
531  FREE(&peer->keyid);
532  FREE(&peer->keydata);
533  FREE(&peer->gossip_keyid);
534  FREE(&peer->gossip_keydata);
535  FREE(ptr);
536 }
char * keydata
Definition: lib.h:121
char * gossip_keydata
Definition: lib.h:125
Autocrypt peer.
Definition: lib.h:115
char * email_addr
Definition: lib.h:117
char * gossip_keyid
Definition: lib.h:124
#define FREE(x)
Definition: memory.h:40
char * keyid
Definition: lib.h:120
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_get()

int mutt_autocrypt_db_peer_get ( struct Address addr,
struct AutocryptPeer **  peer 
)

Get peer info from the Autocrypt database.

Parameters
[in]addrEmail Address to look up
[out]peerMatching Autocrypt Peer
Return values
0Success, no matches
1Success, a match
-1Error

Definition at line 546 of file db.c.

547 {
548  int rc = -1;
549 
550  struct Address *norm_addr = copy_normalize_addr(addr);
551  *peer = NULL;
552 
553  if (!PeerGetStmt)
554  {
555  if (sqlite3_prepare_v3(AutocryptDB,
556  "SELECT "
557  "email_addr, "
558  "last_seen, "
559  "autocrypt_timestamp, "
560  "keyid, "
561  "keydata, "
562  "prefer_encrypt, "
563  "gossip_timestamp, "
564  "gossip_keyid, "
565  "gossip_keydata "
566  "FROM peer "
567  "WHERE email_addr = ?",
568  -1, SQLITE_PREPARE_PERSISTENT, &PeerGetStmt, NULL) != SQLITE_OK)
569  {
570  goto cleanup;
571  }
572  }
573 
574  if (sqlite3_bind_text(PeerGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
575  goto cleanup;
576 
577  int result = sqlite3_step(PeerGetStmt);
578  if (result != SQLITE_ROW)
579  {
580  if (result == SQLITE_DONE)
581  rc = 0;
582  goto cleanup;
583  }
584 
585  *peer = mutt_autocrypt_db_peer_new();
586  (*peer)->email_addr = strdup_column_text(PeerGetStmt, 0);
587  (*peer)->last_seen = sqlite3_column_int64(PeerGetStmt, 1);
588  (*peer)->autocrypt_timestamp = sqlite3_column_int64(PeerGetStmt, 2);
589  (*peer)->keyid = strdup_column_text(PeerGetStmt, 3);
590  (*peer)->keydata = strdup_column_text(PeerGetStmt, 4);
591  (*peer)->prefer_encrypt = sqlite3_column_int(PeerGetStmt, 5);
592  (*peer)->gossip_timestamp = sqlite3_column_int64(PeerGetStmt, 6);
593  (*peer)->gossip_keyid = strdup_column_text(PeerGetStmt, 7);
594  (*peer)->gossip_keydata = strdup_column_text(PeerGetStmt, 8);
595 
596  rc = 1;
597 
598 cleanup:
599  mutt_addr_free(&norm_addr);
600  sqlite3_reset(PeerGetStmt);
601  return rc;
602 }
sqlite3 * AutocryptDB
Definition: db.c:50
struct AutocryptPeer * mutt_autocrypt_db_peer_new(void)
Create a new AutocryptPeer.
Definition: db.c:515
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
static struct Address * copy_normalize_addr(struct Address *addr)
Copy a normalised Email Address.
Definition: db.c:198
static sqlite3_stmt * PeerGetStmt
Definition: db.c:44
static char * strdup_column_text(sqlite3_stmt *stmt, int index)
Copy a string from the database.
Definition: db.c:221
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_insert()

int mutt_autocrypt_db_peer_insert ( struct Address addr,
struct AutocryptPeer peer 
)

Insert a peer into the Autocrypt database.

Parameters
addrEmail Address
peerAutocryptPeer to insert
Return values
0Success
-1Error

Definition at line 611 of file db.c.

612 {
613  int rc = -1;
614  struct Address *norm_addr = NULL;
615 
616  norm_addr = copy_normalize_addr(addr);
617 
618  if (!PeerInsertStmt)
619  {
620  if (sqlite3_prepare_v3(AutocryptDB,
621  "INSERT INTO peer "
622  "(email_addr, "
623  "last_seen, "
624  "autocrypt_timestamp, "
625  "keyid, "
626  "keydata, "
627  "prefer_encrypt, "
628  "gossip_timestamp, "
629  "gossip_keyid, "
630  "gossip_keydata) "
631  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);",
632  -1, SQLITE_PREPARE_PERSISTENT, &PeerInsertStmt, NULL) != SQLITE_OK)
633  {
634  goto cleanup;
635  }
636  }
637 
638  if (sqlite3_bind_text(PeerInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
639  goto cleanup;
640  if (sqlite3_bind_int64(PeerInsertStmt, 2, peer->last_seen) != SQLITE_OK)
641  goto cleanup;
642  if (sqlite3_bind_int64(PeerInsertStmt, 3, peer->autocrypt_timestamp) != SQLITE_OK)
643  goto cleanup;
644  if (sqlite3_bind_text(PeerInsertStmt, 4, peer->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
645  goto cleanup;
646  if (sqlite3_bind_text(PeerInsertStmt, 5, peer->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
647  goto cleanup;
648  if (sqlite3_bind_int(PeerInsertStmt, 6, peer->prefer_encrypt) != SQLITE_OK)
649  goto cleanup;
650  if (sqlite3_bind_int64(PeerInsertStmt, 7, peer->gossip_timestamp) != SQLITE_OK)
651  goto cleanup;
652  if (sqlite3_bind_text(PeerInsertStmt, 8, peer->gossip_keyid, -1, SQLITE_STATIC) != SQLITE_OK)
653  goto cleanup;
654  if (sqlite3_bind_text(PeerInsertStmt, 9, peer->gossip_keydata, -1, SQLITE_STATIC) != SQLITE_OK)
655  goto cleanup;
656 
657  if (sqlite3_step(PeerInsertStmt) != SQLITE_DONE)
658  goto cleanup;
659 
660  rc = 0;
661 
662 cleanup:
663  mutt_addr_free(&norm_addr);
664  sqlite3_reset(PeerInsertStmt);
665  return rc;
666 }
sqlite3 * AutocryptDB
Definition: db.c:50
char * keydata
Definition: lib.h:121
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
char * gossip_keydata
Definition: lib.h:125
sqlite3_int64 gossip_timestamp
Definition: lib.h:123
sqlite3_int64 autocrypt_timestamp
Definition: lib.h:119
static struct Address * copy_normalize_addr(struct Address *addr)
Copy a normalised Email Address.
Definition: db.c:198
sqlite3_int64 last_seen
Definition: lib.h:118
char * gossip_keyid
Definition: lib.h:124
bool prefer_encrypt
false = nopref, true = mutual
Definition: lib.h:122
static sqlite3_stmt * PeerInsertStmt
Definition: db.c:45
char * keyid
Definition: lib.h:120
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_update()

int mutt_autocrypt_db_peer_update ( struct AutocryptPeer peer)

Update the peer info in an Autocrypt database.

Parameters
peerAutocryptPeer to update
Return values
0Success
-1Error

Definition at line 674 of file db.c.

675 {
676  int rc = -1;
677 
678  if (!PeerUpdateStmt)
679  {
680  if (sqlite3_prepare_v3(AutocryptDB,
681  "UPDATE peer SET "
682  "last_seen = ?, "
683  "autocrypt_timestamp = ?, "
684  "keyid = ?, "
685  "keydata = ?, "
686  "prefer_encrypt = ?, "
687  "gossip_timestamp = ?, "
688  "gossip_keyid = ?, "
689  "gossip_keydata = ? "
690  "WHERE email_addr = ?;",
691  -1, SQLITE_PREPARE_PERSISTENT, &PeerUpdateStmt, NULL) != SQLITE_OK)
692  {
693  goto cleanup;
694  }
695  }
696 
697  if (sqlite3_bind_int64(PeerUpdateStmt, 1, peer->last_seen) != SQLITE_OK)
698  goto cleanup;
699  if (sqlite3_bind_int64(PeerUpdateStmt, 2, peer->autocrypt_timestamp) != SQLITE_OK)
700  goto cleanup;
701  if (sqlite3_bind_text(PeerUpdateStmt, 3, peer->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
702  goto cleanup;
703  if (sqlite3_bind_text(PeerUpdateStmt, 4, peer->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
704  goto cleanup;
705  if (sqlite3_bind_int(PeerUpdateStmt, 5, peer->prefer_encrypt) != SQLITE_OK)
706  goto cleanup;
707  if (sqlite3_bind_int64(PeerUpdateStmt, 6, peer->gossip_timestamp) != SQLITE_OK)
708  goto cleanup;
709  if (sqlite3_bind_text(PeerUpdateStmt, 7, peer->gossip_keyid, -1, SQLITE_STATIC) != SQLITE_OK)
710  goto cleanup;
711  if (sqlite3_bind_text(PeerUpdateStmt, 8, peer->gossip_keydata, -1, SQLITE_STATIC) != SQLITE_OK)
712  goto cleanup;
713  if (sqlite3_bind_text(PeerUpdateStmt, 9, peer->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
714  goto cleanup;
715 
716  if (sqlite3_step(PeerUpdateStmt) != SQLITE_DONE)
717  goto cleanup;
718 
719  rc = 0;
720 
721 cleanup:
722  sqlite3_reset(PeerUpdateStmt);
723  return rc;
724 }
sqlite3 * AutocryptDB
Definition: db.c:50
char * keydata
Definition: lib.h:121
char * gossip_keydata
Definition: lib.h:125
sqlite3_int64 gossip_timestamp
Definition: lib.h:123
sqlite3_int64 autocrypt_timestamp
Definition: lib.h:119
char * email_addr
Definition: lib.h:117
sqlite3_int64 last_seen
Definition: lib.h:118
char * gossip_keyid
Definition: lib.h:124
static sqlite3_stmt * PeerUpdateStmt
Definition: db.c:46
bool prefer_encrypt
false = nopref, true = mutual
Definition: lib.h:122
char * keyid
Definition: lib.h:120
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_history_new()

struct AutocryptPeerHistory* mutt_autocrypt_db_peer_history_new ( void  )

Create a new AutocryptPeerHistory.

Return values
ptrNew AutocryptPeerHistory

Definition at line 730 of file db.c.

731 {
732  return mutt_mem_calloc(1, sizeof(struct AutocryptPeerHistory));
733 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Autocrypt peer history.
Definition: lib.h:131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_history_free()

void mutt_autocrypt_db_peer_history_free ( struct AutocryptPeerHistory **  ptr)

Free an AutocryptPeerHistory.

Parameters
ptrAutocryptPeerHistory to free

Definition at line 739 of file db.c.

740 {
741  if (!ptr || !*ptr)
742  return;
743 
744  struct AutocryptPeerHistory *ph = *ptr;
745  FREE(&ph->peer_email_addr);
746  FREE(&ph->email_msgid);
747  FREE(&ph->keydata);
748  FREE(ptr);
749 }
char * email_msgid
Definition: lib.h:134
Autocrypt peer history.
Definition: lib.h:131
char * keydata
Definition: lib.h:136
#define FREE(x)
Definition: memory.h:40
char * peer_email_addr
Definition: lib.h:133
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_peer_history_insert()

int mutt_autocrypt_db_peer_history_insert ( struct Address addr,
struct AutocryptPeerHistory peerhist 
)

Insert peer history into the Autocrypt database.

Parameters
addrEmail Address
peerhistPeer history to insert
Return values
0Success
-1Error

Definition at line 758 of file db.c.

760 {
761  int rc = -1;
762 
763  struct Address *norm_addr = copy_normalize_addr(addr);
764 
766  {
767  if (sqlite3_prepare_v3(AutocryptDB,
768  "INSERT INTO peer_history "
769  "(peer_email_addr, "
770  "email_msgid, "
771  "timestamp, "
772  "keydata) "
773  "VALUES (?, ?, ?, ?);",
774  -1, SQLITE_PREPARE_PERSISTENT,
775  &PeerHistoryInsertStmt, NULL) != SQLITE_OK)
776  {
777  goto cleanup;
778  }
779  }
780 
781  if (sqlite3_bind_text(PeerHistoryInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
782  goto cleanup;
783  if (sqlite3_bind_text(PeerHistoryInsertStmt, 2, peerhist->email_msgid, -1,
784  SQLITE_STATIC) != SQLITE_OK)
785  goto cleanup;
786  if (sqlite3_bind_int64(PeerHistoryInsertStmt, 3, peerhist->timestamp) != SQLITE_OK)
787  goto cleanup;
788  if (sqlite3_bind_text(PeerHistoryInsertStmt, 4, peerhist->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
789  goto cleanup;
790 
791  if (sqlite3_step(PeerHistoryInsertStmt) != SQLITE_DONE)
792  goto cleanup;
793 
794  rc = 0;
795 
796 cleanup:
797  mutt_addr_free(&norm_addr);
798  sqlite3_reset(PeerHistoryInsertStmt);
799  return rc;
800 }
sqlite3 * AutocryptDB
Definition: db.c:50
char * email_msgid
Definition: lib.h:134
sqlite3_int64 timestamp
Definition: lib.h:135
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
static struct Address * copy_normalize_addr(struct Address *addr)
Copy a normalised Email Address.
Definition: db.c:198
char * keydata
Definition: lib.h:136
static sqlite3_stmt * PeerHistoryInsertStmt
Definition: db.c:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_gossip_history_new()

struct AutocryptGossipHistory* mutt_autocrypt_db_gossip_history_new ( void  )

Create a new AutocryptGossipHistory.

Return values
ptrNew AutocryptGossipHistory

Definition at line 806 of file db.c.

807 {
808  return mutt_mem_calloc(1, sizeof(struct AutocryptGossipHistory));
809 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Autocrypt gossip history.
Definition: lib.h:142
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_gossip_history_free()

void mutt_autocrypt_db_gossip_history_free ( struct AutocryptGossipHistory **  ptr)

Free an AutocryptGossipHistory.

Parameters
ptrAutocryptGossipHistory to free

Definition at line 815 of file db.c.

816 {
817  if (!ptr || !*ptr)
818  return;
819 
820  struct AutocryptGossipHistory *gh = *ptr;
821  FREE(&gh->peer_email_addr);
822  FREE(&gh->sender_email_addr);
823  FREE(&gh->email_msgid);
824  FREE(&gh->gossip_keydata);
825  FREE(ptr);
826 }
char * peer_email_addr
Definition: lib.h:144
char * sender_email_addr
Definition: lib.h:145
char * email_msgid
Definition: lib.h:146
Autocrypt gossip history.
Definition: lib.h:142
#define FREE(x)
Definition: memory.h:40
char * gossip_keydata
Definition: lib.h:148
+ Here is the caller graph for this function:

◆ mutt_autocrypt_db_gossip_history_insert()

int mutt_autocrypt_db_gossip_history_insert ( struct Address addr,
struct AutocryptGossipHistory gossip_hist 
)

Insert a gossip history into the Autocrypt database.

Parameters
addrEmail Address
gossip_histGossip history to insert
Return values
0Success
-1Error

Definition at line 835 of file db.c.

837 {
838  int rc = -1;
839 
840  struct Address *norm_addr = copy_normalize_addr(addr);
841 
843  {
844  if (sqlite3_prepare_v3(AutocryptDB,
845  "INSERT INTO gossip_history "
846  "(peer_email_addr, "
847  "sender_email_addr, "
848  "email_msgid, "
849  "timestamp, "
850  "gossip_keydata) "
851  "VALUES (?, ?, ?, ?, ?);",
852  -1, SQLITE_PREPARE_PERSISTENT,
853  &GossipHistoryInsertStmt, NULL) != SQLITE_OK)
854  {
855  goto cleanup;
856  }
857  }
858 
859  if (sqlite3_bind_text(GossipHistoryInsertStmt, 1, norm_addr->mailbox, -1,
860  SQLITE_STATIC) != SQLITE_OK)
861  {
862  goto cleanup;
863  }
864  if (sqlite3_bind_text(GossipHistoryInsertStmt, 2, gossip_hist->sender_email_addr,
865  -1, SQLITE_STATIC) != SQLITE_OK)
866  {
867  if (sqlite3_bind_text(GossipHistoryInsertStmt, 3, gossip_hist->email_msgid,
868  -1, SQLITE_STATIC) != SQLITE_OK)
869  {
870  goto cleanup;
871  }
872  }
873  if (sqlite3_bind_int64(GossipHistoryInsertStmt, 4, gossip_hist->timestamp) != SQLITE_OK)
874  goto cleanup;
875  if (sqlite3_bind_text(GossipHistoryInsertStmt, 5, gossip_hist->gossip_keydata,
876  -1, SQLITE_STATIC) != SQLITE_OK)
877  {
878  goto cleanup;
879  }
880 
881  if (sqlite3_step(GossipHistoryInsertStmt) != SQLITE_DONE)
882  goto cleanup;
883 
884  rc = 0;
885 
886 cleanup:
887  mutt_addr_free(&norm_addr);
888  sqlite3_reset(GossipHistoryInsertStmt);
889  return rc;
890 }
sqlite3 * AutocryptDB
Definition: db.c:50
An email address.
Definition: address.h:34
char * mailbox
Mailbox and host address.
Definition: address.h:37
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
char * sender_email_addr
Definition: lib.h:145
char * email_msgid
Definition: lib.h:146
static struct Address * copy_normalize_addr(struct Address *addr)
Copy a normalised Email Address.
Definition: db.c:198
static sqlite3_stmt * GossipHistoryInsertStmt
Definition: db.c:48
char * gossip_keydata
Definition: lib.h:148
sqlite3_int64 timestamp
Definition: lib.h:147
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ AccountGetStmt

sqlite3_stmt* AccountGetStmt
static

Definition at line 40 of file db.c.

◆ AccountInsertStmt

sqlite3_stmt* AccountInsertStmt
static

Definition at line 41 of file db.c.

◆ AccountUpdateStmt

sqlite3_stmt* AccountUpdateStmt
static

Definition at line 42 of file db.c.

◆ AccountDeleteStmt

sqlite3_stmt* AccountDeleteStmt
static

Definition at line 43 of file db.c.

◆ PeerGetStmt

sqlite3_stmt* PeerGetStmt
static

Definition at line 44 of file db.c.

◆ PeerInsertStmt

sqlite3_stmt* PeerInsertStmt
static

Definition at line 45 of file db.c.

◆ PeerUpdateStmt

sqlite3_stmt* PeerUpdateStmt
static

Definition at line 46 of file db.c.

◆ PeerHistoryInsertStmt

sqlite3_stmt* PeerHistoryInsertStmt
static

Definition at line 47 of file db.c.

◆ GossipHistoryInsertStmt

sqlite3_stmt* GossipHistoryInsertStmt
static

Definition at line 48 of file db.c.

◆ AutocryptDB

sqlite3* AutocryptDB = NULL

Definition at line 50 of file db.c.