blacklist: outgoing_message_rating() will show no color if PGP comm partner and blacklisted key
authorVolker Birk <vb@pep.foundation>
Thu, 11 Oct 2018 13:01:56 +0200
changeset 3043c4741d6d66f4
parent 2806 d958333b87d0
child 3044 630d505b8a0b
blacklist: outgoing_message_rating() will show no color if PGP comm partner and blacklisted key
src/message_api.c
test/src/engine_tests/BlacklistTests.cc
     1.1 --- a/src/message_api.c	Wed Aug 08 10:44:18 2018 +0200
     1.2 +++ b/src/message_api.c	Thu Oct 11 13:01:56 2018 +0200
     1.3 @@ -3550,6 +3550,8 @@
     1.4                                                true);
     1.5                      if (status != PEP_STATUS_OK || il->ident->fpr == NULL) {
     1.6                          il->ident->comm_type = PEP_ct_key_not_found;
     1.7 +                        if (*max_comm_type > PEP_ct_no_encryption)
     1.8 +                            *max_comm_type = PEP_ct_no_encryption;
     1.9                      }
    1.10                  }    
    1.11              }
     2.1 --- a/test/src/engine_tests/BlacklistTests.cc	Wed Aug 08 10:44:18 2018 +0200
     2.2 +++ b/test/src/engine_tests/BlacklistTests.cc	Thu Oct 11 13:01:56 2018 +0200
     2.3 @@ -143,6 +143,25 @@
     2.4               << "Expected it to be empty or (possibly) " << bl_fpr_2 << endl;
     2.5      TEST_ASSERT_MSG((!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)), "!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)");
     2.6  
     2.7 +    pEp_identity *me = new_identity("alice@peptest.ch", NULL, "423", "Alice Miller");
     2.8 +    assert(me);
     2.9 +    PEP_STATUS status24 = myself(session, me);
    2.10 +    TEST_ASSERT_MSG((status24 == PEP_STATUS_OK), "myself: status24 == PEP_STATUS_OK");
    2.11 +
    2.12 +    message *msg23 = new_message(PEP_dir_outgoing);
    2.13 +    assert(msg23);
    2.14 +    msg23->from = me;
    2.15 +    msg23->to = new_identity_list(identity_dup(blacklisted_identity));
    2.16 +    assert(msg23->to && msg23->to->ident);
    2.17 +    PEP_rating rating23;
    2.18 +
    2.19 +    cout << "testing outgoing_message_rating() with blacklisted key in to\n";
    2.20 +    PEP_STATUS status23 = outgoing_message_rating(session, msg23, &rating23);
    2.21 +    TEST_ASSERT_MSG((status23 == PEP_STATUS_OK), "outgoing_message_rating: status must be PEP_STATUS_OK");
    2.22 +    TEST_ASSERT_MSG((rating23 == PEP_rating_unencrypted), "outgoing_message_rating: rating must be PEP_rating_unencrypted");
    2.23 +
    2.24 +    free_message(msg23);
    2.25 +
    2.26      const string keytext2 = slurp("blacklisted_pub2.asc");
    2.27      PEP_STATUS status14 = import_key(session, keytext2.c_str(), keytext2.length(), NULL);
    2.28