Browse Source

removed spinlock

add_key_notification
parent
commit
04161caa5c
7 changed files with 87 additions and 86 deletions
  1. +4
    -4
      src/blacklist.c
  2. +2
    -2
      src/key_reset.c
  3. +8
    -8
      src/keymanagement.c
  4. +64
    -63
      src/pEpEngine.c
  5. +7
    -7
      src/pgp_sequoia.c
  6. +1
    -1
      src/sqlite3.c
  7. +1
    -1
      sync/sql_func.yml2

+ 4
- 4
src/blacklist.c View File

@ -20,7 +20,7 @@ DYNAMIC_API PEP_STATUS blacklist_add(PEP_SESSION session, const char *fpr)
int result;
result = Sqlite3_step(session->blacklist_add);
result = sqlite3_step(session->blacklist_add);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;
@ -50,7 +50,7 @@ DYNAMIC_API PEP_STATUS blacklist_delete(PEP_SESSION session, const char *fpr)
int result;
result = Sqlite3_step(session->blacklist_delete);
result = sqlite3_step(session->blacklist_delete);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;
@ -85,7 +85,7 @@ DYNAMIC_API PEP_STATUS blacklist_is_listed(
int result;
result = Sqlite3_step(session->blacklist_is_listed);
result = sqlite3_step(session->blacklist_is_listed);
switch (result) {
case SQLITE_ROW:
count = sqlite3_column_int(session->blacklist_is_listed, 0);
@ -125,7 +125,7 @@ DYNAMIC_API PEP_STATUS blacklist_retrieve(
stringlist_t *_bl = _blacklist;
do {
result = Sqlite3_step(session->blacklist_retrieve);
result = sqlite3_step(session->blacklist_retrieve);
switch (result) {
case SQLITE_ROW:
{


+ 2
- 2
src/key_reset.c View File

@ -41,7 +41,7 @@ PEP_STATUS has_key_reset_been_sent(
SQLITE_STATIC);
sqlite3_bind_text(session->was_id_for_revoke_contacted, 2, user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->was_id_for_revoke_contacted);
int result = sqlite3_step(session->was_id_for_revoke_contacted);
switch (result) {
case SQLITE_ROW: {
*contacted = (sqlite3_column_int(session->was_id_for_revoke_contacted, 0) != 0);
@ -81,7 +81,7 @@ PEP_STATUS set_reset_contact_notified(
int result;
result = Sqlite3_step(session->set_revoke_contact_as_notified);
result = sqlite3_step(session->set_revoke_contact_as_notified);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;


+ 8
- 8
src/keymanagement.c View File

@ -282,7 +282,7 @@ PEP_STATUS get_all_keys_for_user(PEP_SESSION session,
int result = -1;
while ((result = Sqlite3_step(session->get_all_keys_for_user)) == SQLITE_ROW) {
while ((result = sqlite3_step(session->get_all_keys_for_user)) == SQLITE_ROW) {
const char* keyres = (const char *) sqlite3_column_text(session->get_all_keys_for_user, 0);
if (keyres) {
if (_kl)
@ -317,7 +317,7 @@ PEP_STATUS get_user_default_key(PEP_SESSION session, const char* user_id,
sqlite3_bind_text(session->get_user_default_key, 1, user_id,
-1, SQLITE_STATIC);
const int result = Sqlite3_step(session->get_user_default_key);
const int result = sqlite3_step(session->get_user_default_key);
char* user_fpr = NULL;
if (result == SQLITE_ROW) {
const char* u_fpr =
@ -1673,7 +1673,7 @@ DYNAMIC_API PEP_STATUS own_key_is_listed(
int result;
result = Sqlite3_step(session->own_key_is_listed);
result = sqlite3_step(session->own_key_is_listed);
switch (result) {
case SQLITE_ROW:
count = sqlite3_column_int(session->own_key_is_listed, 0);
@ -1723,7 +1723,7 @@ PEP_STATUS _own_identities_retrieve(
sqlite3_bind_int(session->own_identities_retrieve, 1, excluded_flags);
do {
result = Sqlite3_step(session->own_identities_retrieve);
result = sqlite3_step(session->own_identities_retrieve);
switch (result) {
case SQLITE_ROW:
address = (const char *)
@ -1817,7 +1817,7 @@ PEP_STATUS _own_keys_retrieve(
sqlite3_bind_int(session->own_keys_retrieve, 1, excluded_flags);
do {
result = Sqlite3_step(session->own_keys_retrieve);
result = sqlite3_step(session->own_keys_retrieve);
switch (result) {
case SQLITE_ROW:
_bl = stringlist_add(_bl, (const char *)
@ -1958,7 +1958,7 @@ PEP_STATUS add_mistrusted_key(PEP_SESSION session, const char* fpr)
sqlite3_bind_text(session->add_mistrusted_key, 1, fpr, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->add_mistrusted_key);
result = sqlite3_step(session->add_mistrusted_key);
sqlite3_reset(session->add_mistrusted_key);
if (result != SQLITE_DONE)
@ -1980,7 +1980,7 @@ PEP_STATUS delete_mistrusted_key(PEP_SESSION session, const char* fpr)
sqlite3_bind_text(session->delete_mistrusted_key, 1, fpr, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->delete_mistrusted_key);
result = sqlite3_step(session->delete_mistrusted_key);
sqlite3_reset(session->delete_mistrusted_key);
if (result != SQLITE_DONE)
@ -2007,7 +2007,7 @@ PEP_STATUS is_mistrusted_key(PEP_SESSION session, const char* fpr,
int result;
result = Sqlite3_step(session->is_mistrusted_key);
result = sqlite3_step(session->is_mistrusted_key);
switch (result) {
case SQLITE_ROW:
*mistrusted = sqlite3_column_int(session->is_mistrusted_key, 0);


+ 64
- 63
src/pEpEngine.c View File

@ -53,7 +53,7 @@ int sql_trace_callback (unsigned trace_constant,
if (!EMPTYSTR(X_str) && X_str[0] == '-' && X_str[1] == '-')
fprintf(stderr, "%s\n", X_str);
else
fprintf(stderr, "%s\n", sqlite3_expanded_sql((sqlite3_stmt*)P));
fprintf(stderr, "%s\n", sqlite3_expanded_sql((sqlite3_stmt*)P));
break;
case SQLITE_TRACE_ROW:
fprintf(stderr, "SQL_DEBUG: ROW - ");
@ -563,7 +563,7 @@ static int db_contains_table(PEP_SESSION session, const char* table_name) {
int retval = 0;
int rc = Sqlite3_step(stmt);
int rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE || rc == SQLITE_OK || rc == SQLITE_ROW) {
retval = 1;
}
@ -614,7 +614,7 @@ static int table_contains_column(PEP_SESSION session, const char* table_name,
int retval = 0;
int rc = Sqlite3_step(stmt);
int rc = sqlite3_step(stmt);
if (rc == SQLITE_DONE || rc == SQLITE_OK || rc == SQLITE_ROW) {
retval = 1;
}
@ -637,7 +637,7 @@ PEP_STATUS repair_altered_tables(PEP_SESSION session) {
sqlite3_prepare_v2(session->db, sql_query, -1, &stmt, NULL);
int i = 0;
int int_result = 0;
while ((int_result = Sqlite3_step(stmt)) == SQLITE_ROW && i < _PEP_MAX_AFFECTED) {
while ((int_result = sqlite3_step(stmt)) == SQLITE_ROW && i < _PEP_MAX_AFFECTED) {
table_names[i++] = strdup((const char*)(sqlite3_column_text(stmt, 0)));
}
@ -2111,13 +2111,15 @@ DYNAMIC_API void release(PEP_SESSION session)
sqlite3_finalize(session->is_mistrusted_key);
if (session->db) {
sqlite3_exec(
session->db,
"PRAGMA optimize;\n",
NULL,
NULL,
NULL
);
if (out_last) {
sqlite3_exec(
session->db,
"PRAGMA optimize;\n",
NULL,
NULL,
NULL
);
}
sqlite3_close_v2(session->db);
}
if (session->system_db)
@ -2200,7 +2202,7 @@ DYNAMIC_API PEP_STATUS log_event(
sqlite3_bind_text(session->log, 4, comment, -1, SQLITE_STATIC);
else
sqlite3_bind_null(session->log, 4);
result = Sqlite3_step(session->log);
result = sqlite3_step(session->log);
sqlite3_reset(session->log);
#endif
@ -2255,7 +2257,7 @@ DYNAMIC_API PEP_STATUS trustword(
sqlite3_bind_text(session->trustword, 1, lang, -1, SQLITE_STATIC);
sqlite3_bind_int(session->trustword, 2, value);
const int result = Sqlite3_step(session->trustword);
const int result = sqlite3_step(session->trustword);
if (result == SQLITE_ROW) {
*word = strdup((const char *) sqlite3_column_text(session->trustword,
1));
@ -2452,7 +2454,7 @@ DYNAMIC_API PEP_STATUS get_default_own_userid(
sqlite3_reset(session->get_default_own_userid);
const int result = Sqlite3_step(session->get_default_own_userid);
const int result = sqlite3_step(session->get_default_own_userid);
const char* id;
switch (result) {
@ -2501,7 +2503,7 @@ DYNAMIC_API PEP_STATUS get_userid_alias_default(
const char* tempid;
const int result = Sqlite3_step(session->get_userid_alias_default);
const int result = sqlite3_step(session->get_userid_alias_default);
switch (result) {
case SQLITE_ROW:
tempid = (const char *) sqlite3_column_text(session->get_userid_alias_default, 0);
@ -2546,7 +2548,7 @@ DYNAMIC_API PEP_STATUS set_userid_alias (
sqlite3_bind_text(session->add_userid_alias, 2, alias_id, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->add_userid_alias);
result = sqlite3_step(session->add_userid_alias);
sqlite3_reset(session->add_userid_alias);
if (result != SQLITE_DONE) {
@ -2583,7 +2585,7 @@ DYNAMIC_API PEP_STATUS get_identity(
sqlite3_bind_text(session->get_identity, 1, address, -1, SQLITE_STATIC);
sqlite3_bind_text(session->get_identity, 2, user_id, -1, SQLITE_STATIC);
const int result = Sqlite3_step(session->get_identity);
const int result = sqlite3_step(session->get_identity);
switch (result) {
case SQLITE_ROW:
_identity = new_identity(
@ -2650,7 +2652,7 @@ PEP_STATUS get_identities_by_userid(
sqlite3_bind_text(session->get_identities_by_userid, 1, user_id, -1, SQLITE_STATIC);
int result = -1;
while ((result = Sqlite3_step(session->get_identities_by_userid)) == SQLITE_ROW) {
while ((result = sqlite3_step(session->get_identities_by_userid)) == SQLITE_ROW) {
// "select address, fpr, username, comm_type, lang,"
// " identity.flags | pgp_keypair.flags,"
// " is_own"
@ -2732,7 +2734,7 @@ PEP_STATUS get_identities_by_main_key_id(
int result = -1;
while ((result = Sqlite3_step(session->get_identities_by_main_key_id)) == SQLITE_ROW) {
while ((result = sqlite3_step(session->get_identities_by_main_key_id)) == SQLITE_ROW) {
ident = new_identity(
(const char *) sqlite3_column_text(session->get_identities_by_main_key_id, 0),
fpr,
@ -2806,7 +2808,7 @@ PEP_STATUS get_identity_without_trust_check(
sqlite3_bind_text(session->get_identity_without_trust_check, 1, address, -1, SQLITE_STATIC);
sqlite3_bind_text(session->get_identity_without_trust_check, 2, user_id, -1, SQLITE_STATIC);
const int result = Sqlite3_step(session->get_identity_without_trust_check);
const int result = sqlite3_step(session->get_identity_without_trust_check);
switch (result) {
case SQLITE_ROW:
_identity = new_identity(
@ -2874,7 +2876,7 @@ PEP_STATUS get_identities_by_address(
sqlite3_bind_text(session->get_identities_by_address, 1, address, -1, SQLITE_STATIC);
int result;
while ((result = Sqlite3_step(session->get_identities_by_address)) == SQLITE_ROW) {
while ((result = sqlite3_step(session->get_identities_by_address)) == SQLITE_ROW) {
//"select user_id, main_key_id, username, comm_type, lang,"
//" identity.flags, is_own"
pEp_identity *ident = new_identity(
@ -2945,7 +2947,7 @@ PEP_STATUS exists_identity_entry(PEP_SESSION session, pEp_identity* identity,
sqlite3_bind_text(session->exists_identity_entry, 2, identity->user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->exists_identity_entry);
int result = sqlite3_step(session->exists_identity_entry);
switch (result) {
case SQLITE_ROW: {
@ -2980,7 +2982,7 @@ PEP_STATUS exists_trust_entry(PEP_SESSION session, pEp_identity* identity,
sqlite3_bind_text(session->exists_trust_entry, 2, identity->fpr, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->exists_trust_entry);
int result = sqlite3_step(session->exists_trust_entry);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -3004,7 +3006,7 @@ PEP_STATUS set_pgp_keypair(PEP_SESSION session, const char* fpr) {
sqlite3_reset(session->set_pgp_keypair);
sqlite3_bind_text(session->set_pgp_keypair, 1, fpr, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->set_pgp_keypair);
result = sqlite3_step(session->set_pgp_keypair);
sqlite3_reset(session->set_pgp_keypair);
if (result != SQLITE_DONE) {
return PEP_CANNOT_SET_PGP_KEYPAIR;
@ -3026,7 +3028,7 @@ PEP_STATUS clear_trust_info(PEP_SESSION session,
SQLITE_STATIC);
sqlite3_bind_text(session->clear_trust_info, 2, fpr, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->clear_trust_info);
result = sqlite3_step(session->clear_trust_info);
sqlite3_reset(session->clear_trust_info);
if (result != SQLITE_DONE) {
return PEP_UNKNOWN_ERROR;
@ -3059,7 +3061,7 @@ static PEP_STATUS _set_or_update_trust(PEP_SESSION session,
sqlite3_bind_text(set_or_update, 2, identity->fpr, -1,
SQLITE_STATIC);
sqlite3_bind_int(set_or_update, 3, identity->comm_type);
result = Sqlite3_step(set_or_update);
result = sqlite3_step(set_or_update);
assert(result == SQLITE_DONE);
sqlite3_reset(set_or_update);
if (result != SQLITE_DONE)
@ -3090,7 +3092,7 @@ static PEP_STATUS _set_or_update_identity_entry(PEP_SESSION session,
sqlite3_bind_int(set_or_update, 6, identity->major_ver);
sqlite3_bind_int(set_or_update, 7, identity->minor_ver);
int result = Sqlite3_step(set_or_update);
int result = sqlite3_step(set_or_update);
sqlite3_reset(set_or_update);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_IDENTITY;
@ -3120,7 +3122,7 @@ static PEP_STATUS _set_or_update_person(PEP_SESSION session,
sqlite3_bind_null(set_or_update, 3);
sqlite3_bind_text(set_or_update, 4, identity->fpr, -1,
SQLITE_STATIC);
int result = Sqlite3_step(set_or_update);
int result = sqlite3_step(set_or_update);
sqlite3_reset(set_or_update);
if (result != SQLITE_DONE)
@ -3295,7 +3297,7 @@ PEP_STATUS update_pEp_user_trust_vals(PEP_SESSION session,
sqlite3_reset(session->update_trust_to_pEp);
sqlite3_bind_text(session->update_trust_to_pEp, 1, user->user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->update_trust_to_pEp);
int result = sqlite3_step(session->update_trust_to_pEp);
sqlite3_reset(session->update_trust_to_pEp);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_TRUST;
@ -3332,7 +3334,7 @@ DYNAMIC_API PEP_STATUS set_as_pEp_user(PEP_SESSION session, pEp_identity* user)
sqlite3_reset(session->set_as_pEp_user);
sqlite3_bind_text(session->set_as_pEp_user, 1, user->user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->set_as_pEp_user);
int result = sqlite3_step(session->set_as_pEp_user);
sqlite3_reset(session->set_as_pEp_user);
if (result != SQLITE_DONE)
@ -3357,7 +3359,7 @@ PEP_STATUS set_pEp_version(PEP_SESSION session, pEp_identity* ident, unsigned in
sqlite3_bind_text(session->set_pEp_version, 4, ident->user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->set_pEp_version);
int result = sqlite3_step(session->set_pEp_version);
sqlite3_reset(session->set_pEp_version);
if (result != SQLITE_DONE)
@ -3382,7 +3384,7 @@ PEP_STATUS upgrade_pEp_version_by_user_id(PEP_SESSION session,
sqlite3_bind_text(session->upgrade_pEp_version_by_user_id, 3, ident->user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->upgrade_pEp_version_by_user_id);
int result = sqlite3_step(session->upgrade_pEp_version_by_user_id);
sqlite3_reset(session->upgrade_pEp_version_by_user_id);
if (result != SQLITE_DONE)
@ -3415,7 +3417,7 @@ PEP_STATUS exists_person(PEP_SESSION session, pEp_identity* identity,
sqlite3_reset(session->exists_person);
sqlite3_bind_text(session->exists_person, 1, user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->exists_person);
int result = sqlite3_step(session->exists_person);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -3453,7 +3455,7 @@ PEP_STATUS delete_person(PEP_SESSION session, const char* user_id) {
sqlite3_bind_text(session->delete_person, 1, user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->delete_person);
int result = sqlite3_step(session->delete_person);
if (result != SQLITE_DONE)
status = PEP_UNKNOWN_ERROR;
@ -3488,7 +3490,7 @@ DYNAMIC_API PEP_STATUS is_pEp_user(PEP_SESSION session, pEp_identity *identity,
sqlite3_reset(session->is_pEp_user);
sqlite3_bind_text(session->is_pEp_user, 1, user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->is_pEp_user);
int result = sqlite3_step(session->is_pEp_user);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -3524,7 +3526,7 @@ PEP_STATUS is_own_address(PEP_SESSION session, const char* address, bool* is_own
sqlite3_reset(session->is_own_address);
sqlite3_bind_text(session->is_own_address, 1, address, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->is_own_address);
int result = sqlite3_step(session->is_own_address);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -3556,7 +3558,7 @@ PEP_STATUS bind_own_ident_with_contact_ident(PEP_SESSION session,
sqlite3_bind_text(session->add_into_social_graph, 3, contact_ident->user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->add_into_social_graph);
int result = sqlite3_step(session->add_into_social_graph);
sqlite3_reset(session->add_into_social_graph);
if (result != SQLITE_DONE)
@ -3585,7 +3587,7 @@ PEP_STATUS get_own_ident_for_contact_id(PEP_SESSION session,
sqlite3_bind_text(session->get_own_address_binding_from_contact, 2, contact->user_id, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->get_own_address_binding_from_contact);
int result = sqlite3_step(session->get_own_address_binding_from_contact);
const char* own_address = NULL;
@ -3621,7 +3623,7 @@ PEP_STATUS remove_fpr_as_default(PEP_SESSION session,
sqlite3_bind_text(session->remove_fpr_as_default, 1, fpr, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->remove_fpr_as_default);
int result = sqlite3_step(session->remove_fpr_as_default);
sqlite3_reset(session->remove_fpr_as_default);
if (result != SQLITE_DONE)
@ -3647,7 +3649,7 @@ PEP_STATUS replace_identities_fpr(PEP_SESSION session,
sqlite3_bind_text(session->replace_identities_fpr, 2, old_fpr, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->replace_identities_fpr);
int result = sqlite3_step(session->replace_identities_fpr);
sqlite3_reset(session->replace_identities_fpr);
if (result != SQLITE_DONE)
@ -3667,7 +3669,7 @@ PEP_STATUS update_trust_for_fpr(PEP_SESSION session,
sqlite3_bind_int(session->update_trust_for_fpr, 1, comm_type);
sqlite3_bind_text(session->update_trust_for_fpr, 2, fpr, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->update_trust_for_fpr);
int result = sqlite3_step(session->update_trust_for_fpr);
sqlite3_reset(session->update_trust_for_fpr);
if (result != SQLITE_DONE) {
return PEP_CANNOT_SET_TRUST;
@ -3699,7 +3701,7 @@ DYNAMIC_API PEP_STATUS set_identity_flags(
sqlite3_bind_text(session->set_identity_flags, 3, identity->user_id, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->set_identity_flags);
result = sqlite3_step(session->set_identity_flags);
sqlite3_reset(session->set_identity_flags);
if (result != SQLITE_DONE)
@ -3731,7 +3733,7 @@ DYNAMIC_API PEP_STATUS unset_identity_flags(
SQLITE_STATIC);
sqlite3_bind_text(session->unset_identity_flags, 3, identity->user_id, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->unset_identity_flags);
result = sqlite3_step(session->unset_identity_flags);
sqlite3_reset(session->unset_identity_flags);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_IDENTITY;
@ -3755,7 +3757,7 @@ PEP_STATUS get_trust_by_userid(PEP_SESSION session, const char* user_id,
sqlite3_reset(session->get_trust_by_userid);
sqlite3_bind_text(session->get_trust_by_userid, 1, user_id, -1, SQLITE_STATIC);
while ((result = Sqlite3_step(session->get_trust_by_userid)) == SQLITE_ROW) {
while ((result = sqlite3_step(session->get_trust_by_userid)) == SQLITE_ROW) {
if (!t_list)
t_list = new_labeled_int_list(sqlite3_column_int(session->get_trust_by_userid, 1),
(const char *) sqlite3_column_text(session->get_trust_by_userid, 0));
@ -4086,7 +4088,7 @@ PEP_STATUS replace_userid(PEP_SESSION session, const char* old_uid,
SQLITE_STATIC);
sqlite3_bind_text(session->replace_userid, 2, old_uid, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->replace_userid);
result = sqlite3_step(session->replace_userid);
#ifndef NDEBUG
if (result) {
const char *errmsg = sqlite3_errmsg(session->db);
@ -4112,7 +4114,7 @@ PEP_STATUS remove_key(PEP_SESSION session, const char* fpr) {
sqlite3_reset(session->delete_key);
sqlite3_bind_text(session->delete_key, 1, fpr, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->delete_key);
result = sqlite3_step(session->delete_key);
sqlite3_reset(session->delete_key);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_PGP_KEYPAIR;
@ -4133,7 +4135,7 @@ PEP_STATUS refresh_userid_default_key(PEP_SESSION session, const char* user_id)
sqlite3_reset(session->refresh_userid_default_key);
sqlite3_bind_text(session->refresh_userid_default_key, 1, user_id, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->refresh_userid_default_key);
result = sqlite3_step(session->refresh_userid_default_key);
sqlite3_reset(session->refresh_userid_default_key);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_PERSON;
@ -4157,7 +4159,7 @@ PEP_STATUS replace_main_user_fpr(PEP_SESSION session, const char* user_id,
SQLITE_STATIC);
sqlite3_bind_text(session->replace_main_user_fpr, 2, user_id, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->replace_main_user_fpr);
result = sqlite3_step(session->replace_main_user_fpr);
sqlite3_reset(session->replace_main_user_fpr);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_PERSON;
@ -4184,7 +4186,7 @@ PEP_STATUS get_main_user_fpr(PEP_SESSION session,
sqlite3_reset(session->get_main_user_fpr);
sqlite3_bind_text(session->get_main_user_fpr, 1, user_id, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->get_main_user_fpr);
result = sqlite3_step(session->get_main_user_fpr);
switch (result) {
case SQLITE_ROW: {
const char* _fpr =
@ -4232,7 +4234,7 @@ DYNAMIC_API PEP_STATUS mark_as_compromised(
sqlite3_reset(session->mark_compromised);
sqlite3_bind_text(session->mark_compromised, 1, fpr, -1,
SQLITE_STATIC);
result = Sqlite3_step(session->mark_compromised);
result = sqlite3_step(session->mark_compromised);
sqlite3_reset(session->mark_compromised);
if (result != SQLITE_DONE)
@ -4272,7 +4274,7 @@ DYNAMIC_API PEP_STATUS get_trust(PEP_SESSION session, pEp_identity *identity)
SQLITE_STATIC);
sqlite3_bind_text(session->get_trust, 2, identity->fpr, -1, SQLITE_STATIC);
result = Sqlite3_step(session->get_trust);
result = sqlite3_step(session->get_trust);
switch (result) {
case SQLITE_ROW: {
int comm_type = (PEP_comm_type) sqlite3_column_int(session->get_trust,
@ -4311,7 +4313,7 @@ DYNAMIC_API PEP_STATUS least_trust(
sqlite3_reset(session->least_trust);
sqlite3_bind_text(session->least_trust, 1, fpr, -1, SQLITE_STATIC);
result = Sqlite3_step(session->least_trust);
result = sqlite3_step(session->least_trust);
switch (result) {
case SQLITE_ROW: {
int _comm_type = sqlite3_column_int(session->least_trust, 0);
@ -4766,7 +4768,7 @@ DYNAMIC_API PEP_STATUS get_crashdump_log(
int result;
do {
result = Sqlite3_step(session->crashdump);
result = sqlite3_step(session->crashdump);
switch (result) {
case SQLITE_ROW:
timestamp = (const char *) sqlite3_column_text(session->crashdump,
@ -4858,7 +4860,7 @@ DYNAMIC_API PEP_STATUS get_languagelist(
int result;
do {
result = Sqlite3_step(session->languagelist);
result = sqlite3_step(session->languagelist);
switch (result) {
case SQLITE_ROW:
lang = (const char *) sqlite3_column_text(session->languagelist,
@ -4926,7 +4928,7 @@ DYNAMIC_API PEP_STATUS get_phrase(
const char *_phrase = NULL;
int result;
result = Sqlite3_step(session->i18n_token);
result = sqlite3_step(session->i18n_token);
switch (result) {
case SQLITE_ROW:
_phrase = (const char *) sqlite3_column_text(session->i18n_token, 0);
@ -4968,7 +4970,7 @@ static PEP_STATUS _get_sequence_value(PEP_SESSION session, const char *name,
sqlite3_reset(session->sequence_value2);
sqlite3_bind_text(session->sequence_value2, 1, name, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->sequence_value2);
int result = sqlite3_step(session->sequence_value2);
switch (result) {
case SQLITE_ROW: {
int32_t _value = (int32_t)
@ -4996,7 +4998,7 @@ static PEP_STATUS _increment_sequence_value(PEP_SESSION session,
sqlite3_reset(session->sequence_value1);
sqlite3_bind_text(session->sequence_value1, 1, name, -1, SQLITE_STATIC);
int result = Sqlite3_step(session->sequence_value1);
int result = sqlite3_step(session->sequence_value1);
assert(result == SQLITE_DONE);
sqlite3_reset(session->sequence_value1);
if (result == SQLITE_DONE)
@ -5057,7 +5059,7 @@ PEP_STATUS is_own_key(PEP_SESSION session, const char* fpr, bool* own_key) {
sqlite3_bind_text(session->own_key_is_listed, 1, fpr, -1,
SQLITE_STATIC);
int result = Sqlite3_step(session->own_key_is_listed);
int result = sqlite3_step(session->own_key_is_listed);
switch (result) {
case SQLITE_ROW: {
*own_key = (sqlite3_column_int(session->own_key_is_listed, 0) != 0);
@ -5101,7 +5103,7 @@ DYNAMIC_API PEP_STATUS set_revoked(
int result;
result = Sqlite3_step(session->set_revoked);
result = sqlite3_step(session->set_revoked);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;
@ -5143,7 +5145,7 @@ DYNAMIC_API PEP_STATUS get_revoked(
int result;
result = Sqlite3_step(session->get_revoked);
result = sqlite3_step(session->get_revoked);
switch (result) {
case SQLITE_ROW: {
*revoked_fpr = strdup((const char *)
@ -5187,7 +5189,7 @@ DYNAMIC_API PEP_STATUS get_replacement_fpr(
int result;
result = Sqlite3_step(session->get_replacement_fpr);
result = sqlite3_step(session->get_replacement_fpr);
switch (result) {
case SQLITE_ROW: {
*revoked_fpr = strdup((const char *)
@ -5226,7 +5228,7 @@ PEP_STATUS get_last_contacted(
sqlite3_reset(session->get_last_contacted);
int result;
while ((result = Sqlite3_step(session->get_last_contacted)) == SQLITE_ROW) {
while ((result = sqlite3_step(session->get_last_contacted)) == SQLITE_ROW) {
pEp_identity *ident = new_identity(
(const char *) sqlite3_column_text(session->get_last_contacted, 1),
NULL,
@ -5380,4 +5382,3 @@ DYNAMIC_API void set_debug_color(PEP_SESSION session, int ansi_color)
session->debug_color = ansi_color;
#endif
}

+ 7
- 7
src/pgp_sequoia.c View File

@ -508,7 +508,7 @@ static PEP_STATUS key_load(PEP_SESSION session, sqlite3_stmt *stmt,
pgp_tpk_t *tpkp, int *secretp)
{
PEP_STATUS status = PEP_STATUS_OK;
int sqlite_result = Sqlite3_step(stmt);
int sqlite_result = sqlite3_step(stmt);
switch (sqlite_result) {
case SQLITE_ROW:
if (tpkp) {
@ -754,7 +754,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
char *name = NULL;
sqlite3_stmt *stmt = session->sq_sql.begin_transaction;
int sqlite_result = Sqlite3_step(stmt);
int sqlite_result = sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE)
ERROR_OUT(NULL, PEP_UNKNOWN_ERROR,
@ -800,7 +800,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
sqlite3_bind_int(stmt, 2, is_tsk);
sqlite3_bind_blob(stmt, 3, tsk_buffer, tsk_buffer_len, SQLITE_STATIC);
sqlite_result = Sqlite3_step(stmt);
sqlite_result = sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE)
ERROR_OUT(NULL, PEP_UNKNOWN_ERROR,
@ -818,7 +818,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
sqlite3_bind_text(stmt, 1, keyid_hex, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, fpr, -1, SQLITE_STATIC);
sqlite_result = Sqlite3_step(stmt);
sqlite_result = sqlite3_step(stmt);
sqlite3_reset(stmt);
free(keyid_hex);
pgp_keyid_free(keyid);
@ -865,7 +865,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
sqlite3_bind_text(stmt, 1, email, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, fpr, -1, SQLITE_STATIC);
sqlite_result = Sqlite3_step(stmt);
sqlite_result = sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE) {
@ -899,7 +899,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
stmt = status == PEP_STATUS_OK
? session->sq_sql.commit_transaction
: session->sq_sql.rollback_transaction;
int sqlite_result = Sqlite3_step(stmt);
int sqlite_result = sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE)
ERROR_OUT(NULL, PEP_UNKNOWN_ERROR,
@ -1923,7 +1923,7 @@ PEP_STATUS pgp_delete_keypair(PEP_SESSION session, const char *fpr_raw)
sqlite3_stmt *stmt = session->sq_sql.delete_keypair;
sqlite3_bind_text(stmt, 1, fpr, -1, free);
int sqlite_result = Sqlite3_step(stmt);
int sqlite_result = sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE)
ERROR_OUT(NULL, PEP_CANNOT_DELETE_KEY,


+ 1
- 1
src/sqlite3.c View File

@ -116736,7 +116736,7 @@ SQLITE_PRIVATE int sqlite3ExprReferencesUpdatedColumn(
** cause sqlite3_step() to return immediately
** with SQLITE_CONSTRAINT.
**
** any FAIL Sqlite3_step() returns immediately with a
** any FAIL sqlite3_step() returns immediately with a
** return code of SQLITE_CONSTRAINT. The
** transaction is not rolled back and any
** changes to prior rows are retained.


+ 1
- 1
sync/sql_func.yml2 View File

@ -31,7 +31,7 @@ function "exec_sql_int" {
call "init_sql" with "sql", "$sql";
||
int _result = 0;
int_result = Sqlite3_step(_sql);
int_result = sqlite3_step(_sql);
assert(int_result == SQLITE_ROW);
if (int_result == SQLITE_ROW)
_result = sqlite3_column_int(_sql, 0);


Loading…
Cancel
Save