ENGINE-495: Stopped key_mistrust (which had changed only in this branch) from trying to revoke non-own keys sync
authorKrista Bennett <krista@pep-project.org>
Tue, 04 Dec 2018 14:29:28 +0100
branchsync
changeset 317113355e5d4756
parent 3169 86b78a45d1e9
child 3172 8178a8ad33b2
child 3173 88f03ce7a761
ENGINE-495: Stopped key_mistrust (which had changed only in this branch) from trying to revoke non-own keys
src/keymanagement.c
test/include/LeastCommonDenomColorTests.h
test/src/engine_tests/LeastCommonDenomColorTests.cc
     1.1 --- a/src/keymanagement.c	Mon Dec 03 12:26:02 2018 +0100
     1.2 +++ b/src/keymanagement.c	Tue Dec 04 14:29:28 2018 +0100
     1.3 @@ -1228,12 +1228,22 @@
     1.4  
     1.5      if (!(session && ident && ident->fpr))
     1.6          return PEP_ILLEGAL_VALUE;
     1.7 -            
     1.8 -        // See if key is revoked already
     1.9 +
    1.10 +    bool has_private = false;
    1.11 +    
    1.12 +    status = contains_priv_key(session, ident->fpr, &has_private);        
    1.13 +
    1.14 +    if (status != PEP_STATUS_OK && status != PEP_KEY_NOT_FOUND)
    1.15 +        return status;
    1.16 +        
    1.17 +    // See if key is revoked already
    1.18 +    if (has_private) {
    1.19          bool revoked = false;
    1.20          status = key_revoked(session, ident->fpr, &revoked);
    1.21 +
    1.22          if (!revoked)
    1.23              revoke_key(session, ident->fpr, NULL);
    1.24 +    }            
    1.25              
    1.26      // double-check to be sure key is even in the DB
    1.27      if (ident->fpr)
     2.1 --- a/test/include/LeastCommonDenomColorTests.h	Mon Dec 03 12:26:02 2018 +0100
     2.2 +++ b/test/include/LeastCommonDenomColorTests.h	Tue Dec 04 14:29:28 2018 +0100
     2.3 @@ -5,11 +5,11 @@
     2.4  #define LEAST_COMMON_DENOM_COLOR_H
     2.5  
     2.6  #include <string>
     2.7 -#include "EngineTestSessionSuite.h"
     2.8 +#include "EngineTestIndividualSuite.h"
     2.9  
    2.10  using namespace std;
    2.11  
    2.12 -class LeastCommonDenomColorTests : public EngineTestSessionSuite {
    2.13 +class LeastCommonDenomColorTests : public EngineTestIndividualSuite {
    2.14      public:
    2.15          LeastCommonDenomColorTests(string test_suite, string test_home_dir);
    2.16      private:
     3.1 --- a/test/src/engine_tests/LeastCommonDenomColorTests.cc	Mon Dec 03 12:26:02 2018 +0100
     3.2 +++ b/test/src/engine_tests/LeastCommonDenomColorTests.cc	Tue Dec 04 14:29:28 2018 +0100
     3.3 @@ -14,13 +14,13 @@
     3.4  #include "test_util.h"
     3.5  
     3.6  #include <cpptest.h>
     3.7 -#include "EngineTestSessionSuite.h"
     3.8 +#include "EngineTestIndividualSuite.h"
     3.9  #include "LeastCommonDenomColorTests.h"
    3.10  
    3.11  using namespace std;
    3.12  
    3.13  LeastCommonDenomColorTests::LeastCommonDenomColorTests(string suitename, string test_home_dir) :
    3.14 -    EngineTestSessionSuite::EngineTestSessionSuite(suitename, test_home_dir) {
    3.15 +    EngineTestIndividualSuite::EngineTestIndividualSuite(suitename, test_home_dir) {
    3.16      add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("LeastCommonDenomColorTests::check_least_common_denom_color"),
    3.17                                                                        static_cast<Func>(&LeastCommonDenomColorTests::check_least_common_denom_color)));
    3.18  }