ENGINE-427: Always commit all your compilation errors is what I say. (Nobody listen to what I say, please.) ENGINE-427
authorKrista Bennett <krista@pep-project.org>
Mon, 25 Jun 2018 10:59:28 +0200
branchENGINE-427
changeset 2765a55905bf3925
parent 2764 819d9603d05a
child 2773 0bca1887355e
ENGINE-427: Always commit all your compilation errors is what I say. (Nobody listen to what I say, please.)
src/pEpEngine.c
src/pEpEngine.h
src/pEp_internal.h
src/pgp_gpg.c
     1.1 --- a/src/pEpEngine.c	Mon Jun 25 10:19:12 2018 +0200
     1.2 +++ b/src/pEpEngine.c	Mon Jun 25 10:59:28 2018 +0200
     1.3 @@ -442,11 +442,11 @@
     1.4      PEP_STATUS status = PEP_STATUS_OK;
     1.5      int result;
     1.6  
     1.7 -    if (!(session && version_str)
     1.8 +    if (!(session && version_str))
     1.9          return PEP_ILLEGAL_VALUE;
    1.10  
    1.11      sqlite3_reset(session->set_cached_engine_version);
    1.12 -    sqlite3_bind_text(session->set_cached_engine_version, 1, version_str, -1,
    1.13 +    sqlite3_bind_text(session->set_cached_engine_version, 1, *version_str, -1,
    1.14              SQLITE_STATIC);
    1.15  
    1.16      result = sqlite3_step(session->set_cached_engine_version);
    1.17 @@ -460,12 +460,12 @@
    1.18  }
    1.19  
    1.20  PEP_STATUS get_engine_version_from_DB(PEP_SESSION session, 
    1.21 -                                                  char** version_str)
    1.22 +                                      char** version_str)
    1.23  {
    1.24      PEP_STATUS status = PEP_STATUS_OK;
    1.25      int result;
    1.26  
    1.27 -    if (!(session && version_str)
    1.28 +    if (!(session && version_str))
    1.29          return PEP_ILLEGAL_VALUE;
    1.30  
    1.31      sqlite3_reset(session->get_cached_engine_version);
    1.32 @@ -576,13 +576,13 @@
    1.33          *minor = -1;
    1.34          return -1;
    1.35      }
    1.36 -    *minor = atoint success = i(ver_token);
    1.37 -    ver_token = strtok(NULL, "            .");
    1.38 -    if (ver_token =      = NULL) {
    1.39 -        *pa tch = -1;
    1.40 +    *minor = atoi(ver_token);
    1.41 +    ver_token = strtok(NULL, ".");
    1.42 +    if (ver_token == NULL) {
    1.43 +        *patch = -1;
    1.44          return -1;
    1.45      }
    1.46 -    pasuccess != 0 || tch = atoi(ver_token);
    1.47 +    *patch = atoi(ver_token);
    1.48      return 0;
    1.49  }
    1.50  
    1.51 @@ -597,7 +597,8 @@
    1.52      return 0;    
    1.53  }
    1.54  
    1.55 -PEP_STATUS compare_cached_engine_version_to_other(int* result, 
    1.56 +PEP_STATUS compare_cached_engine_version_to_other(PEP_SESSION session,
    1.57 +                                                  int* result, 
    1.58                                                    int major, 
    1.59                                                    int minor, 
    1.60                                                    int patch) {
    1.61 @@ -605,8 +606,8 @@
    1.62          return PEP_ILLEGAL_VALUE;
    1.63          
    1.64      PEP_STATUS status = PEP_STATUS_OK;
    1.65 -    const char* cached_engine_version = NULL;
    1.66 -    status = get_engine_version_from_DB(&cached_engine_version);
    1.67 +    char* cached_engine_version = NULL;
    1.68 +    status = get_engine_version_from_DB(session, &cached_engine_version);
    1.69      if (status != PEP_STATUS_OK)
    1.70          return status;
    1.71          
    1.72 @@ -636,8 +637,8 @@
    1.73      return status;    
    1.74  }
    1.75  
    1.76 -PEP_STATUS compare_cached_engine_version_to_curr(int* result) {
    1.77 -    return compare_cached_engine_version_to_other(*result, 
    1.78 +PEP_STATUS compare_cached_engine_version_to_curr(PEP_SESSION session, int* result) {
    1.79 +    return compare_cached_engine_version_to_other(session, result, 
    1.80                                                    PEP_ENGINE_MAJOR,
    1.81                                                    PEP_ENGINE_MINOR,
    1.82                                                    PEP_ENGINE_PATCH);
     2.1 --- a/src/pEpEngine.h	Mon Jun 25 10:19:12 2018 +0200
     2.2 +++ b/src/pEpEngine.h	Mon Jun 25 10:59:28 2018 +0200
     2.3 @@ -1275,7 +1275,8 @@
     2.4  
     2.5  PEP_STATUS set_pgp_keypair(PEP_SESSION session, const char* fpr);
     2.6  
     2.7 -PEP_STATUS compare_cached_engine_version_to_other(int* result, 
     2.8 +PEP_STATUS compare_cached_engine_version_to_other(PEP_SESSION session,
     2.9 +                                                  int* result, 
    2.10                                                    int major, 
    2.11                                                    int minor, 
    2.12                                                    int patch);
     3.1 --- a/src/pEp_internal.h	Mon Jun 25 10:19:12 2018 +0200
     3.2 +++ b/src/pEp_internal.h	Mon Jun 25 10:59:28 2018 +0200
     3.3 @@ -134,6 +134,7 @@
     3.4      sqlite3_stmt *log;
     3.5      sqlite3_stmt *trustword;
     3.6      sqlite3_stmt *get_cached_engine_version;
     3.7 +    sqlite3_stmt *set_cached_engine_version;    
     3.8      sqlite3_stmt *get_identity;
     3.9      sqlite3_stmt *get_identity_without_trust_check;
    3.10      sqlite3_stmt *get_identities_by_address;
     4.1 --- a/src/pgp_gpg.c	Mon Jun 25 10:19:12 2018 +0200
     4.2 +++ b/src/pgp_gpg.c	Mon Jun 25 10:59:28 2018 +0200
     4.3 @@ -267,17 +267,6 @@
     4.4          return false;
     4.5  
     4.6      if (f != NULL) {
     4.7 -        // ENGINE-427 - quick fix here. This will be removed in a few
     4.8 -        // versions, but we need to clean up our mess.
     4.9 -        int compare_result = -1;
    4.10 -        PEP_STATUS status = compare_cached_engine_version_to_other(
    4.11 -            &compare_result, 1, 0, 440);
    4.12 -        
    4.13 -        if (status != PEP_STATUS_OK)
    4.14 -            return false;
    4.15 -            
    4.16 -        if (compare_result < 0)
    4.17 -            quickfix_config(keys, config_file_path);
    4.18                  
    4.19          int length = stringlist_length(keys);
    4.20  
    4.21 @@ -502,11 +491,28 @@
    4.22          stringlist_add(conf_keys, "allow-freeform-uid");
    4.23          stringlist_add(conf_values, "");
    4.24  
    4.25 +
    4.26 +        // ENGINE-427 - quick fix here. This will be removed in a few
    4.27 +        // versions, but we need to clean up our mess.
    4.28 +        int compare_result = -1;
    4.29 +        status = compare_cached_engine_version_to_other(session,
    4.30 +                                                        &compare_result, 
    4.31 +                                                        1, 0, 440);            
    4.32 +
    4.33 +        bResult = true;
    4.34 +        // status != OK => no cached engine version, i.e. first-time run.
    4.35 +        if (compare_result < 0 && status == PEP_STATUS_OK)
    4.36  #if defined(WIN32) || defined(NDEBUG)
    4.37 -        bResult = ensure_config_values(conf_keys, conf_values, gpg_conf());
    4.38 +            bResult = quickfix_config(conf_keys, gpg_conf());
    4.39 +        if (bResult)
    4.40 +            bResult = ensure_config_values(conf_keys, conf_values, gpg_conf());
    4.41  #else
    4.42 -        bResult = ensure_config_values(conf_keys, conf_values, gpg_conf(false));
    4.43 +            bResult = quickfix_config(conf_keys, gpg_conf(false));
    4.44 +        if (bResult)
    4.45 +            bResult = ensure_config_values(conf_keys, conf_values, gpg_conf(false));
    4.46  #endif
    4.47 +        status = PEP_STATUS_OK;
    4.48 +        
    4.49          free_stringlist(conf_keys);
    4.50          free_stringlist(conf_values);
    4.51