NeoMutt  2020-06-26-250-g349c94
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_b2s(db_path), &sb) == 0)
92  {
93  if (sqlite3_open_v2(mutt_b2s(db_path), &AutocryptDB, SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK)
94  {
95  /* L10N: Error message if autocrypt couldn't open the SQLite database
96  for some reason. The %s is the full path of the database file. */
97  mutt_error(_("Unable to open autocrypt database %s"), mutt_b2s(db_path));
98  goto cleanup;
99  }
100 
102  goto cleanup;
103  }
104  else
105  {
106  if (!can_create)
107  goto cleanup;
108  if (autocrypt_db_create(mutt_b2s(db_path)))
109  goto cleanup;
110  /* Don't abort the whole init process because account creation failed */
113  }
114 
115  rc = 0;
116 
117 cleanup:
118  mutt_buffer_pool_release(&db_path);
119  return rc;
120 }
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
void mutt_autocrypt_scan_mailboxes(void)
Scan mailboxes for Autocrypt headers.
Definition: autocrypt.c:897
#define mutt_b2s(buf)
Definition: buffer.h:41
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 125 of file db.c.

126 {
127  if (!AutocryptDB)
128  return;
129 
130  sqlite3_finalize(AccountGetStmt);
131  AccountGetStmt = NULL;
132  sqlite3_finalize(AccountInsertStmt);
133  AccountInsertStmt = NULL;
134  sqlite3_finalize(AccountUpdateStmt);
135  AccountUpdateStmt = NULL;
136  sqlite3_finalize(AccountDeleteStmt);
137  AccountDeleteStmt = NULL;
138 
139  sqlite3_finalize(PeerGetStmt);
140  PeerGetStmt = NULL;
141  sqlite3_finalize(PeerInsertStmt);
142  PeerInsertStmt = NULL;
143  sqlite3_finalize(PeerUpdateStmt);
144  PeerUpdateStmt = NULL;
145 
146  sqlite3_finalize(PeerHistoryInsertStmt);
147  PeerHistoryInsertStmt = NULL;
148 
149  sqlite3_finalize(GossipHistoryInsertStmt);
151 
152  sqlite3_close_v2(AutocryptDB);
153  AutocryptDB = NULL;
154 }
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 160 of file db.c.

161 {
165 }
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:1342
char * mutt_str_lower(char *s)
Convert all characters in the string to lowercase.
Definition: string.c:509
bool mutt_addr_to_intl(struct Address *a)
Convert an Address to Punycode.
Definition: address.c:1268
+ 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 171 of file db.c.

172 {
174 
175  struct Address *np = NULL;
176  TAILQ_FOREACH(np, al, entries)
177  {
178  mutt_str_lower(np->mailbox);
179  }
180 
181  mutt_addrlist_to_intl(al, NULL);
182 }
#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:1379
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:509
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1297
+ 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 197 of file db.c.

198 {
199  /* NOTE: the db functions expect a single address, so in
200  * this function we copy only the address passed in.
201  *
202  * The normalize_addrlist above is extended to work on a list
203  * because of requirements in autocrypt.c */
204 
205  struct Address *norm_addr = mutt_addr_new();
206  norm_addr->mailbox = mutt_str_dup(addr->mailbox);
207  norm_addr->is_intl = addr->is_intl;
208  norm_addr->intl_checked = addr->intl_checked;
209 
211  return norm_addr;
212 }
void mutt_autocrypt_db_normalize_addr(struct Address *a)
Normalise an Email Address.
Definition: db.c:160
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
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 220 of file db.c.

221 {
222  const char *val = (const char *) sqlite3_column_text(stmt, index);
223  return mutt_str_dup(val);
224 }
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
+ 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 230 of file db.c.

231 {
232  return mutt_mem_calloc(1, sizeof(struct AutocryptAccount));
233 }
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 239 of file db.c.

240 {
241  if (!ptr || !*ptr)
242  return;
243 
244  struct AutocryptAccount *ac = *ptr;
245  FREE(&ac->email_addr);
246  FREE(&ac->keyid);
247  FREE(&ac->keydata);
248  FREE(ptr);
249 }
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 258 of file db.c.

