Merged in the revised ENGINE-450 branch, because there are fixes impacting both issues. Could have been more cleanly separated, but this is a difference of 5 lines of code, really. ENGINE-427
authorKrista Bennett <krista@pep-project.org>
Tue, 31 Jul 2018 21:45:20 +0200
branchENGINE-427
changeset 279691818b883629
parent 2789 038c70f9f5ce
parent 2795 4bd160717c54
child 2797 0ff0fc8d9683
child 2821 7fe5b66e570d
Merged in the revised ENGINE-450 branch, because there are fixes impacting both issues. Could have been more cleanly separated, but this is a difference of 5 lines of code, really.
     1.1 --- a/src/pEp_internal.h	Mon Jul 30 19:38:45 2018 +0200
     1.2 +++ b/src/pEp_internal.h	Tue Jul 31 21:45:20 2018 +0200
     1.3 @@ -3,10 +3,10 @@
     1.4  
     1.5  
     1.6  // THESE MUST ALL BE CHANGED TOGETHER!!!!
     1.7 -#define PEP_ENGINE_VERSION "1.0.440"
     1.8 +#define PEP_ENGINE_VERSION "1.0.441"
     1.9  #define PEP_ENGINE_MAJOR 1
    1.10  #define PEP_ENGINE_MINOR 0
    1.11 -#define PEP_ENGINE_PATCH 440
    1.12 +#define PEP_ENGINE_PATCH 441
    1.13  
    1.14  // maximum attachment size to import as key 1MB, maximum of 20 attachments
    1.15  
     2.1 --- a/src/pgp_gpg.c	Mon Jul 30 19:38:45 2018 +0200
     2.2 +++ b/src/pgp_gpg.c	Tue Jul 31 21:45:20 2018 +0200
     2.3 @@ -142,6 +142,10 @@
     2.4                  }    
     2.5                  if (notkey)
     2.6                      continue;
     2.7 +                    
     2.8 +                if (num_found_keys >= num_keys)
     2.9 +                    found_keys = (str_ptr_and_bit*)realloc(found_keys, (num_found_keys + 1) * sizeof(str_ptr_and_bit));
    2.10 +                    
    2.11                  found_keys[num_found_keys].key = keypos; 	
    2.12                  found_keys[num_found_keys].bit = i;
    2.13                  num_found_keys++;     
    2.14 @@ -497,7 +501,7 @@
    2.15          int compare_result = -1;
    2.16          status = compare_cached_engine_version_to_other(session,
    2.17                                                          &compare_result, 
    2.18 -                                                        1, 0, 440);            
    2.19 +                                                        1, 0, 441);            
    2.20  
    2.21          bResult = true;
    2.22          // status != OK => no cached engine version, i.e. first-time run.
    2.23 @@ -528,11 +532,16 @@
    2.24          stringlist_add(conf_keys, "max-cache-ttl");
    2.25          stringlist_add(conf_values, "1200");
    2.26  
    2.27 +        if (compare_result < 0 && status == PEP_STATUS_OK)
    2.28  #if defined(WIN32) || defined(NDEBUG)
    2.29 -        bResult = ensure_config_values(conf_keys, conf_values, gpg_agent_conf());
    2.30 -#else        
    2.31 -        bResult = ensure_config_values(conf_keys, conf_values, gpg_agent_conf(false));
    2.32 -#endif
    2.33 +            bResult = quickfix_config(conf_keys, gpg_agent_conf());
    2.34 +        if (bResult)
    2.35 +            bResult = ensure_config_values(conf_keys, conf_values, gpg_agent_conf());
    2.36 + #else        
    2.37 +            bResult = quickfix_config(conf_keys, gpg_agent_conf(false));
    2.38 +        if (bResult)
    2.39 +            bResult = ensure_config_values(conf_keys, conf_values, gpg_agent_conf(false));
    2.40 + #endif
    2.41          free_stringlist(conf_keys);
    2.42          free_stringlist(conf_values);
    2.43  
     3.1 --- a/test/include/GPGConfFixTests.h	Mon Jul 30 19:38:45 2018 +0200
     3.2 +++ b/test/include/GPGConfFixTests.h	Tue Jul 31 21:45:20 2018 +0200
     3.3 @@ -24,6 +24,13 @@
     3.4          void check_conf_fix_broken_conf_old_db_4();
     3.5          void check_conf_fix_broken_conf_old_db_5();
     3.6          void check_conf_fix_broken_conf_old_db_6();        
     3.7 +        void check_conf_fix_broken_agent_conf_old_db_0();
     3.8 +        void check_conf_fix_broken_agent_conf_old_db_1();
     3.9 +        void check_conf_fix_broken_agent_conf_old_db_2();
    3.10 +        void check_conf_fix_broken_agent_conf_old_db_3();
    3.11 +        void check_conf_fix_broken_agent_conf_old_db_4();
    3.12 +        void check_conf_fix_broken_agent_conf_old_db_5();
    3.13 +        void check_conf_fix_broken_agent_conf_old_db_6();                
    3.14  };
    3.15  
    3.16  #endif
     4.1 --- a/test/src/EngineTestSuite.cc	Mon Jul 30 19:38:45 2018 +0200
     4.2 +++ b/test/src/EngineTestSuite.cc	Tue Jul 31 21:45:20 2018 +0200
     4.3 @@ -73,7 +73,7 @@
     4.4      success = system("gpgconf --kill all");
     4.5      if (success != 0)
     4.6          throw std::runtime_error("SETUP: Error when executing 'gpgconf --kill all'.");
     4.7 -    sleep(1); // hopefully enough time for the system to recognise that it is dead. *sigh*    
     4.8 + //   sleep(1); // hopefully enough time for the system to recognise that it is dead. *sigh*    
     4.9  
    4.10      if (stat(test_home.c_str(), &dirchk) == 0) {
    4.11          if (!S_ISDIR(dirchk.st_mode))
    4.12 @@ -197,4 +197,4 @@
    4.13  
    4.14  void EngineTestSuite::set_my_name() {
    4.15      my_name = typeid(*this).name();
    4.16 -}
    4.17 \ No newline at end of file
    4.18 +}
     5.1 --- a/test/src/engine_tests/GPGConfFixTests.cc	Mon Jul 30 19:38:45 2018 +0200
     5.2 +++ b/test/src/engine_tests/GPGConfFixTests.cc	Tue Jul 31 21:45:20 2018 +0200
     5.3 @@ -29,6 +29,21 @@
     5.4                                                                        static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_conf_old_db_5)));
     5.5      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_conf_old_db_6"),
     5.6                                                                        static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_conf_old_db_6)));                                                                      
     5.7 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_0"),
     5.8 +                                                                      static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_0)));
     5.9 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_1"),
    5.10 +                                                                      static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_1)));
    5.11 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_2"),
    5.12 +                                                                      static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_2)));
    5.13 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_3"),
    5.14 +                                                                      static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_3)));
    5.15 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_4"),
    5.16 +                                                                      static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_4)));
    5.17 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_5"),
    5.18 +                                                                      static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_5)));
    5.19 +    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_6"),
    5.20 +                                                                      static_cast<Func>(&GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_6)));                                                                      
    5.21 +                                                                      
    5.22  }
    5.23  
    5.24  void GPGConfFixTests::setup() {
    5.25 @@ -115,3 +130,38 @@
    5.26      TEST_ASSERT(file_bytes_equal("test_files/427_fixed_gpg_conf_6", (temp_test_home + "/.gnupg/gpg.conf").c_str()));    
    5.27  }
    5.28  
    5.29 +void GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_0() {
    5.30 +    set_full_env(NULL, "test_files/450_bad_gpgagent_conf_0", "test_files/427_old_db");
    5.31 +    TEST_ASSERT(file_bytes_equal("test_files/450_good_gpgagent_conf_0", (temp_test_home + "/.gnupg/gpg-agent.conf").c_str()));
    5.32 +}
    5.33 +
    5.34 +void GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_1() {
    5.35 +    set_full_env(NULL, "test_files/450_bad_gpgagent_conf_1", "test_files/427_old_db");    
    5.36 +    TEST_ASSERT(file_bytes_equal("test_files/450_good_gpgagent_conf_1", (temp_test_home + "/.gnupg/gpg-agent.conf").c_str()));
    5.37 +    
    5.38 +}
    5.39 +
    5.40 +void GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_2() {
    5.41 +    set_full_env(NULL, "test_files/450_bad_gpgagent_conf_2", "test_files/427_old_db");        
    5.42 +    TEST_ASSERT(file_bytes_equal("test_files/450_good_gpgagent_conf_2", (temp_test_home + "/.gnupg/gpg-agent.conf").c_str()));    
    5.43 +}
    5.44 +
    5.45 +void GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_3() {
    5.46 +    set_full_env(NULL, "test_files/450_bad_gpgagent_conf_3", "test_files/427_old_db");    
    5.47 +    TEST_ASSERT(file_bytes_equal("test_files/450_good_gpgagent_conf_3", (temp_test_home + "/.gnupg/gpg-agent.conf").c_str()));    
    5.48 +}
    5.49 +
    5.50 +void GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_4() {
    5.51 +    set_full_env(NULL, "test_files/450_bad_gpgagent_conf_4", "test_files/427_old_db");        
    5.52 +    TEST_ASSERT(file_bytes_equal("test_files/450_good_gpgagent_conf_4", (temp_test_home + "/.gnupg/gpg-agent.conf").c_str()));    
    5.53 +}
    5.54 +
    5.55 +void GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_5() {
    5.56 +    set_full_env(NULL, "test_files/450_bad_gpgagent_conf_5", "test_files/427_old_db");        
    5.57 +    TEST_ASSERT(file_bytes_equal("test_files/450_good_gpgagent_conf_5", (temp_test_home + "/.gnupg/gpg-agent.conf").c_str()));    
    5.58 +}
    5.59 +
    5.60 +void GPGConfFixTests::check_conf_fix_broken_agent_conf_old_db_6() {
    5.61 +    set_full_env(NULL, "test_files/450_bad_gpgagent_conf_6", "test_files/427_old_db");        
    5.62 +    TEST_ASSERT(file_bytes_equal("test_files/450_good_gpgagent_conf_6", (temp_test_home + "/.gnupg/gpg-agent.conf").c_str()));    
    5.63 +}
     6.1 Binary file test/test_files/450.tgz has changed
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/test_files/450_bad_gpgagent_conf_0	Tue Jul 31 21:45:20 2018 +0200
     7.3 @@ -0,0 +1,3 @@
     7.4 +default-cache-ttl 398749
     7.5 +personal-cipher-preferences AES 
     7.6 +no-emit-version
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/test_files/450_bad_gpgagent_conf_1	Tue Jul 31 21:45:20 2018 +0200
     8.3 @@ -0,0 +1,6 @@
     8.4 +comment No Comment
     8.5 +keyid-format 0xlongmax-cache-ttl 300 
     8.6 +personal-cipher-preferences AES 
     8.7 +max-cache-ttl 500 
     8.8 +max-cache-ttl 2000 
     8.9 +allow-freeform-uid
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/test_files/450_bad_gpgagent_conf_2	Tue Jul 31 21:45:20 2018 +0200
     9.3 @@ -0,0 +1,6 @@
     9.4 +comment No Commentallow-freeform-uid
     9.5 +keyid-format 0xlongdefault-cache-ttl 1 
     9.6 +personal-cipher-preferences AES 
     9.7 +default_cache_ttl 1 
     9.8 +default_cache_ttl 1 
     9.9 +allow-freeform-uid
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/test_files/450_bad_gpgagent_conf_3	Tue Jul 31 21:45:20 2018 +0200
    10.3 @@ -0,0 +1,6 @@
    10.4 +comment No Commentallow-freeform-uidallow-freeform-uid
    10.5 +keyid-format 0xlongmax-cache-ttl 12 
    10.6 +personal-cipher-preferences AES 
    10.7 +max-cache-ttl 1 
    10.8 +max-cache-ttle 40000 
    10.9 +allow-freeform-uid
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/test/test_files/450_bad_gpgagent_conf_4	Tue Jul 31 21:45:20 2018 +0200
    11.3 @@ -0,0 +1,6 @@
    11.4 +comment No Commentallow-freeform-uidcert-digest-algo SHA256 default-cache-ttl 2000000-buttsallow-freeform-uid
    11.5 +keyid-format 0xlongdefault-cache-ttl 2000000 
    11.6 +personal-cipher-preferences AES 
    11.7 +default-cache-ttl 2000000 
    11.8 +default-cache-ttl 2000000 
    11.9 +allow-freeform-uid
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/test/test_files/450_bad_gpgagent_conf_5	Tue Jul 31 21:45:20 2018 +0200
    12.3 @@ -0,0 +1,6 @@
    12.4 +comment No Commentmax-cache-ttl 2000000max-cache-ttl 2000000max-cache-ttl 2000000
    12.5 +keyid-format 0xlongdefault-cache-ttl 2000000 
    12.6 +personal-cipher-preferences AES 
    12.7 +default-cache-ttl 2000000 
    12.8 +default-cache-ttl 2000000 
    12.9 +max-cache-ttl 2000000
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/test_files/450_bad_gpgagent_conf_6	Tue Jul 31 21:45:20 2018 +0200
    13.3 @@ -0,0 +1,2 @@
    13.4 +max-cache-ttl 2000000max-cache-ttl 2000000max-cache-ttl 2000000
    13.5 +max-cache-ttl 2000000
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/test_files/450_good_gpgagent_conf_0	Tue Jul 31 21:45:20 2018 +0200
    14.3 @@ -0,0 +1,4 @@
    14.4 +default-cache-ttl 398749
    14.5 +personal-cipher-preferences AES 
    14.6 +no-emit-version
    14.7 +max-cache-ttl 1200
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/test_files/450_good_gpgagent_conf_1	Tue Jul 31 21:45:20 2018 +0200
    15.3 @@ -0,0 +1,6 @@
    15.4 +comment No Comment
    15.5 +keyid-format 0xlong
    15.6 +max-cache-ttl 300 
    15.7 +personal-cipher-preferences AES 
    15.8 +allow-freeform-uid
    15.9 +default-cache-ttl 300
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/test_files/450_good_gpgagent_conf_2	Tue Jul 31 21:45:20 2018 +0200
    16.3 @@ -0,0 +1,8 @@
    16.4 +comment No Commentallow-freeform-uid
    16.5 +keyid-format 0xlong
    16.6 +default-cache-ttl 1 
    16.7 +personal-cipher-preferences AES 
    16.8 +default_cache_ttl 1 
    16.9 +default_cache_ttl 1 
   16.10 +allow-freeform-uid
   16.11 +max-cache-ttl 1200
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/test_files/450_good_gpgagent_conf_3	Tue Jul 31 21:45:20 2018 +0200
    17.3 @@ -0,0 +1,6 @@
    17.4 +comment No Commentallow-freeform-uidallow-freeform-uid
    17.5 +keyid-format 0xlong
    17.6 +max-cache-ttl 12 
    17.7 +personal-cipher-preferences AES 
    17.8 +allow-freeform-uid
    17.9 +default-cache-ttl 300
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/test/test_files/450_good_gpgagent_conf_4	Tue Jul 31 21:45:20 2018 +0200
    18.3 @@ -0,0 +1,6 @@
    18.4 +comment No Commentallow-freeform-uidcert-digest-algo SHA256
    18.5 +default-cache-ttl 2000000-buttsallow-freeform-uid
    18.6 +keyid-format 0xlong
    18.7 +personal-cipher-preferences AES 
    18.8 +allow-freeform-uid
    18.9 +max-cache-ttl 1200
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/test/test_files/450_good_gpgagent_conf_5	Tue Jul 31 21:45:20 2018 +0200
    19.3 @@ -0,0 +1,5 @@
    19.4 +comment No Comment
    19.5 +max-cache-ttl 2000000
    19.6 +keyid-format 0xlong
    19.7 +default-cache-ttl 2000000 
    19.8 +personal-cipher-preferences AES 
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/test/test_files/450_good_gpgagent_conf_6	Tue Jul 31 21:45:20 2018 +0200
    20.3 @@ -0,0 +1,2 @@
    20.4 +max-cache-ttl 2000000
    20.5 +default-cache-ttl 300