ENGINE-209: compiling again ENGINE-209
authorKrista Bennett <krista@pep-project.org>
Thu, 18 May 2017 11:27:07 +0200
branchENGINE-209
changeset 179732581fade44d
parent 1794 22943326aeb8
child 1798 dddaa8a5d31c
ENGINE-209: compiling again
src/keymanagement.c
src/keymanagement.h
src/pEpEngine.c
src/pEpEngine.h
src/pEp_internal.h
     1.1 --- a/src/keymanagement.c	Wed May 17 15:07:49 2017 +0200
     1.2 +++ b/src/keymanagement.c	Thu May 18 11:27:07 2017 +0200
     1.3 @@ -152,14 +152,15 @@
     1.4                  
     1.5              if (revoked) {
     1.6                  // Do stuff
     1.7 -                status = change_key_comm_type(session, fpr, PEP_ct_key_revoked);
     1.8 +                status = change_key_comm_type(session, stored_identity->fpr, PEP_ct_key_revoked);
     1.9                  // What to do on failure? FIXME
    1.10 -                status = remove_key_as_id_default(session, fpr);
    1.11 +                status = remove_key_as_id_default(session, stored_identity->fpr);
    1.12              }
    1.13 -                
    1.14 -            status = blacklist_is_listed(session, stored_identity->fpr, &dont_use_stored_fpr);
    1.15 -            if (status != PEP_STATUS_OK)
    1.16 -                dont_use_stored_fpr = true; 
    1.17 +            else {    
    1.18 +                status = blacklist_is_listed(session, stored_identity->fpr, &dont_use_stored_fpr);
    1.19 +                if (status != PEP_STATUS_OK)
    1.20 +                    dont_use_stored_fpr = true; 
    1.21 +            }
    1.22          }
    1.23              
    1.24  
    1.25 @@ -1062,7 +1063,7 @@
    1.26      return session->cryptotech[PEP_crypt_OpenPGP].contains_priv_key(session, fpr, has_private);
    1.27  }
    1.28  
    1.29 -static PEP_STATUS change_key_comm_type(PEP_SESSION session, 
    1.30 +PEP_STATUS change_key_comm_type(PEP_SESSION session, 
    1.31                                         const char* fpr,
    1.32                                         PEP_comm_type comm_type) {
    1.33                                             
    1.34 @@ -1076,7 +1077,7 @@
    1.35          return status;
    1.36      }
    1.37          
    1.38 -    if (!user_id_list || !user_id_list->value())
    1.39 +    if (!user_id_list || !user_id_list->value)
    1.40          return PEP_KEY_NOT_FOUND;
    1.41          
    1.42      stringlist_t* curr_id = user_id_list;
    1.43 @@ -1093,12 +1094,12 @@
    1.44      return PEP_STATUS_OK;
    1.45  }
    1.46  
    1.47 -static PEP_STATUS remove_key_as_id_default(PEP_SESSIONS session, 
    1.48 +PEP_STATUS remove_key_as_id_default(PEP_SESSION session, 
    1.49                                             const char* fpr)
    1.50  {
    1.51      identity_list* affected_ids = NULL;
    1.52      
    1.53 -    PEP_STATUS status get_identities_by_fpr(session, fpr, &identity_list);
    1.54 +    PEP_STATUS status = get_identities_by_fpr(session, fpr, &affected_ids);
    1.55      
    1.56      if (status != PEP_STATUS_OK) {
    1.57          free_identity_list(affected_ids);
    1.58 @@ -1112,9 +1113,9 @@
    1.59      status = PEP_STATUS_OK;
    1.60      
    1.61      while (curr_identity) {
    1.62 -        free(curr_identity->fpr);
    1.63 -        curr_identity->fpr = (char*)calloc(1, sizeof(char)); // ""
    1.64 -        status = set_identity(session, curr_identity);
    1.65 +        free(curr_identity->ident->fpr);
    1.66 +        curr_identity->ident->fpr = (char*)calloc(1, sizeof(char)); // ""
    1.67 +        status = set_identity(session, curr_identity->ident);
    1.68          if (status != PEP_STATUS_OK)
    1.69              goto the_end;
    1.70          curr_identity = curr_identity->next;
     2.1 --- a/src/keymanagement.h	Wed May 17 15:07:49 2017 +0200
     2.2 +++ b/src/keymanagement.h	Thu May 18 11:27:07 2017 +0200
     2.3 @@ -245,13 +245,16 @@
     2.4  //  parameters:
     2.5  //      session(in)         session to use
     2.6  //      fpr(in)             fpr for which to change comm_type
     2.7 -static PEP_STATUS change_key_comm_type(
     2.8 +//      comm_type(in)       comm_type to change to
     2.9 +//
    2.10 +PEP_STATUS change_key_comm_type(
    2.11          PEP_SESSION session,
    2.12 -        const char* fpr
    2.13 +        const char* fpr,
    2.14 +        PEP_comm_type comm_type
    2.15      );
    2.16      
    2.17 -static PEP_STATUS remove_key_as_id_default(
    2.18 -        PEP_SESSIONS session, 
    2.19 +PEP_STATUS remove_key_as_id_default(
    2.20 +        PEP_SESSION session, 
    2.21          const char* fpr
    2.22      );
    2.23  
     3.1 --- a/src/pEpEngine.c	Wed May 17 15:07:49 2017 +0200
     3.2 +++ b/src/pEpEngine.c	Thu May 18 11:27:07 2017 +0200
     3.3 @@ -1260,8 +1260,8 @@
     3.4              }
     3.5          }
     3.6  
     3.7 -        status = set_trust(session, identity->user_id, identity->fpr,
     3.8 -                           identity->comm_type)
     3.9 +        // status = set_trust(session, identity->user_id, identity->fpr,
    3.10 +        //                    identity->comm_type)
    3.11          sqlite3_reset(session->set_trust);
    3.12          sqlite3_bind_text(session->set_trust, 1, identity->user_id, -1,
    3.13                  SQLITE_STATIC);
    3.14 @@ -1284,7 +1284,7 @@
    3.15  }
    3.16  
    3.17  PEP_STATUS get_identities_by_fpr(PEP_SESSION session, 
    3.18 -                                 char* fpr, 
    3.19 +                                 const char* fpr, 
    3.20                                   identity_list** id_list) 
    3.21  {
    3.22      PEP_STATUS status = PEP_STATUS_OK;
    3.23 @@ -1293,7 +1293,7 @@
    3.24  }
    3.25  
    3.26  
    3.27 -static PEP_STATUS set_trust(PEP_SESSION session, 
    3.28 +PEP_STATUS set_trust(PEP_SESSION session, 
    3.29                              const char* user_id,
    3.30                              const char* fpr, 
    3.31                              PEP_comm_type comm_type)
    3.32 @@ -1307,7 +1307,7 @@
    3.33      sqlite3_bind_text(session->set_trust, 2, fpr, -1,
    3.34              SQLITE_STATIC);
    3.35      sqlite3_bind_int(session->set_trust, 3, comm_type);
    3.36 -    result = sqlite3_step(session->set_trust);
    3.37 +    int result = sqlite3_step(session->set_trust);
    3.38      sqlite3_reset(session->set_trust);
    3.39      if (result != SQLITE_DONE) {
    3.40          return PEP_CANNOT_SET_TRUST;
    3.41 @@ -2029,7 +2029,7 @@
    3.42      return status;
    3.43  }
    3.44  
    3.45 -static PEP_STATUS get_key_userids(
    3.46 +PEP_STATUS get_key_userids(
    3.47          PEP_SESSION session,
    3.48          const char* fpr,
    3.49          stringlist_t** keylist
    3.50 @@ -2058,8 +2058,7 @@
    3.51          result = sqlite3_step(session->get_key_userids);
    3.52          switch (result) {
    3.53          case SQLITE_ROW:
    3.54 -            userid = (const char *) sqlite3_column_text(session->get_key_userids,
    3.55 -                    0);
    3.56 +            userid = (char *) sqlite3_column_text(session->get_key_userids, 0);
    3.57      
    3.58              if (!userid)
    3.59                  return PEP_UNKNOWN_ERROR;
     4.1 --- a/src/pEpEngine.h	Wed May 17 15:07:49 2017 +0200
     4.2 +++ b/src/pEpEngine.h	Thu May 18 11:27:07 2017 +0200
     4.3 @@ -543,6 +543,11 @@
     4.4          pEp_identity **identity
     4.5      );
     4.6  
     4.7 +PEP_STATUS get_identities_by_fpr(PEP_SESSION session, 
     4.8 +                                 const char* fpr, 
     4.9 +                                 identity_list** id_list); 
    4.10 +
    4.11 +
    4.12  // set_identity() - set identity information
    4.13  //
    4.14  //    parameters:
    4.15 @@ -826,6 +831,10 @@
    4.16  
    4.17  DYNAMIC_API PEP_STATUS get_trust(PEP_SESSION session, pEp_identity *identity);
    4.18  
    4.19 +PEP_STATUS set_trust(PEP_SESSION session, 
    4.20 +                            const char* user_id,
    4.21 +                            const char* fpr, 
    4.22 +                            PEP_comm_type comm_type);
    4.23  
    4.24  // least_trust() - get the least known trust level for a key in the database
    4.25  //
    4.26 @@ -924,6 +933,12 @@
    4.27          bool *revoked
    4.28      );
    4.29  
    4.30 +PEP_STATUS get_key_userids(
    4.31 +        PEP_SESSION session,
    4.32 +        const char* fpr,
    4.33 +        stringlist_t** keylist
    4.34 +    );
    4.35 +
    4.36  
    4.37  // get_crashdump_log() - get the last log messages out
    4.38  //
     5.1 --- a/src/pEp_internal.h	Wed May 17 15:07:49 2017 +0200
     5.2 +++ b/src/pEp_internal.h	Thu May 18 11:27:07 2017 +0200
     5.3 @@ -100,6 +100,7 @@
     5.4      sqlite3_stmt *log;
     5.5      sqlite3_stmt *trustword;
     5.6      sqlite3_stmt *get_identity;
     5.7 +    sqlite3_stmt *get_identities_by_fpr;
     5.8      sqlite3_stmt *set_person;
     5.9      sqlite3_stmt *set_device_group;
    5.10      sqlite3_stmt *get_device_group;
    5.11 @@ -311,10 +312,6 @@
    5.12      return comparison == 0;
    5.13  }
    5.14  
    5.15 -static PEP_STATUS set_trust(PEP_SESSION session, 
    5.16 -                            const char* user_id,
    5.17 -                            const char* fpr, 
    5.18 -                            PEP_comm_type comm_type);
    5.19  
    5.20  #ifdef DEBUG_ERRORSTACK
    5.21      PEP_STATUS session_add_error(PEP_SESSION session, const char* file, unsigned line, PEP_STATUS status);