259 {
260  int rc = -1;
261 
262  struct Address *norm_addr = copy_normalize_addr(addr);
263  *account = NULL;
264 
265  if (!AccountGetStmt)
266  {
267  if (sqlite3_prepare_v3(AutocryptDB,
268  "SELECT "
269  "email_addr, "
270  "keyid, "
271  "keydata, "
272  "prefer_encrypt, "
273  "enabled "
274  "FROM account "
275  "WHERE email_addr = ?",
276  -1, SQLITE_PREPARE_PERSISTENT, &AccountGetStmt, NULL) != SQLITE_OK)
277  {
278  goto cleanup;
279  }
280  }
281 
282  if (sqlite3_bind_text(AccountGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
283  goto cleanup;
284 
285  int result = sqlite3_step(AccountGetStmt);
286  if (result != SQLITE_ROW)
287  {
288  if (result == SQLITE_DONE)
289  rc = 0;
290  goto cleanup;
291  }
292 
293  *account = mutt_autocrypt_db_account_new();
294  (*account)->email_addr = strdup_column_text(AccountGetStmt, 0);
295  (*account)->keyid = strdup_column_text(AccountGetStmt, 1);
296  (*account)->keydata = strdup_column_text(AccountGetStmt, 2);
297  (*account)->prefer_encrypt = sqlite3_column_int(AccountGetStmt, 3);
298  (*account)->enabled = sqlite3_column_int(AccountGetStmt, 4);
299 
300  rc = 1;
301 
302 cleanup:
303  mutt_addr_free(&norm_addr);
304  sqlite3_reset(AccountGetStmt);
305  return rc;
306 }
sqlite3 * AutocryptDB
Definition: db.c:50
struct AutocryptAccount * mutt_autocrypt_db_account_new(void)
Create a new AutocryptAccount.
Definition: db.c:230
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:197
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:220
+ 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 317 of file db.c.

319 {
320  int rc = -1;
321 
322  struct Address *norm_addr = copy_normalize_addr(addr);
323 
324  if (!AccountInsertStmt)
325  {
326  if (sqlite3_prepare_v3(AutocryptDB,
327  "INSERT INTO account "
328  "(email_addr, "
329  "keyid, "
330  "keydata, "
331  "prefer_encrypt, "
332  "enabled) "
333  "VALUES (?, ?, ?, ?, ?);",
334  -1, SQLITE_PREPARE_PERSISTENT, &AccountInsertStmt, NULL) != SQLITE_OK)
335  {
336  goto cleanup;
337  }
338  }
339 
340  if (sqlite3_bind_text(AccountInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
341  goto cleanup;
342  if (sqlite3_bind_text(AccountInsertStmt, 2, keyid, -1, SQLITE_STATIC) != SQLITE_OK)
343  goto cleanup;
344  if (sqlite3_bind_text(AccountInsertStmt, 3, keydata, -1, SQLITE_STATIC) != SQLITE_OK)
345  goto cleanup;
346  if (sqlite3_bind_int(AccountInsertStmt, 4, prefer_encrypt) != SQLITE_OK)
347  goto cleanup;
348  if (sqlite3_bind_int(AccountInsertStmt, 5, 1) != SQLITE_OK)
349  goto cleanup;
350 
351  if (sqlite3_step(AccountInsertStmt) != SQLITE_DONE)
352  goto cleanup;
353 
354  rc = 0;
355 
356 cleanup:
357  mutt_addr_free(&norm_addr);
358  sqlite3_reset(AccountInsertStmt);
359  return rc;
360 }
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:197
+ 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 368 of file db.c.

369 {
370  int rc = -1;
371 
372  if (!AccountUpdateStmt)
373  {
374  if (sqlite3_prepare_v3(AutocryptDB,
375  "UPDATE account SET "
376  "keyid = ?, "
377  "keydata = ?, "
378  "prefer_encrypt = ?, "
379  "enabled = ? "
380  "WHERE email_addr = ?;",
381  -1, SQLITE_PREPARE_PERSISTENT, &AccountUpdateStmt, NULL) != SQLITE_OK)
382  {
383  goto cleanup;
384  }
385  }
386 
387  if (sqlite3_bind_text(AccountUpdateStmt, 1, acct->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
388  goto cleanup;
389  if (sqlite3_bind_text(AccountUpdateStmt, 2, acct->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
390  goto cleanup;
391  if (sqlite3_bind_int(AccountUpdateStmt, 3, acct->prefer_encrypt) != SQLITE_OK)
392  goto cleanup;
393  if (sqlite3_bind_int(AccountUpdateStmt, 4, acct->enabled) != SQLITE_OK)
394  goto cleanup;
395  if (sqlite3_bind_text(AccountUpdateStmt, 5, acct->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
396  goto cleanup;
397 
398  if (sqlite3_step(AccountUpdateStmt) != SQLITE_DONE)
399  goto cleanup;
400 
401  rc = 0;
402 
403 cleanup:
404  sqlite3_reset(AccountUpdateStmt);
405  return rc;
406 }
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 414 of file db.c.

415 {
416  int rc = -1;
417 
418  if (!AccountDeleteStmt)
419  {
420  if (sqlite3_prepare_v3(AutocryptDB,
421  "DELETE from account "
422  "WHERE email_addr = ?;",
423  -1, SQLITE_PREPARE_PERSISTENT, &AccountDeleteStmt, NULL) != SQLITE_OK)
424  {
425  goto cleanup;
426  }
427  }
428 
429  if (sqlite3_bind_text(AccountDeleteStmt, 1, acct->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
430  goto cleanup;
431 
432  if (sqlite3_step(AccountDeleteStmt) != SQLITE_DONE)
433  goto cleanup;
434 
435  rc = 0;
436 
437 cleanup:
438  sqlite3_reset(AccountDeleteStmt);
439  return rc;
440 }
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 449 of file db.c.

450 {
451  int rc = -1, result;
452  sqlite3_stmt *stmt = NULL;
453  struct AutocryptAccount **results = NULL;
454  int results_len = 0, results_count = 0;
455 
456  *accounts = NULL;
457  *num_accounts = 0;
458 
459  /* Note, speed is not of the essence for the account management screen,
460  * so we don't bother with a persistent prepared statement */
461  if (sqlite3_prepare_v2(AutocryptDB,
462  "SELECT "
463  "email_addr, "
464  "keyid, "
465  "keydata, "
466  "prefer_encrypt, "
467  "enabled "
468  "FROM account "
469  "ORDER BY email_addr",
470  -1, &stmt, NULL) != SQLITE_OK)
471  {
472  goto cleanup;
473  }
474 
475  while ((result = sqlite3_step(stmt)) == SQLITE_ROW)
476  {
477  if (results_count == results_len)
478  {
479  results_len += 5;
480  mutt_mem_realloc(&results, results_len * sizeof(struct AutocryptAccount *));
481  }
482 
484  results[results_count++] = account;
485 
486  account->email_addr = strdup_column_text(stmt, 0);
487  account->keyid = strdup_column_text(stmt, 1);
488  account->keydata = strdup_column_text(stmt, 2);
489  account->prefer_encrypt = sqlite3_column_int(stmt, 3);
490  account->enabled = sqlite3_column_int(stmt, 4);
491  }
492 
493  if (result == SQLITE_DONE)
494  {
495  *accounts = results;
496  rc = *num_accounts = results_count;
497  }
498  else
499  {
500  while (results_count > 0)
501  mutt_autocrypt_db_account_free(&results[--results_count]);
502  FREE(&results);
503  }
504 
505 cleanup:
506  sqlite3_finalize(stmt);
507  return rc;
508 }
sqlite3 * AutocryptDB
Definition: db.c:50
void mutt_autocrypt_db_account_free(struct AutocryptAccount **ptr)
Free an AutocryptAccount.
Definition: db.c:239
struct AutocryptAccount * mutt_autocrypt_db_account_new(void)
Create a new AutocryptAccount.
Definition: db.c:230
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:220
+ 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 514 of file db.c.

515 {
516  return mutt_mem_calloc(1, sizeof(struct AutocryptPeer));
517 }
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 523 of file db.c.

524 {
525  if (!ptr || !*ptr)
526  return;
527 
528  struct AutocryptPeer *peer = *ptr;
529  FREE(&peer->email_addr);
530  FREE(&peer->keyid);
531  FREE(&peer->keydata);
532  FREE(&peer->gossip_keyid);
533  FREE(&peer->gossip_keydata);
534  FREE(ptr);
535 }
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 545 of file db.c.

546 {
547  int rc = -1;
548 
549  struct Address *norm_addr = copy_normalize_addr(addr);
550  *peer = NULL;
551 
552  if (!PeerGetStmt)
553  {
554  if (sqlite3_prepare_v3(AutocryptDB,
555  "SELECT "
556  "email_addr, "
557  "last_seen, "
558  "autocrypt_timestamp, "
559  "keyid, "
560  "keydata, "
561  "prefer_encrypt, "
562  "gossip_timestamp, "
563  "gossip_keyid, "
564  "gossip_keydata "
565  "FROM peer "
566  "WHERE email_addr = ?",
567  -1, SQLITE_PREPARE_PERSISTENT, &PeerGetStmt, NULL) != SQLITE_OK)
568  {
569  goto cleanup;
570  }
571  }
572 
573  if (sqlite3_bind_text(PeerGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
574  goto cleanup;
575 
576  int result = sqlite3_step(PeerGetStmt);
577  if (result != SQLITE_ROW)
578  {
579  if (result == SQLITE_DONE)
580  rc = 0;
581  goto cleanup;
582  }
583 
584  *peer = mutt_autocrypt_db_peer_new();
585  (*peer)->email_addr = strdup_column_text(PeerGetStmt, 0);
586  (*peer)->last_seen = sqlite3_column_int64(PeerGetStmt, 1);
587  (*peer)->autocrypt_timestamp = sqlite3_column_int64(PeerGetStmt, 2);
588  (*peer)->keyid = strdup_column_text(PeerGetStmt, 3);
589  (*peer)->keydata = strdup_column_text(PeerGetStmt, 4);
590  (*peer)->prefer_encrypt = sqlite3_column_int(PeerGetStmt, 5);
591  (*peer)->gossip_timestamp = sqlite3_column_int64(PeerGetStmt, 6);
592  (*peer)->gossip_keyid = strdup_column_text(PeerGetStmt, 7);
593  (*peer)->gossip_keydata = strdup_column_text(PeerGetStmt, 8);
594 
595  rc = 1;
596 
597 cleanup:
598  mutt_addr_free(&norm_addr);
599  sqlite3_reset(PeerGetStmt);
600  return rc;
601 }
sqlite3 * AutocryptDB
Definition: db.c:50
struct AutocryptPeer * mutt_autocrypt_db_peer_new(void)
Create a new AutocryptPeer.
Definition: db.c:514
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:197
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:220
+ 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 610 of file db.c.

611 {
612  int rc = -1;
613  struct Address *norm_addr = NULL;
614 
615  norm_addr = copy_normalize_addr(addr);
616 
617  if (!PeerInsertStmt)
618  {
619  if (sqlite3_prepare_v3(AutocryptDB,
620  "INSERT INTO peer "
621  "(email_addr, "
622  "last_seen, "
623  "autocrypt_timestamp, "
624  "keyid, "
625  "keydata, "
626  "prefer_encrypt, "
627  "gossip_timestamp, "
628  "gossip_keyid, "
629  "gossip_keydata) "
630  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);",
631  -1, SQLITE_PREPARE_PERSISTENT, &PeerInsertStmt, NULL) != SQLITE_OK)
632  {
633  goto cleanup;
634  }
635  }
636 
637  if (sqlite3_bind_text(PeerInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
638  goto cleanup;
639  if (sqlite3_bind_int64(PeerInsertStmt, 2, peer->last_seen) != SQLITE_OK)
640  goto cleanup;
641  if (sqlite3_bind_int64(PeerInsertStmt, 3, peer->autocrypt_timestamp) != SQLITE_OK)
642  goto cleanup;
643  if (sqlite3_bind_text(PeerInsertStmt, 4, peer->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
644  goto cleanup;
645  if (sqlite3_bind_text(PeerInsertStmt, 5, peer->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
646  goto cleanup;
647  if (sqlite3_bind_int(PeerInsertStmt, 6, peer->prefer_encrypt) != SQLITE_OK)
648  goto cleanup;
649  if (sqlite3_bind_int64(PeerInsertStmt, 7, peer->gossip_timestamp) != SQLITE_OK)
650  goto cleanup;
651  if (sqlite3_bind_text(PeerInsertStmt, 8, peer->gossip_keyid, -1, SQLITE_STATIC) != SQLITE_OK)
652  goto cleanup;
653  if (sqlite3_bind_text(PeerInsertStmt, 9, peer->gossip_keydata, -1, SQLITE_STATIC) != SQLITE_OK)
654  goto cleanup;
655 
656  if (sqlite3_step(PeerInsertStmt) != SQLITE_DONE)
657  goto cleanup;
658 
659  rc = 0;
660 
661 cleanup:
662  mutt_addr_free(&norm_addr);
663  sqlite3_reset(PeerInsertStmt);
664  return rc;
665 }
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:197
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 673 of file db.c.

674 {
675  int rc = -1;
676 
677  if (!PeerUpdateStmt)
678  {
679  if (sqlite3_prepare_v3(AutocryptDB,
680  "UPDATE peer SET "
681  "last_seen = ?, "
682  "autocrypt_timestamp = ?, "
683  "keyid = ?, "
684  "keydata = ?, "
685  "prefer_encrypt = ?, "
686  "gossip_timestamp = ?, "
687  "gossip_keyid = ?, "
688  "gossip_keydata = ? "
689  "WHERE email_addr = ?;",
690  -1, SQLITE_PREPARE_PERSISTENT, &PeerUpdateStmt, NULL) != SQLITE_OK)
691  {
692  goto cleanup;
693  }
694  }
695 
696  if (sqlite3_bind_int64(PeerUpdateStmt, 1, peer->last_seen) != SQLITE_OK)
697  goto cleanup;
698  if (sqlite3_bind_int64(PeerUpdateStmt, 2, peer->autocrypt_timestamp) != SQLITE_OK)
699  goto cleanup;
700  if (sqlite3_bind_text(PeerUpdateStmt, 3, peer->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
701  goto cleanup;
702  if (sqlite3_bind_text(PeerUpdateStmt, 4, peer->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
703  goto cleanup;
704  if (sqlite3_bind_int(PeerUpdateStmt, 5, peer->prefer_encrypt) != SQLITE_OK)
705  goto cleanup;
706  if (sqlite3_bind_int64(PeerUpdateStmt, 6, peer->gossip_timestamp) != SQLITE_OK)
707  goto cleanup;
708  if (sqlite3_bind_text(PeerUpdateStmt, 7, peer->gossip_keyid, -1, SQLITE_STATIC) != SQLITE_OK)
709  goto cleanup;
710  if (sqlite3_bind_text(PeerUpdateStmt, 8, peer->gossip_keydata, -1, SQLITE_STATIC) != SQLITE_OK)
711  goto cleanup;
712  if (sqlite3_bind_text(PeerUpdateStmt, 9, peer->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
713  goto cleanup;
714 
715  if (sqlite3_step(PeerUpdateStmt) != SQLITE_DONE)
716  goto cleanup;
717 
718  rc = 0;
719 
720 cleanup:
721  sqlite3_reset(PeerUpdateStmt);
722  return rc;
723 }
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 729 of file db.c.

730 {
731  return mutt_mem_calloc(1, sizeof(struct AutocryptPeerHistory));
732 }
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 738 of file db.c.

739 {
740  if (!ptr || !*ptr)
741  return;
742 
743  struct AutocryptPeerHistory *ph = *ptr;
744  FREE(&ph->peer_email_addr);
745  FREE(&ph->email_msgid);
746  FREE(&ph->keydata);
747  FREE(ptr);
748 }
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 757 of file db.c.

759 {
760  int rc = -1;
761 
762  struct Address *norm_addr = copy_normalize_addr(addr);
763 
765  {
766  if (sqlite3_prepare_v3(AutocryptDB,
767  "INSERT INTO peer_history "
768  "(peer_email_addr, "
769  "email_msgid, "
770  "timestamp, "
771  "keydata) "
772  "VALUES (?, ?, ?, ?);",
773  -1, SQLITE_PREPARE_PERSISTENT,
774  &PeerHistoryInsertStmt, NULL) != SQLITE_OK)
775  {
776  goto cleanup;
777  }
778  }
779 
780  if (sqlite3_bind_text(PeerHistoryInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
781  goto cleanup;
782  if (sqlite3_bind_text(PeerHistoryInsertStmt, 2, peerhist->email_msgid, -1,
783  SQLITE_STATIC) != SQLITE_OK)
784  goto cleanup;
785  if (sqlite3_bind_int64(PeerHistoryInsertStmt, 3, peerhist->timestamp) != SQLITE_OK)
786  goto cleanup;
787  if (sqlite3_bind_text(PeerHistoryInsertStmt, 4, peerhist->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
788  goto cleanup;
789 
790  if (sqlite3_step(PeerHistoryInsertStmt) != SQLITE_DONE)
791  goto cleanup;
792 
793  rc = 0;
794 
795 cleanup:
796  mutt_addr_free(&norm_addr);
797  sqlite3_reset(PeerHistoryInsertStmt);
798  return rc;
799 }
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:197
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 805 of file db.c.

806 {
807  return mutt_mem_calloc(1, sizeof(struct AutocryptGossipHistory));
808 }
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 814 of file db.c.

815 {
816  if (!ptr || !*ptr)
817  return;
818 
819  struct AutocryptGossipHistory *gh = *ptr;
820  FREE(&gh->peer_email_addr);
821  FREE(&gh->sender_email_addr);
822  FREE(&gh->email_msgid);
823  FREE(&gh->gossip_keydata);
824  FREE(ptr);
825 }
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 834 of file db.c.

836 {
837  int rc = -1;
838 
839  struct Address *norm_addr = copy_normalize_addr(addr);
840 
842  {
843  if (sqlite3_prepare_v3(AutocryptDB,
844  "INSERT INTO gossip_history "
845  "(peer_email_addr, "
846  "sender_email_addr, "
847  "email_msgid, "
848  "timestamp, "
849  "gossip_keydata) "
850  "VALUES (?, ?, ?, ?, ?);",
851  -1, SQLITE_PREPARE_PERSISTENT,
852  &GossipHistoryInsertStmt, NULL) != SQLITE_OK)
853  {
854  goto cleanup;
855  }
856  }
857 
858  if (sqlite3_bind_text(GossipHistoryInsertStmt, 1, norm_addr->mailbox, -1,
859  SQLITE_STATIC) != SQLITE_OK)
860  {
861  goto cleanup;
862  }
863  if (sqlite3_bind_text(GossipHistoryInsertStmt, 2, gossip_hist->sender_email_addr,
864  -1, SQLITE_STATIC) != SQLITE_OK)
865  {
866  if (sqlite3_bind_text(GossipHistoryInsertStmt, 3, gossip_hist->email_msgid,
867  -1, SQLITE_STATIC) != SQLITE_OK)
868  {
869  goto cleanup;
870  }
871  }
872  if (sqlite3_bind_int64(GossipHistoryInsertStmt, 4, gossip_hist->timestamp) != SQLITE_OK)
873  goto cleanup;
874  if (sqlite3_bind_text(GossipHistoryInsertStmt, 5, gossip_hist->gossip_keydata,
875  -1, SQLITE_STATIC) != SQLITE_OK)
876  {
877  goto cleanup;
878  }
879 
880  if (sqlite3_step(GossipHistoryInsertStmt) != SQLITE_DONE)
881  goto cleanup;
882 
883  rc = 0;
884 
885 cleanup:
886  mutt_addr_free(&norm_addr);
887  sqlite3_reset(GossipHistoryInsertStmt);
888  return rc;
889 }
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:197
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.