ENGINE-340: removed extra mistrust check - problem was actually a missing set in key_mistrust when there is not yet a set identity ENGINE-332
authorKrista Bennett <krista@pep-project.org>
Wed, 24 Jan 2018 11:57:10 +0100
branchENGINE-332
changeset 2441eef4dbecb648
parent 2439 dcb337e68add
child 2444 a97dd32908e5
ENGINE-340: removed extra mistrust check - problem was actually a missing set in key_mistrust when there is not yet a set identity
src/message_api.c
src/pEpEngine.c
src/pEpEngine.h
src/pEp_internal.h
     1.1 --- a/src/message_api.c	Wed Jan 24 10:56:08 2018 +0100
     1.2 +++ b/src/message_api.c	Wed Jan 24 11:57:10 2018 +0100
     1.3 @@ -1215,12 +1215,6 @@
     1.4              continue;
     1.5  
     1.6          PEP_rating _rating_ = key_rating(session, _kl->value);
     1.7 -
     1.8 -        // check for mistrust
     1.9 -        bool is_mistrusted = false;
    1.10 -        fpr_has_mistrust(session, _kl->value, &is_mistrusted); // not sure what to do with status
    1.11 -        if (is_mistrusted)
    1.12 -            _rating_ = PEP_rating_mistrust;
    1.13           
    1.14          if (_rating_ <= PEP_rating_mistrust)
    1.15              return _rating_;
    1.16 @@ -2035,7 +2029,6 @@
    1.17              status = get_trust(session, _sender);
    1.18              if (_sender->comm_type == PEP_ct_unknown) {
    1.19                  get_key_rating(session, fpr, &_sender->comm_type);
    1.20 -                // check mistrust
    1.21              }
    1.22              if (_sender->comm_type != PEP_ct_unknown) {
    1.23                  *rating = keylist_rating(session, recipients, 
     2.1 --- a/src/pEpEngine.c	Wed Jan 24 10:56:08 2018 +0100
     2.2 +++ b/src/pEpEngine.c	Wed Jan 24 11:57:10 2018 +0100
     2.3 @@ -197,11 +197,6 @@
     2.4      "update trust not indexed set comm_type = 15"
     2.5      " where pgp_keypair_fpr = upper(replace(?1,' ','')) ;";
     2.6      
     2.7 -static const char *sql_fpr_has_mistrust =
     2.8 -    "select count(*) from trust "
     2.9 -    "   where pgp_keypair_fpr = upper(replace(?1,' ','')) "
    2.10 -    "       and comm_type = 15 ; ";
    2.11 -
    2.12  static const char *sql_crashdump = 
    2.13      "select timestamp, title, entity, description, comment"
    2.14      " from log order by timestamp desc limit ?1 ;";
    2.15 @@ -923,11 +918,6 @@
    2.16              NULL);
    2.17      assert(int_result == SQLITE_OK);
    2.18  
    2.19 -    int_result = sqlite3_prepare_v2(_session->db, sql_fpr_has_mistrust,
    2.20 -            (int)strlen(sql_fpr_has_mistrust), &_session->fpr_has_mistrust,
    2.21 -            NULL);
    2.22 -    assert(int_result == SQLITE_OK);
    2.23 -
    2.24      int_result = sqlite3_prepare_v2(_session->db, sql_crashdump,
    2.25              (int)strlen(sql_crashdump), &_session->crashdump, NULL);
    2.26      assert(int_result == SQLITE_OK);
    2.27 @@ -2285,42 +2275,6 @@
    2.28      free(p);
    2.29  }
    2.30  
    2.31 -PEP_STATUS fpr_has_mistrust(PEP_SESSION session, 
    2.32 -                            const char* fpr,
    2.33 -                            bool* has_mistrust) {
    2.34 -    assert(session);
    2.35 -    assert(!EMPTYSTR(fpr));                            
    2.36 -    assert(has_mistrust);
    2.37 -    
    2.38 -    if (!session || EMPTYSTR(fpr) || has_mistrust == NULL)
    2.39 -        return PEP_ILLEGAL_VALUE;
    2.40 -        
    2.41 -    *has_mistrust = false;
    2.42 -    
    2.43 -    PEP_STATUS status = PEP_STATUS_OK;
    2.44 -    int result;
    2.45 -
    2.46 -    sqlite3_reset(session->fpr_has_mistrust);
    2.47 -    sqlite3_bind_text(session->fpr_has_mistrust, 1, fpr, -1,
    2.48 -            SQLITE_STATIC);
    2.49 -
    2.50 -    result = sqlite3_step(session->fpr_has_mistrust);
    2.51 -    switch (result) {
    2.52 -    case SQLITE_ROW: {
    2.53 -        *has_mistrust = (PEP_comm_type) sqlite3_column_int(session->fpr_has_mistrust,
    2.54 -                         0);
    2.55 -        break;
    2.56 -    }
    2.57 - 
    2.58 -    default:
    2.59 -        status = PEP_UNKNOWN_ERROR; // DB error??
    2.60 -    }
    2.61 -
    2.62 -    sqlite3_reset(session->fpr_has_mistrust);
    2.63 -    return status;
    2.64 -
    2.65 -}
    2.66 -
    2.67  PEP_STATUS set_trust(PEP_SESSION session, 
    2.68                       const char* user_id,
    2.69                       const char* fpr, 
     3.1 --- a/src/pEpEngine.h	Wed Jan 24 10:56:08 2018 +0100
     3.2 +++ b/src/pEpEngine.h	Wed Jan 24 11:57:10 2018 +0100
     3.3 @@ -1229,10 +1229,6 @@
     3.4      
     3.5  PEP_STATUS refresh_userid_default_key(PEP_SESSION session, const char* user_id);
     3.6  
     3.7 -PEP_STATUS fpr_has_mistrust(PEP_SESSION session, 
     3.8 -                            const char* fpr,
     3.9 -                            bool* has_mistrust);
    3.10 -
    3.11  #ifdef __cplusplus
    3.12  }
    3.13  #endif
     4.1 --- a/src/pEp_internal.h	Wed Jan 24 10:56:08 2018 +0100
     4.2 +++ b/src/pEp_internal.h	Wed Jan 24 11:57:10 2018 +0100
     4.3 @@ -142,7 +142,6 @@
     4.4      sqlite3_stmt *get_trust;
     4.5      sqlite3_stmt *least_trust;
     4.6      sqlite3_stmt *mark_compromized;
     4.7 -    sqlite3_stmt *fpr_has_mistrust;
     4.8      sqlite3_stmt *reset_trust;
     4.9      sqlite3_stmt *crashdump;
    4.10      sqlite3_stmt *languagelist;