ENGINE-847: fixed both test consequences of making messages signed by non-default-key-fprs unreliable as well as bugs in the code which didn't enforce that principle (mainly due to our previous lack of separation between sender and signer fprs in some places for pEp mails)

ENGINE-847
Krista Bennett 2 years ago
parent 21b3cb13f3
commit bcbee6d62d

@ -3931,6 +3931,38 @@ static PEP_STATUS pEp_version_upgrade_or_ignore(
return status;
}
/**
* @internal
*
* @param msg
* @param keylist
* @return
*
* @note Presupposes you've updated the msg->from identity somewhere so it contains the ident default.
*/
static bool sender_fpr_is_signer_fpr(message* msg, stringlist_t* keylist) {
if (!msg || EMPTYSTR(msg->_sender_fpr) || !keylist || EMPTYSTR(keylist->value))
return false;
return (strcmp(msg->_sender_fpr, keylist->value) == 0);
}
/**
* @internal
*
* @param msg
* @return
*
* @note Presupposes you've updated the msg->from identity somewhere so it contains the ident default.
*/
static bool sender_fpr_is_from_default(message* msg) {
if (!msg || !msg->from || EMPTYSTR(msg->from->fpr) || EMPTYSTR(msg->_sender_fpr))
return false;
return (strcmp(msg->from->fpr, msg->_sender_fpr) == 0);
}
/**
* @internal
*
@ -3938,78 +3970,65 @@ static PEP_STATUS pEp_version_upgrade_or_ignore(
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] *sender pEp_identity
* @param[in] *keylist stringlist_t
* @param[in] major unsignedint
* @param[in] minor unsignedint
* @param[in] session session handle
* @param[in] msg the message we're doing this from
* @param[in] keylist keylist containing signer during decrypt/verify
* @param[in] major unsigned int
* @param[in] minor unsigned int
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval PEP_CANNOT_SET_TRUST
* @retval any other value on error
*
* @note Only use on messages that were decrypted; unencrypted messages have a different path.
*/
static PEP_STATUS update_sender_to_pEp_trust(
PEP_SESSION session,
pEp_identity* sender,
message* msg,
stringlist_t* keylist,
unsigned int major,
unsigned int minor)
{
assert(session);
assert(sender);
assert(keylist && !EMPTYSTR(keylist->value));
assert(msg);
if (!session || !sender || !keylist || EMPTYSTR(keylist->value))
if (!session || !msg || !keylist)
return PEP_ILLEGAL_VALUE;
free(sender->fpr);
sender->fpr = NULL;
if (!msg->from)
return PEP_STATUS_OK;
pEp_identity* sender = msg->from;
PEP_STATUS status = is_me(session, sender) ? _myself(session, sender, false, false, false, true) : update_identity(session, sender);
if (PASS_ERROR(status))
return status;
if (EMPTYSTR(sender->fpr) || strcmp(sender->fpr, keylist->value) != 0) {
free(sender->fpr);
sender->fpr = strdup(keylist->value);
if (!sender->fpr)
return PEP_OUT_OF_MEMORY;
status = set_pgp_keypair(session, sender->fpr);
if (status != PEP_STATUS_OK)
return status;
status = get_trust(session, sender);
if (status == PEP_CANNOT_FIND_IDENTITY || sender->comm_type == PEP_ct_unknown) {
PEP_comm_type ct = PEP_ct_unknown;
status = get_key_rating(session, sender->fpr, &ct);
if (status != PEP_STATUS_OK)
return status;
sender->comm_type = ct;
}
}
// Could be done elegantly, but we do this explicitly here for readability.
// This file's code is difficult enough to parse. But change at will.
switch (sender->comm_type) {
// Ok, identity is updated.
// Now, let's find out if the sender_fpr on this message is the signer and if it is the sender default. If so, we can do this.
// If not? forget it.
if (!sender_fpr_is_signer_fpr(msg, keylist) || !sender_fpr_is_from_default(msg))
return PEP_STATUS_OK; // We don't return an error here because failing to satisfy the conditions isn't an error here, it's just a no-op.
switch (sender->comm_type) {
case PEP_ct_OpenPGP_unconfirmed:
case PEP_ct_OpenPGP:
sender->comm_type = PEP_ct_pEp_unconfirmed | (sender->comm_type & PEP_ct_confirmed);
status = set_trust(session, sender);
if (status != PEP_STATUS_OK)
break;
// Fallthrough EXPLICIT here
case PEP_ct_pEp:
case PEP_ct_pEp_unconfirmed:
// set version
if (major == 0) {
major = 2;
minor = 0;
minor = 1;
}
status = pEp_version_upgrade_or_ignore(session, sender, major, minor);
status = pEp_version_upgrade_or_ignore(session, sender, major, minor);
break;
default:
status = PEP_CANNOT_SET_TRUST;
@ -5420,16 +5439,27 @@ static PEP_STATUS _decrypt_message(
*rating = decrypt_rating(decrypt_status);
// Ok, so if it was signed and it's all verified, we can update
// eligible signer comm_types to PEP_ct_pEp_*
// This also sets and upgrades pEp version
if (decrypt_status == PEP_DECRYPTED_AND_VERIFIED && !is_deprecated_key_reset && is_pEp_msg && calculated_src->from)
status = update_sender_to_pEp_trust(session, msg->from, _keylist, major_ver, minor_ver);
// Now, if:
// 1. Message was signed and verified,
// 2. Message was signed with from user's *default* key (which may
// have been set above, and
// 3. This is a pEp message,
// We can upgrade the user to being a pEp user. But we should actually check if this is necessary to begin
// with.
// Checks on fpr viability are done in the update_sender_to_pEp_trust function now.
if (msg && decrypt_status == PEP_DECRYPTED_AND_VERIFIED && !is_deprecated_key_reset && !EMPTYSTR(msg->_sender_fpr)) {
if (is_pEp_msg && msg->from && !EMPTYSTR(msg->from->user_id)) {
bool pEp_peep = false;
status = is_pEp_user(session, msg->from, &pEp_peep);
if (status == PEP_STATUS_OK && !pEp_peep)
status = update_sender_to_pEp_trust(session, msg, _keylist, major_ver, minor_ver);
}
}
/* Ok, now we have a keylist used for decryption/verification.
now we need to update the message rating with the
sender and recipients in mind */
if (!is_deprecated_key_reset) { // key reset messages invalidate some of the ratings in the DB by now.
status = amend_rating_according_to_sender_and_recipients(session,
rating, msg->from, _keylist);

@ -152,8 +152,6 @@ TEST_F(DecryptAttachPrivateKeyUntrustedTest, check_decrypt_attach_private_key_un
output_stream << "Reading in message..." << endl;
output_stream << "Reading in message..." << endl;
message* encoded_text = slurp_message_file_into_struct("test_mails/priv_key_attach.eml");
output_stream << "Starting test..." << endl;

@ -948,7 +948,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_bob_1_0_two_keys) {
// Case 0: We already have a default key. Make sure we don't step on it.
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_bob_noclobber_no_pEp) {
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_channel_bob_noclobber_no_pEp) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -964,7 +964,7 @@ TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_bob_noclobber
check_sender_default_key_status(sender_info2, PEP_ct_OpenPGP_unconfirmed);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_bob_noclobber_2_2) {
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_channel_bob_noclobber_2_2) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -973,62 +973,22 @@ TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_bob_noclobber
force_sender_default_to_be_set(TestUtilsPreset::BOB2, false);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_2.eml",
PEP_rating_reliable, PEP_STATUS_OK);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp_unconfirmed);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_bob_noclobber_2_1) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
set_up_and_check_initial_identities(TestUtilsPreset::BOB, sender_info);
force_sender_default_to_be_set(TestUtilsPreset::BOB2, false);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_1.eml",
PEP_rating_reliable, PEP_STATUS_OK);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp_unconfirmed);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_bob_noclobber_2_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
set_up_and_check_initial_identities(TestUtilsPreset::BOB, sender_info);
force_sender_default_to_be_set(TestUtilsPreset::BOB2, false);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_0.eml",
PEP_rating_reliable, PEP_STATUS_OK);
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAliceUnencrypted.eml",
PEP_rating_unencrypted, PEP_UNENCRYPTED);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp_unconfirmed);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_reliable_bob_noclobber_1_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
// FOR THE ENCRYPTED NO_CLOBBER TESTS:
// We expect this to be unreliable now as of ENGINE-847, because the imported key on decryption is NOT associated with Bob;
// he already has a default, and this ain't it, and we have no sense of "key claim" with OpenPGP.
// Also note that the ONLY place the key attached to this message will be present at ALL is in the keys.db - we don't
// even put it into the pgp_keypair list. So as far as pEp itself is concerned, that key doesn't exist until the
// user tells us it does.
set_up_and_check_initial_identities(TestUtilsPreset::BOB, sender_info);
force_sender_default_to_be_set(TestUtilsPreset::BOB2, false);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_1_0.eml",
PEP_rating_reliable, PEP_STATUS_OK);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp_unconfirmed);
}
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_no_pep) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_channel_bob_noclobber_no_pep) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1038,14 +998,14 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_n
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_1_0_wrong_key_filename_no_pEp.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
check_sender_default_key_status(sender_info2, PEP_ct_OpenPGP_unconfirmed);
}
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2_2) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_channel_bob_noclobber_2_2) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1055,7 +1015,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_2.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
@ -1063,7 +1023,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2
}
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2_1) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_channel_bob_noclobber_2_1) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1073,7 +1033,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_1.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
@ -1081,7 +1041,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2
}
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2_0) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_channel_bob_noclobber_2_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1091,7 +1051,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_0.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
@ -1100,7 +1060,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_2
}
// We use the "wrong" filename version on purpose to ensure we aren't relying on 2.2 changes
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_1_0) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_channel_bob_noclobber_1_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1110,7 +1070,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_1
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_1_0_wrong_key_filename_ModifiedVersion.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
@ -1118,7 +1078,9 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_reliable_bob_noclobber_1
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_bob_noclobber_no_pEp) {
////////////////////////////
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_channel_bob_noclobber_no_pEp) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1135,7 +1097,7 @@ TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_bob_noclobber_
check_sender_default_key_status(sender_info2, PEP_ct_OpenPGP);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_bob_noclobber_2_2) {
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_channel_bob_noclobber_2_2) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1144,62 +1106,15 @@ TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_bob_noclobber_
force_sender_default_to_be_set(TestUtilsPreset::BOB2, true);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_2.eml",
PEP_rating_reliable, PEP_STATUS_OK);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_bob_noclobber_2_1) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
set_up_and_check_initial_identities(TestUtilsPreset::BOB, sender_info);
force_sender_default_to_be_set(TestUtilsPreset::BOB2, true);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_1.eml",
PEP_rating_reliable, PEP_STATUS_OK);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_bob_noclobber_2_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
set_up_and_check_initial_identities(TestUtilsPreset::BOB, sender_info);
force_sender_default_to_be_set(TestUtilsPreset::BOB2, true);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_0.eml",
PEP_rating_reliable, PEP_STATUS_OK);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp);
}
TEST_F(DefaultFromEmailTest, check_unencrypted_key_import_trusted_bob_noclobber_1_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
set_up_and_check_initial_identities(TestUtilsPreset::BOB, sender_info);
force_sender_default_to_be_set(TestUtilsPreset::BOB2, true);
// Ok, we now have a blank slate. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_1_0.eml",
PEP_rating_reliable, PEP_STATUS_OK);
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAliceUnencrypted.eml",
PEP_rating_unencrypted, PEP_UNENCRYPTED);
// Make sure import didn't overwrite default
check_sender_default_key_status(sender_info2, PEP_ct_pEp);
}
//////////////////////////
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_no_pep) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_channel_bob_noclobber_no_pep) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1208,15 +1123,20 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_no
force_sender_default_to_be_set(TestUtilsPreset::BOB2, true);
// Ok, we now the desired state. Run the import mail fun.
// N.B.: We expect this to be unreliable now as of ENGINE-847, because the imported key on decryption is NOT associated with Bob;
// he already has a default, and this ain't it, and we have no sense of "key claim" with OpenPGP.
// Also note that the ONLY place the key attached to this message will be present at ALL is in the keys.db - we don't
// even put it into the pgp_keypair list. So as far as pEp itself is concerned, that key doesn't exist until the
// user tells us it does.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_1_0_wrong_key_filename_no_pEp.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
check_sender_default_key_status(sender_info2, PEP_ct_OpenPGP);
}
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_2) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_channel_bob_noclobber_2_2) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1225,8 +1145,11 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_
force_sender_default_to_be_set(TestUtilsPreset::BOB2, true);
// Ok, we now the desired state. Run the import mail fun.
// NOTE: This behaves differently from the "no_pep" cases for one very important reason - in setting
// the user as a pEp user during the setup above, we actually set the initial imported key as a default before
// changing it in the previous line.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_2.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
@ -1234,7 +1157,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_
}
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_1) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_channel_bob_noclobber_2_1) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1244,7 +1167,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_1.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
@ -1252,7 +1175,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_
}
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_0) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_channel_bob_noclobber_2_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1262,7 +1185,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_2_0.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.
@ -1271,7 +1194,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_2_
}
// We use the "wrong" filename version on purpose to ensure we aren't relying on 2.2 changes
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_1_0) {
TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_channel_bob_noclobber_1_0) {
const TestUtilsPreset::IdentityInfo& sender_info = TestUtilsPreset::presets[TestUtilsPreset::BOB];
const TestUtilsPreset::IdentityInfo& sender_info2 = TestUtilsPreset::presets[TestUtilsPreset::BOB2];
@ -1281,7 +1204,7 @@ TEST_F(DefaultFromEmailTest, check_encrypted_key_import_trusted_bob_noclobber_1_
// Ok, we now the desired state. Run the import mail fun.
read_decrypt_check_incoming_mail("test_mails/CanonicalFrom2.2BobToAlice_1_0_wrong_key_filename_ModifiedVersion.eml",
PEP_rating_reliable, PEP_STATUS_OK);
PEP_rating_unreliable, PEP_STATUS_OK);
// Check that the default key matches the canonical default key for this sender,
// if expected to be present.

Loading…
Cancel
Save