Autocrypt database handling. More...
#include "config.h"#include <sqlite3.h>#include <stdbool.h>#include <stddef.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. | |
| int | mutt_autocrypt_db_init (bool can_create) |
| Initialise the Autocrypt SQLite database. | |
| void | mutt_autocrypt_db_close (void) |
| Close the Autocrypt SQLite database connection. | |
| void | mutt_autocrypt_db_normalize_addr (struct Address *a) |
| Normalise an Email Address. | |
| void | mutt_autocrypt_db_normalize_addrlist (struct AddressList *al) |
| Normalise a list of Email Addresses. | |
| static struct Address * | copy_normalize_addr (struct Address *addr) |
| Copy a normalised Email Address. | |
| static char * | strdup_column_text (sqlite3_stmt *stmt, int index) |
| Copy a string from the database. | |
| struct AutocryptAccount * | mutt_autocrypt_db_account_new (void) |
| Create a new AutocryptAccount. | |
| void | mutt_autocrypt_db_account_free (struct AutocryptAccount **ptr) |
| Free an AutocryptAccount. | |
| int | mutt_autocrypt_db_account_get (struct Address *addr, struct AutocryptAccount **account) |
| Get Autocrypt Account data from the database. | |
| 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. | |
| int | mutt_autocrypt_db_account_update (struct AutocryptAccount *acct) |
| Update Account info in the Autocrypt database. | |
| int | mutt_autocrypt_db_account_delete (struct AutocryptAccount *acct) |
| Delete an Account from the Autocrypt database. | |
| int | mutt_autocrypt_db_account_get_all (struct AutocryptAccountArray *aaa) |
| Get all accounts from an Autocrypt database. | |
| struct AutocryptPeer * | mutt_autocrypt_db_peer_new (void) |
| Create a new AutocryptPeer. | |
| void | mutt_autocrypt_db_peer_free (struct AutocryptPeer **ptr) |
| Free an AutocryptPeer. | |
| int | mutt_autocrypt_db_peer_get (struct Address *addr, struct AutocryptPeer **peer) |
| Get peer info from the Autocrypt database. | |
| int | mutt_autocrypt_db_peer_insert (struct Address *addr, struct AutocryptPeer *peer) |
| Insert a peer into the Autocrypt database. | |
| int | mutt_autocrypt_db_peer_update (struct AutocryptPeer *peer) |
| Update the peer info in an Autocrypt database. | |
| struct AutocryptPeerHistory * | mutt_autocrypt_db_peer_history_new (void) |
| Create a new AutocryptPeerHistory. | |
| void | mutt_autocrypt_db_peer_history_free (struct AutocryptPeerHistory **ptr) |
| Free an AutocryptPeerHistory. | |
| int | mutt_autocrypt_db_peer_history_insert (struct Address *addr, struct AutocryptPeerHistory *peerhist) |
| Insert peer history into the Autocrypt database. | |
| struct AutocryptGossipHistory * | mutt_autocrypt_db_gossip_history_new (void) |
| Create a new AutocryptGossipHistory. | |
| void | mutt_autocrypt_db_gossip_history_free (struct AutocryptGossipHistory **ptr) |
| Free an AutocryptGossipHistory. | |
| int | mutt_autocrypt_db_gossip_history_insert (struct Address *addr, struct AutocryptGossipHistory *gossip_hist) |
| Insert a gossip history into the Autocrypt database. | |
Variables | |
| static sqlite3_stmt * | AccountGetStmt = NULL |
| Get the matching autocrypt accounts. | |
| static sqlite3_stmt * | AccountInsertStmt = NULL |
| Insert a new autocrypt account. | |
| static sqlite3_stmt * | AccountUpdateStmt = NULL |
| Update an autocrypt account. | |
| static sqlite3_stmt * | AccountDeleteStmt = NULL |
| Delete an autocrypt account. | |
| static sqlite3_stmt * | PeerGetStmt = NULL |
| Get the matching peer addresses. | |
| static sqlite3_stmt * | PeerInsertStmt = NULL |
| Insert a new peer address. | |
| static sqlite3_stmt * | PeerUpdateStmt = NULL |
| Update a peer address. | |
| static sqlite3_stmt * | PeerHistoryInsertStmt = NULL |
| Add to the peer history. | |
| static sqlite3_stmt * | GossipHistoryInsertStmt = NULL |
| Add to the gossip history. | |
| sqlite3 * | AutocryptDB = NULL |
| Handle to the open Autocrypt database. | |
Autocrypt database handling.
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.
|
static |
Create an Autocrypt SQLite database.
| db_path | Path to database file |
| 0 | Success |
| -1 | Error |
Definition at line 64 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int mutt_autocrypt_db_init | ( | bool | can_create | ) |
Initialise the Autocrypt SQLite database.
| can_create | If true, the directory may be created |
| 0 | Success |
| -1 | Error |
Definition at line 83 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_autocrypt_db_close | ( | void | ) |
Close the Autocrypt SQLite database connection.
Definition at line 133 of file db.c.
Here is the caller graph for this function:| void mutt_autocrypt_db_normalize_addr | ( | struct Address * | a | ) |
| a | Address to normalise |
Definition at line 168 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void mutt_autocrypt_db_normalize_addrlist | ( | struct AddressList * | al | ) |
Normalise a list of Email Addresses.
| al | List of Addresses to normalise |
Definition at line 179 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:Copy a normalised Email Address.
| addr | Address to normalise and copy |
| ptr | Copy 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.
Definition at line 205 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Copy a string from the database.
| stmt | SQLite database statement |
| index | Database row |
| ptr | Copy of string |
Definition at line 227 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct AutocryptAccount * mutt_autocrypt_db_account_new | ( | void | ) |
Create a new AutocryptAccount.
| ptr | New AutocryptAccount |
Definition at line 237 of file db.c.
Here is the caller graph for this function:| void mutt_autocrypt_db_account_free | ( | struct AutocryptAccount ** | ptr | ) |
Free an AutocryptAccount.
| ptr | Account to free |
Definition at line 246 of file db.c.
Here is the caller graph for this function:| int mutt_autocrypt_db_account_get | ( | struct Address * | addr, |
| struct AutocryptAccount ** | account ) |
Get Autocrypt Account data from the database.
| 0 | Success |
| -1 | Error |
Definition at line 265 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| addr | Email Address for the account |
| keyid | Autocrypt KeyID |
| keydata | Autocrypt key data |
| prefer_encrypt | Whether the account prefers encryption |
| 0 | Success |
| -1 | Error |
Definition at line 327 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int mutt_autocrypt_db_account_update | ( | struct AutocryptAccount * | acct | ) |
Update Account info in the Autocrypt database.
| acct | Autocrypt Account data |
| 0 | Success |
| -1 | Error |
Definition at line 381 of file db.c.
Here is the caller graph for this function:| int mutt_autocrypt_db_account_delete | ( | struct AutocryptAccount * | acct | ) |
Delete an Account from the Autocrypt database.
| acct | Account to delete |
| 0 | Success |
| -1 | Error |
Definition at line 427 of file db.c.
Here is the caller graph for this function:| int mutt_autocrypt_db_account_get_all | ( | struct AutocryptAccountArray * | aaa | ) |
Get all accounts from an Autocrypt database.
| aaa | Account array |
| n | Success, number of Accounts |
| -1 | Error |
Definition at line 461 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct AutocryptPeer * mutt_autocrypt_db_peer_new | ( | void | ) |
Create a new AutocryptPeer.
| ptr | New AutocryptPeer |
Definition at line 522 of file db.c.
Here is the caller graph for this function:| void mutt_autocrypt_db_peer_free | ( | struct AutocryptPeer ** | ptr | ) |
Free an AutocryptPeer.
| ptr | AutocryptPeer to free |
Definition at line 531 of file db.c.
Here is the caller graph for this function:| int mutt_autocrypt_db_peer_get | ( | struct Address * | addr, |
| struct AutocryptPeer ** | peer ) |
Get peer info from the Autocrypt database.
| 0 | Success, no matches |
| 1 | Success, a match |
| -1 | Error |
Definition at line 553 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int mutt_autocrypt_db_peer_insert | ( | struct Address * | addr, |
| struct AutocryptPeer * | peer ) |
Insert a peer into the Autocrypt database.
| addr | Email Address |
| peer | AutocryptPeer to insert |
| 0 | Success |
| -1 | Error |
Definition at line 621 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int mutt_autocrypt_db_peer_update | ( | struct AutocryptPeer * | peer | ) |
Update the peer info in an Autocrypt database.
| peer | AutocryptPeer to update |
| 0 | Success |
| -1 | Error |
Definition at line 687 of file db.c.
Here is the caller graph for this function:| struct AutocryptPeerHistory * mutt_autocrypt_db_peer_history_new | ( | void | ) |
Create a new AutocryptPeerHistory.
| ptr | New AutocryptPeerHistory |
Definition at line 743 of file db.c.
Here is the caller graph for this function:| void mutt_autocrypt_db_peer_history_free | ( | struct AutocryptPeerHistory ** | ptr | ) |
Free an AutocryptPeerHistory.
| ptr | AutocryptPeerHistory to free |
Definition at line 752 of file db.c.
Here is the caller graph for this function:| int mutt_autocrypt_db_peer_history_insert | ( | struct Address * | addr, |
| struct AutocryptPeerHistory * | peerhist ) |
Insert peer history into the Autocrypt database.
| 0 | Success |
| -1 | Error |
Definition at line 771 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:| struct AutocryptGossipHistory * mutt_autocrypt_db_gossip_history_new | ( | void | ) |
Create a new AutocryptGossipHistory.
| ptr | New AutocryptGossipHistory |
Definition at line 824 of file db.c.
Here is the caller graph for this function:| void mutt_autocrypt_db_gossip_history_free | ( | struct AutocryptGossipHistory ** | ptr | ) |
Free an AutocryptGossipHistory.
| ptr | AutocryptGossipHistory to free |
Definition at line 833 of file db.c.
Here is the caller graph for this function:| int mutt_autocrypt_db_gossip_history_insert | ( | struct Address * | addr, |
| struct AutocryptGossipHistory * | gossip_hist ) |
Insert a gossip history into the Autocrypt database.
| 0 | Success |
| -1 | Error |
Definition at line 853 of file db.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |