NeoMutt  2021-02-05-666-ge300cd
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 "config/lib.h"
#include "core/lib.h"
#include "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 (struct Mailbox *m, 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 60 of file db.c.

61 {
62  if (sqlite3_open_v2(db_path, &AutocryptDB,
63  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK)
64  {
65  /* L10N: s is the path to the database.
66  For some reason sqlite3 failed to open that database file. */
67  mutt_error(_("Unable to open autocrypt database %s"), db_path);
68  return -1;
69  }
71 }
sqlite3 * AutocryptDB
Definition: db.c:52
#define mutt_error(...)
Definition: logging.h:88
#define _(a)
Definition: message.h:28
int mutt_autocrypt_schema_init(void)
Set up an Autocrypt database.
Definition: schema.c:38
+ 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 ( struct Mailbox m,
bool  can_create 
)

Initialise the Autocrypt SQLite database.

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

Definition at line 80 of file db.c.

81 {
82  int rc = -1;
83 
84  if (AutocryptDB)
85  return 0;
86 
87  const bool c_autocrypt = cs_subset_bool(NeoMutt->sub, "autocrypt");
88  const char *const c_autocrypt_dir =
89  cs_subset_path(NeoMutt->sub, "autocrypt_dir");
90  if (!c_autocrypt || !c_autocrypt_dir)
91  return -1;
92 
93  struct Buffer *db_path = mutt_buffer_pool_get();
94  mutt_buffer_concat_path(db_path, c_autocrypt_dir, "autocrypt.db");
95 
96  struct stat sb;
97  if (stat(mutt_buffer_string(db_path), &sb) == 0)
98  {
99  if (sqlite3_open_v2(mutt_buffer_string(db_path), &AutocryptDB,
100  SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK)
101  {
102  /* L10N: Error message if autocrypt couldn't open the SQLite database
103  for some reason. The %s is the full path of the database file. */
104  mutt_error(_("Unable to open autocrypt database %s"), mutt_buffer_string(db_path));
105  goto cleanup;
106  }
107 
109  goto cleanup;
110  }
111  else
112  {
113  if (!can_create)
114  goto cleanup;
116  goto cleanup;
117  /* Don't abort the whole init process because account creation failed */
120  }
121 
122  rc = 0;
123 
124 cleanup:
125  mutt_buffer_pool_release(&db_path);
126  return rc;
127 }
sqlite3 * AutocryptDB
Definition: db.c:52
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
#define mutt_error(...)
Definition: logging.h:88
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
Container for Accounts, Notifications.
Definition: neomutt.h:36
int mutt_autocrypt_account_init(bool prompt)
Create a new Autocrypt account.
Definition: autocrypt.c:155
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(struct Mailbox *m)
Scan mailboxes for Autocrypt headers.
Definition: autocrypt.c:933
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:194
static int autocrypt_db_create(const char *db_path)
Create an Autocrypt SQLite database.
Definition: db.c:60
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
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
int mutt_autocrypt_schema_update(void)
Update the version number of the Autocrypt database schema.
Definition: schema.c:104
+ 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 132 of file db.c.

133 {
134  if (!AutocryptDB)
135  return;
136 
137  sqlite3_finalize(AccountGetStmt);
138  AccountGetStmt = NULL;
139  sqlite3_finalize(AccountInsertStmt);
140  AccountInsertStmt = NULL;
141  sqlite3_finalize(AccountUpdateStmt);
142  AccountUpdateStmt = NULL;
143  sqlite3_finalize(AccountDeleteStmt);
144  AccountDeleteStmt = NULL;
145 
146  sqlite3_finalize(PeerGetStmt);
147  PeerGetStmt = NULL;
148  sqlite3_finalize(PeerInsertStmt);
149  PeerInsertStmt = NULL;
150  sqlite3_finalize(PeerUpdateStmt);
151  PeerUpdateStmt = NULL;
152 
153  sqlite3_finalize(PeerHistoryInsertStmt);
154  PeerHistoryInsertStmt = NULL;
155 
156  sqlite3_finalize(GossipHistoryInsertStmt);
158 
159  sqlite3_close_v2(AutocryptDB);
160  AutocryptDB = NULL;
161 }
sqlite3 * AutocryptDB
Definition: db.c:52
static sqlite3_stmt * AccountUpdateStmt
Definition: db.c:44
static sqlite3_stmt * AccountInsertStmt
Definition: db.c:43
static sqlite3_stmt * PeerGetStmt
Definition: db.c:46
static sqlite3_stmt * GossipHistoryInsertStmt
Definition: db.c:50
static sqlite3_stmt * PeerUpdateStmt
Definition: db.c:48
static sqlite3_stmt * AccountDeleteStmt
Definition: db.c:45
static sqlite3_stmt * AccountGetStmt
Definition: db.c:42
static sqlite3_stmt * PeerInsertStmt
Definition: db.c:47
static sqlite3_stmt * PeerHistoryInsertStmt
Definition: db.c:49
+ 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 167 of file db.c.

168 {
172 }
char * mailbox
Mailbox and host address.
Definition: address.h:38
bool mutt_addr_to_local(struct Address *a)
Convert an Address from Punycode.
Definition: address.c:1351
bool mutt_addr_to_intl(struct Address *a)
Convert an Address to Punycode.
Definition: address.c:1276
char * mutt_str_lower(char *str)
Convert all characters in the string to lowercase.
Definition: string.c:504
+ 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 178 of file db.c.

179 {
181 
182  struct Address *np = NULL;
183  TAILQ_FOREACH(np, al, entries)
184  {
185  mutt_str_lower(np->mailbox);
186  }
187 
188  mutt_addrlist_to_intl(al, NULL);
189 }
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
Definition: address.c:1388
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1305
char * mutt_str_lower(char *str)
Convert all characters in the string to lowercase.
Definition: string.c:504
+ 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 204 of file db.c.

205 {
206  /* NOTE: the db functions expect a single address, so in
207  * this function we copy only the address passed in.
208  *
209  * The normalize_addrlist above is extended to work on a list
210  * because of requirements in autocrypt.c */
211 
212  struct Address *norm_addr = mutt_addr_new();
213  norm_addr->mailbox = mutt_str_dup(addr->mailbox);
214  norm_addr->is_intl = addr->is_intl;
215  norm_addr->intl_checked = addr->intl_checked;
216 
218  return norm_addr;
219 }
void mutt_autocrypt_db_normalize_addr(struct Address *a)
Normalise an Email Address.
Definition: db.c:167
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:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
bool is_intl
International Domain Name.
Definition: address.h:40
bool intl_checked
Checked for IDN?
Definition: address.h:41
+ 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 227 of file db.c.

228 {
229  const char *val = (const char *) sqlite3_column_text(stmt, index);
230  return mutt_str_dup(val);
231 }
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 237 of file db.c.

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

247 {
248  if (!ptr || !*ptr)
249  return;
250 
251  struct AutocryptAccount *ac = *ptr;
252  FREE(&ac->email_addr);
253  FREE(&ac->keyid);
254  FREE(&ac->keydata);
255  FREE(ptr);
256 }
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 265 of file db.c.

266 {
267  int rc = -1;
268 
269  struct Address *norm_addr = copy_normalize_addr(addr);
270  *account = NULL;
271 
272  if (!AccountGetStmt)
273  {
274  if (sqlite3_prepare_v3(AutocryptDB,
275  "SELECT "
276  "email_addr, "
277  "keyid, "
278  "keydata, "
279  "prefer_encrypt, "
280  "enabled "
281  "FROM account "
282  "WHERE email_addr = ?",
283  -1, SQLITE_PREPARE_PERSISTENT, &AccountGetStmt, NULL) != SQLITE_OK)
284  {
285  goto cleanup;
286  }
287  }
288 
289  if (sqlite3_bind_text(AccountGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
290  goto cleanup;
291 
292  int result = sqlite3_step(AccountGetStmt);
293  if (result != SQLITE_ROW)
294  {
295  if (result == SQLITE_DONE)
296  rc = 0;
297  goto cleanup;
298  }
299 
300  *account = mutt_autocrypt_db_account_new();
301  (*account)->email_addr = strdup_column_text(AccountGetStmt, 0);
302  (*account)->keyid = strdup_column_text(AccountGetStmt, 1);
303  (*account)->keydata = strdup_column_text(AccountGetStmt, 2);
304  (*account)->prefer_encrypt = sqlite3_column_int(AccountGetStmt, 3);
305  (*account)->enabled = sqlite3_column_int(AccountGetStmt, 4);
306 
307  rc = 1;
308 
309 cleanup:
310  mutt_addr_free(&norm_addr);
311  sqlite3_reset(AccountGetStmt);
312  return rc;
313 }
sqlite3 * AutocryptDB
Definition: db.c:52
struct AutocryptAccount * mutt_autocrypt_db_account_new(void)
Create a new AutocryptAccount.
Definition: db.c:237
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
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:204
static sqlite3_stmt * AccountGetStmt
Definition: db.c:42
static char * strdup_column_text(sqlite3_stmt *stmt, int index)
Copy a string from the database.
Definition: db.c:227
+ 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 324 of file db.c.

326 {
327  int rc = -1;
328 
329  struct Address *norm_addr = copy_normalize_addr(addr);
330 
331  if (!AccountInsertStmt)
332  {
333  if (sqlite3_prepare_v3(AutocryptDB,
334  "INSERT INTO account "
335  "(email_addr, "
336  "keyid, "
337  "keydata, "
338  "prefer_encrypt, "
339  "enabled) "
340  "VALUES (?, ?, ?, ?, ?);",
341  -1, SQLITE_PREPARE_PERSISTENT, &AccountInsertStmt, NULL) != SQLITE_OK)
342  {
343  goto cleanup;
344  }
345  }
346 
347  if (sqlite3_bind_text(AccountInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
348  goto cleanup;
349  if (sqlite3_bind_text(AccountInsertStmt, 2, keyid, -1, SQLITE_STATIC) != SQLITE_OK)
350  goto cleanup;
351  if (sqlite3_bind_text(AccountInsertStmt, 3, keydata, -1, SQLITE_STATIC) != SQLITE_OK)
352  goto cleanup;
353  if (sqlite3_bind_int(AccountInsertStmt, 4, prefer_encrypt) != SQLITE_OK)
354  goto cleanup;
355  if (sqlite3_bind_int(AccountInsertStmt, 5, 1) != SQLITE_OK)
356  goto cleanup;
357 
358  if (sqlite3_step(AccountInsertStmt) != SQLITE_DONE)
359  goto cleanup;
360 
361  rc = 0;
362 
363 cleanup:
364  mutt_addr_free(&norm_addr);
365  sqlite3_reset(AccountInsertStmt);
366  return rc;
367 }
sqlite3 * AutocryptDB
Definition: db.c:52
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:440
static sqlite3_stmt * AccountInsertStmt
Definition: db.c:43
static struct Address * copy_normalize_addr(struct Address *addr)
Copy a normalised Email Address.
Definition: db.c:204
+ 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 375 of file db.c.

376 {
377  int rc = -1;
378 
379  if (!AccountUpdateStmt)
380  {
381  if (sqlite3_prepare_v3(AutocryptDB,
382  "UPDATE account SET "
383  "keyid = ?, "
384  "keydata = ?, "
385  "prefer_encrypt = ?, "
386  "enabled = ? "
387  "WHERE email_addr = ?;",
388  -1, SQLITE_PREPARE_PERSISTENT, &AccountUpdateStmt, NULL) != SQLITE_OK)
389  {
390  goto cleanup;
391  }
392  }
393 
394  if (sqlite3_bind_text(AccountUpdateStmt, 1, acct->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
395  goto cleanup;
396  if (sqlite3_bind_text(AccountUpdateStmt, 2, acct->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
397  goto cleanup;
398  if (sqlite3_bind_int(AccountUpdateStmt, 3, acct->prefer_encrypt) != SQLITE_OK)
399  goto cleanup;
400  if (sqlite3_bind_int(AccountUpdateStmt, 4, acct->enabled) != SQLITE_OK)
401  goto cleanup;
402  if (sqlite3_bind_text(AccountUpdateStmt, 5, acct->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
403  goto cleanup;
404 
405  if (sqlite3_step(AccountUpdateStmt) != SQLITE_DONE)
406  goto cleanup;
407 
408  rc = 0;
409 
410 cleanup:
411  sqlite3_reset(AccountUpdateStmt);
412  return rc;
413 }
sqlite3 * AutocryptDB
Definition: db.c:52
char * email_addr
Definition: lib.h:105
char * keyid
Definition: lib.h:106
static sqlite3_stmt * AccountUpdateStmt
Definition: db.c:44
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 421 of file db.c.

422 {
423  int rc = -1;
424 
425  if (!AccountDeleteStmt)
426  {
427  if (sqlite3_prepare_v3(AutocryptDB,
428  "DELETE from account "
429  "WHERE email_addr = ?;",
430  -1, SQLITE_PREPARE_PERSISTENT, &AccountDeleteStmt, NULL) != SQLITE_OK)
431  {
432  goto cleanup;
433  }
434  }
435 
436  if (sqlite3_bind_text(AccountDeleteStmt, 1, acct->email_addr, -1, SQLITE_STATIC) != SQLITE_OK)
437  goto cleanup;
438 
439  if (sqlite3_step(AccountDeleteStmt) != SQLITE_DONE)
440  goto cleanup;
441 
442  rc = 0;
443 
444 cleanup:
445  sqlite3_reset(AccountDeleteStmt);
446  return rc;
447 }
sqlite3 * AutocryptDB
Definition: db.c:52
char * email_addr
Definition: lib.h:105
static sqlite3_stmt * AccountDeleteStmt
Definition: db.c:45
+ 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 456 of file db.c.

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

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

531 {
532  if (!ptr || !*ptr)
533  return;
534 
535  struct AutocryptPeer *peer = *ptr;
536  FREE(&peer->email_addr);
537  FREE(&peer->keyid);
538  FREE(&peer->keydata);
539  FREE(&peer->gossip_keyid);
540  FREE(&peer->gossip_keydata);
541  FREE(ptr);
542 }
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 552 of file db.c.

553 {
554  int rc = -1;
555 
556  struct Address *norm_addr = copy_normalize_addr(addr);
557  *peer = NULL;
558 
559  if (!PeerGetStmt)
560  {
561  if (sqlite3_prepare_v3(AutocryptDB,
562  "SELECT "
563  "email_addr, "
564  "last_seen, "
565  "autocrypt_timestamp, "
566  "keyid, "
567  "keydata, "
568  "prefer_encrypt, "
569  "gossip_timestamp, "
570  "gossip_keyid, "
571  "gossip_keydata "
572  "FROM peer "
573  "WHERE email_addr = ?",
574  -1, SQLITE_PREPARE_PERSISTENT, &PeerGetStmt, NULL) != SQLITE_OK)
575  {
576  goto cleanup;
577  }
578  }
579 
580  if (sqlite3_bind_text(PeerGetStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
581  goto cleanup;
582 
583  int result = sqlite3_step(PeerGetStmt);
584  if (result != SQLITE_ROW)
585  {
586  if (result == SQLITE_DONE)
587  rc = 0;
588  goto cleanup;
589  }
590 
591  *peer = mutt_autocrypt_db_peer_new();
592  (*peer)->email_addr = strdup_column_text(PeerGetStmt, 0);
593  (*peer)->last_seen = sqlite3_column_int64(PeerGetStmt, 1);
594  (*peer)->autocrypt_timestamp = sqlite3_column_int64(PeerGetStmt, 2);
595  (*peer)->keyid = strdup_column_text(PeerGetStmt, 3);
596  (*peer)->keydata = strdup_column_text(PeerGetStmt, 4);
597  (*peer)->prefer_encrypt = sqlite3_column_int(PeerGetStmt, 5);
598  (*peer)->gossip_timestamp = sqlite3_column_int64(PeerGetStmt, 6);
599  (*peer)->gossip_keyid = strdup_column_text(PeerGetStmt, 7);
600  (*peer)->gossip_keydata = strdup_column_text(PeerGetStmt, 8);
601 
602  rc = 1;
603 
604 cleanup:
605  mutt_addr_free(&norm_addr);
606  sqlite3_reset(PeerGetStmt);
607  return rc;
608 }
sqlite3 * AutocryptDB
Definition: db.c:52
struct AutocryptPeer * mutt_autocrypt_db_peer_new(void)
Create a new AutocryptPeer.
Definition: db.c:521
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
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:204
static sqlite3_stmt * PeerGetStmt
Definition: db.c:46
static char * strdup_column_text(sqlite3_stmt *stmt, int index)
Copy a string from the database.
Definition: db.c:227
+ 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 617 of file db.c.

618 {
619  int rc = -1;
620  struct Address *norm_addr = NULL;
621 
622  norm_addr = copy_normalize_addr(addr);
623 
624  if (!PeerInsertStmt)
625  {
626  if (sqlite3_prepare_v3(AutocryptDB,
627  "INSERT INTO peer "
628  "(email_addr, "
629  "last_seen, "
630  "autocrypt_timestamp, "
631  "keyid, "
632  "keydata, "
633  "prefer_encrypt, "
634  "gossip_timestamp, "
635  "gossip_keyid, "
636  "gossip_keydata) "
637  "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);",
638  -1, SQLITE_PREPARE_PERSISTENT, &PeerInsertStmt, NULL) != SQLITE_OK)
639  {
640  goto cleanup;
641  }
642  }
643 
644  if (sqlite3_bind_text(PeerInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
645  goto cleanup;
646  if (sqlite3_bind_int64(PeerInsertStmt, 2, peer->last_seen) != SQLITE_OK)
647  goto cleanup;
648  if (sqlite3_bind_int64(PeerInsertStmt, 3, peer->autocrypt_timestamp) != SQLITE_OK)
649  goto cleanup;
650  if (sqlite3_bind_text(PeerInsertStmt, 4, peer->keyid, -1, SQLITE_STATIC) != SQLITE_OK)
651  goto cleanup;
652  if (sqlite3_bind_text(PeerInsertStmt, 5, peer->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
653  goto cleanup;
654  if (sqlite3_bind_int(PeerInsertStmt, 6, peer->prefer_encrypt) != SQLITE_OK)
655  goto cleanup;
656  if (sqlite3_bind_int64(PeerInsertStmt, 7, peer->gossip_timestamp) != SQLITE_OK)
657  goto cleanup;
658  if (sqlite3_bind_text(PeerInsertStmt, 8, peer->gossip_keyid, -1, SQLITE_STATIC) != SQLITE_OK)
659  goto cleanup;
660  if (sqlite3_bind_text(PeerInsertStmt, 9, peer->gossip_keydata, -1, SQLITE_STATIC) != SQLITE_OK)
661  goto cleanup;
662 
663  if (sqlite3_step(PeerInsertStmt) != SQLITE_DONE)
664  goto cleanup;
665 
666  rc = 0;
667 
668 cleanup:
669  mutt_addr_free(&norm_addr);
670  sqlite3_reset(PeerInsertStmt);
671  return rc;
672 }
sqlite3 * AutocryptDB
Definition: db.c:52
char * keydata
Definition: lib.h:121
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
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:204
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:47
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 680 of file db.c.

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

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

746 {
747  if (!ptr || !*ptr)
748  return;
749 
750  struct AutocryptPeerHistory *ph = *ptr;
751  FREE(&ph->peer_email_addr);
752  FREE(&ph->email_msgid);
753  FREE(&ph->keydata);
754  FREE(ptr);
755 }
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 764 of file db.c.

766 {
767  int rc = -1;
768 
769  struct Address *norm_addr = copy_normalize_addr(addr);
770 
772  {
773  if (sqlite3_prepare_v3(AutocryptDB,
774  "INSERT INTO peer_history "
775  "(peer_email_addr, "
776  "email_msgid, "
777  "timestamp, "
778  "keydata) "
779  "VALUES (?, ?, ?, ?);",
780  -1, SQLITE_PREPARE_PERSISTENT,
781  &PeerHistoryInsertStmt, NULL) != SQLITE_OK)
782  {
783  goto cleanup;
784  }
785  }
786 
787  if (sqlite3_bind_text(PeerHistoryInsertStmt, 1, norm_addr->mailbox, -1, SQLITE_STATIC) != SQLITE_OK)
788  goto cleanup;
789  if (sqlite3_bind_text(PeerHistoryInsertStmt, 2, peerhist->email_msgid, -1,
790  SQLITE_STATIC) != SQLITE_OK)
791  {
792  goto cleanup;
793  }
794  if (sqlite3_bind_int64(PeerHistoryInsertStmt, 3, peerhist->timestamp) != SQLITE_OK)
795  goto cleanup;
796  if (sqlite3_bind_text(PeerHistoryInsertStmt, 4, peerhist->keydata, -1, SQLITE_STATIC) != SQLITE_OK)
797  goto cleanup;
798 
799  if (sqlite3_step(PeerHistoryInsertStmt) != SQLITE_DONE)
800  goto cleanup;
801 
802  rc = 0;
803 
804 cleanup:
805  mutt_addr_free(&norm_addr);
806  sqlite3_reset(PeerHistoryInsertStmt);
807  return rc;
808 }
sqlite3 * AutocryptDB
Definition: db.c:52
char * email_msgid
Definition: lib.h:134
sqlite3_int64 timestamp
Definition: lib.h:135
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
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:204
char * keydata
Definition: lib.h:136
static sqlite3_stmt * PeerHistoryInsertStmt
Definition: db.c:49
+ 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 814 of file db.c.

815 {
816  return mutt_mem_calloc(1, sizeof(struct AutocryptGossipHistory));
817 }
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 823 of file db.c.

824 {
825  if (!ptr || !*ptr)
826  return;
827 
828  struct AutocryptGossipHistory *gh = *ptr;
829  FREE(&gh->peer_email_addr);
830  FREE(&gh->sender_email_addr);
831  FREE(&gh->email_msgid);
832  FREE(&gh->gossip_keydata);
833  FREE(ptr);
834 }
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 843 of file db.c.

845 {
846  int rc = -1;
847 
848  struct Address *norm_addr = copy_normalize_addr(addr);
849 
851  {
852  if (sqlite3_prepare_v3(AutocryptDB,
853  "INSERT INTO gossip_history "
854  "(peer_email_addr, "
855  "sender_email_addr, "
856  "email_msgid, "
857  "timestamp, "
858  "gossip_keydata) "
859  "VALUES (?, ?, ?, ?, ?);",
860  -1, SQLITE_PREPARE_PERSISTENT,
861  &GossipHistoryInsertStmt, NULL) != SQLITE_OK)
862  {
863  goto cleanup;
864  }
865  }
866 
867  if (sqlite3_bind_text(GossipHistoryInsertStmt, 1, norm_addr->mailbox, -1,
868  SQLITE_STATIC) != SQLITE_OK)
869  {
870  goto cleanup;
871  }
872  if (sqlite3_bind_text(GossipHistoryInsertStmt, 2, gossip_hist->sender_email_addr,
873  -1, SQLITE_STATIC) != SQLITE_OK)
874  {
875  if (sqlite3_bind_text(GossipHistoryInsertStmt, 3, gossip_hist->email_msgid,
876  -1, SQLITE_STATIC) != SQLITE_OK)
877  {
878  goto cleanup;
879  }
880  }
881  if (sqlite3_bind_int64(GossipHistoryInsertStmt, 4, gossip_hist->timestamp) != SQLITE_OK)
882  goto cleanup;
883  if (sqlite3_bind_text(GossipHistoryInsertStmt, 5, gossip_hist->gossip_keydata,
884  -1, SQLITE_STATIC) != SQLITE_OK)
885  {
886  goto cleanup;
887  }
888 
889  if (sqlite3_step(GossipHistoryInsertStmt) != SQLITE_DONE)
890  goto cleanup;
891 
892  rc = 0;
893 
894 cleanup:
895  mutt_addr_free(&norm_addr);
896  sqlite3_reset(GossipHistoryInsertStmt);
897  return rc;
898 }
sqlite3 * AutocryptDB
Definition: db.c:52
An email address.
Definition: address.h:35
char * mailbox
Mailbox and host address.
Definition: address.h:38
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:204
static sqlite3_stmt * GossipHistoryInsertStmt
Definition: db.c:50
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 42 of file db.c.

◆ AccountInsertStmt

sqlite3_stmt* AccountInsertStmt
static

Definition at line 43 of file db.c.

◆ AccountUpdateStmt

sqlite3_stmt* AccountUpdateStmt
static

Definition at line 44 of file db.c.

◆ AccountDeleteStmt

sqlite3_stmt* AccountDeleteStmt
static

Definition at line 45 of file db.c.

◆ PeerGetStmt

sqlite3_stmt* PeerGetStmt
static

Definition at line 46 of file db.c.

◆ PeerInsertStmt

sqlite3_stmt* PeerInsertStmt
static

Definition at line 47 of file db.c.

◆ PeerUpdateStmt

sqlite3_stmt* PeerUpdateStmt
static

Definition at line 48 of file db.c.

◆ PeerHistoryInsertStmt

sqlite3_stmt* PeerHistoryInsertStmt
static

Definition at line 49 of file db.c.

◆ GossipHistoryInsertStmt

sqlite3_stmt* GossipHistoryInsertStmt
static

Definition at line 50 of file db.c.

◆ AutocryptDB

sqlite3* AutocryptDB = NULL

Definition at line 52 of file db.c.