@ -1,166 +0,0 @@ | |||
/** @file */ | |||
/** @brief File description for doxygen missing. FIXME */ | |||
// This file is under GNU General Public License 3.0 | |||
// see LICENSE.txt | |||
#include "pEp_internal.h" | |||
#include "blacklist.h" | |||
DYNAMIC_API PEP_STATUS blacklist_add(PEP_SESSION session, const char *fpr) | |||
{ | |||
PEP_STATUS status = PEP_STATUS_OK; | |||
assert(session && fpr && fpr[0]); | |||
if (!(session && fpr && fpr[0])) | |||
return PEP_ILLEGAL_VALUE; | |||
sqlite3_exec(session->db, "BEGIN ;", NULL, NULL, NULL); | |||
sqlite3_reset(session->blacklist_add); | |||
sqlite3_bind_text(session->blacklist_add, 1, fpr, -1, SQLITE_STATIC); | |||
int result; | |||
result = sqlite3_step(session->blacklist_add); | |||
switch (result) { | |||
case SQLITE_DONE: | |||
status = PEP_STATUS_OK; | |||
sqlite3_exec(session->db, "COMMIT ;", NULL, NULL, NULL); | |||
break; | |||
default: | |||
sqlite3_exec(session->db, "ROLLBACK ;", NULL, NULL, NULL); | |||
status = PEP_UNKNOWN_ERROR; | |||
} | |||
sqlite3_reset(session->blacklist_add); | |||
return status; | |||
} | |||
DYNAMIC_API PEP_STATUS blacklist_delete(PEP_SESSION session, const char *fpr) | |||
{ | |||
PEP_STATUS status = PEP_STATUS_OK; | |||
assert(session && fpr && fpr[0]); | |||
if (!(session && fpr && fpr[0])) | |||
return PEP_ILLEGAL_VALUE; | |||
sqlite3_reset(session->blacklist_delete); | |||
sqlite3_bind_text(session->blacklist_delete, 1, fpr, -1, SQLITE_STATIC); | |||
int result; | |||
result = sqlite3_step(session->blacklist_delete); | |||
switch (result) { | |||
case SQLITE_DONE: | |||
status = PEP_STATUS_OK; | |||
break; | |||
default: | |||
status = PEP_UNKNOWN_ERROR; | |||
} | |||
sqlite3_reset(session->blacklist_delete); | |||
return status; | |||
} | |||
DYNAMIC_API PEP_STATUS blacklist_is_listed( | |||
PEP_SESSION session, | |||
const char *fpr, | |||
bool *listed | |||
) | |||
{ | |||
PEP_STATUS status = PEP_STATUS_OK; | |||
int count; | |||
assert(session && fpr && fpr[0] && listed); | |||
if (!(session && fpr && fpr[0] && listed)) | |||
return PEP_ILLEGAL_VALUE; | |||
*listed = false; | |||
sqlite3_reset(session->blacklist_is_listed); | |||
sqlite3_bind_text(session->blacklist_is_listed, 1, fpr, -1, SQLITE_STATIC); | |||
int result; | |||
result = sqlite3_step(session->blacklist_is_listed); | |||
switch (result) { | |||
case SQLITE_ROW: | |||
count = sqlite3_column_int(session->blacklist_is_listed, 0); | |||
*listed = count > 0; | |||
status = PEP_STATUS_OK; | |||
break; | |||
default: | |||
status = PEP_UNKNOWN_ERROR; | |||
} | |||
sqlite3_reset(session->blacklist_is_listed); | |||
return status; | |||
} | |||
DYNAMIC_API PEP_STATUS blacklist_retrieve( | |||
PEP_SESSION session, | |||
stringlist_t **blacklist | |||
) | |||
{ | |||
PEP_STATUS status = PEP_STATUS_OK; | |||
assert(session); | |||
assert(blacklist); | |||
if (!(session && blacklist)) | |||
return PEP_ILLEGAL_VALUE; | |||
*blacklist = NULL; | |||
stringlist_t *_blacklist = new_stringlist(NULL); | |||
if (_blacklist == NULL) | |||
goto enomem; | |||
sqlite3_reset(session->blacklist_retrieve); | |||
int result; | |||
stringlist_t *_bl = _blacklist; | |||
do { | |||
result = sqlite3_step(session->blacklist_retrieve); | |||
switch (result) { | |||
case SQLITE_ROW: | |||
{ | |||
const char *fpr = (const char *) sqlite3_column_text(session->blacklist_retrieve, 0); | |||
_bl = stringlist_add(_bl, fpr); | |||
if (_bl == NULL) | |||
goto enomem; | |||
break; | |||
} | |||
case SQLITE_DONE: | |||
break; | |||
default: | |||
status = PEP_UNKNOWN_ERROR; | |||
result = SQLITE_DONE; | |||
} | |||
} while (result != SQLITE_DONE); | |||
sqlite3_reset(session->blacklist_retrieve); | |||
if (status == PEP_STATUS_OK) | |||
*blacklist = _blacklist; | |||
else | |||
free_stringlist(_blacklist); | |||
goto the_end; | |||
enomem: | |||
free_stringlist(_blacklist); | |||
status = PEP_OUT_OF_MEMORY; | |||
the_end: | |||
return status; | |||
} |
@ -1,107 +0,0 @@ | |||
/** | |||
* @file blacklist.h | |||
* @brief Functions for maintaining a key blacklist for OpenPGP keys | |||
* (i.e. keys received from OpenPGP partners). This is currently | |||
* used by users when an OpenPGP partner has indicated that they | |||
* do not want us to use a particular key we may have for them. | |||
* This is marked as deprecated because we want users to use | |||
* key reset instead, and this code will be in fact removed | |||
* in Release 2.2.0 when key election is also removed. | |||
* | |||
* @deprecated These files are still in use as of Release 2.1 and will be removed with key election removal. | |||
* | |||
* @license GNU General Public License 3.0 - see LICENSE.txt | |||
*/ | |||
#ifndef BLACKLIST_H | |||
#define BLACKLIST_H | |||
#include "pEpEngine.h" | |||
#ifdef __cplusplus | |||
extern "C" { | |||
#endif | |||
/** | |||
* <!-- blacklist_add() --> | |||
* | |||
* @deprecated As of Release 2.2.0 | |||
* | |||
* @brief Add to blacklist | |||
* | |||
* @param[in] session session to use | |||
* @param[in] fpr fingerprint of key to blacklist | |||
* | |||
* @warning there is no point in blacklisting an own key; for any own | |||
* identity, this will be ignored. The correct function to use | |||
* for own keys in this event is "key_reset_trust". | |||
* Also, this is only effective for OpenPGP-level trust. If | |||
* this key is for a pEp user, the blacklist is ignored. | |||
* | |||
*/ | |||
DYNAMIC_API PEP_STATUS blacklist_add(PEP_SESSION session, const char *fpr); | |||
/** | |||
* <!-- blacklist_delete() --> | |||
* | |||
* @deprecated As of Release 2.2.0 | |||
* | |||
* @brief Delete from blacklist | |||
* | |||
* @param[in] session session to use | |||
* @param[in] fpr fingerprint of key to be removed from blacklist | |||
* | |||
* | |||
*/ | |||
DYNAMIC_API PEP_STATUS blacklist_delete(PEP_SESSION session, const char *fpr); | |||
/** | |||
* <!-- blacklist_is_listed() --> | |||
* | |||
* @deprecated As of Release 2.2.0 | |||
* | |||
* @brief Is listed in blacklist | |||
* | |||
* @param[in] session session to use | |||
* @param[in] fpr fingerprint of key to blacklist | |||
* @param[out] bool flags if key is blacklisted | |||
* | |||
* | |||
*/ | |||
DYNAMIC_API PEP_STATUS blacklist_is_listed( | |||
PEP_SESSION session, | |||
const char *fpr, | |||
bool *listed | |||
); | |||
/** | |||
* <!-- blacklist_retrieve() --> | |||
* | |||
* @deprecated As of Release 2.2.0 | |||
* | |||
* @brief Retrieve full blacklist of key fingerprints | |||
* | |||
* @param[in] session session to use | |||
* @param[out] blacklist copy of blacklist | |||
* | |||
* @ownership the ownership of the copy of blacklist goes to the caller | |||
* | |||
*/ | |||
DYNAMIC_API PEP_STATUS blacklist_retrieve( | |||
PEP_SESSION session, | |||
stringlist_t **blacklist | |||
); | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
#endif |
@ -1,180 +0,0 @@ | |||
// This file is under GNU General Public License 3.0 | |||
// see LICENSE.txt | |||
#include <stdlib.h> | |||
#include <string> | |||
#include <cstring> // for strcmp() | |||
#include "TestUtilities.h" | |||
#include "TestConstants.h" | |||
#include "pEpEngine.h" | |||
#include "pEp_internal.h" | |||
#include "blacklist.h" | |||
#include "keymanagement.h" | |||
#include "message_api.h" | |||
#include "mime.h" | |||
#include "Engine.h" | |||
#include <gtest/gtest.h> | |||
namespace { | |||
//The fixture for BlacklistAcceptNewKeyTest | |||
class BlacklistAcceptNewKeyTest : public ::testing::Test { | |||
public: | |||
Engine* engine; | |||
PEP_SESSION session; | |||
protected: | |||
// You can remove any or all of the following functions if its body | |||
// is empty. | |||
BlacklistAcceptNewKeyTest() { | |||
// You can do set-up work for each test here. | |||
test_suite_name = ::testing::UnitTest::GetInstance()->current_test_info()->GTEST_SUITE_SYM(); | |||
test_name = ::testing::UnitTest::GetInstance()->current_test_info()->name(); | |||
test_path = get_main_test_home_dir() + "/" + test_suite_name + "/" + test_name; | |||
} | |||
~BlacklistAcceptNewKeyTest() override { | |||
// You can do clean-up work that doesn't throw exceptions here. | |||
} | |||
// If the constructor and destructor are not enough for setting up | |||
// and cleaning up each test, you can define the following methods: | |||
void SetUp() override { | |||
// Code here will be called immediately after the constructor (right | |||
// before each test). | |||
// Leave this empty if there are no files to copy to the home directory path | |||
std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>(); | |||
// Get a new test Engine. | |||
engine = new Engine(test_path); | |||
ASSERT_NOTNULL(engine); | |||
// Ok, let's initialize test directories etc. | |||
engine->prep(NULL, NULL, NULL, init_files); | |||
// Ok, try to start this bugger. | |||
engine->start(); | |||
ASSERT_NOTNULL(engine->session); | |||
session = engine->session; | |||
// Engine is up. Keep on truckin' | |||
} | |||
void TearDown() override { | |||
// Code here will be called immediately after each test (right | |||
// before the destructor). | |||
engine->shut_down(); | |||
delete engine; | |||
engine = NULL; | |||
session = NULL; | |||
} | |||
private: | |||
const char* test_suite_name; | |||
const char* test_name; | |||
string test_path; | |||
// Objects declared here can be used by all tests in the BlacklistAcceptNewKeyTest suite. | |||
}; | |||
} // namespace | |||
TEST_F(BlacklistAcceptNewKeyTest, check_blacklist_accept_new_key) { | |||
PEP_STATUS status = PEP_STATUS_OK; | |||
// blacklist test code | |||
output_stream << "blacklist only key for identity / add key / check which key is used" << endl; | |||
// 2797 65A2 FEB5 B7C7 31B8 61D9 3E4C EFD9 F7AF 4684 - this is the blacklisted key in blacklisted_pub.asc | |||
/* read the key into memory */ | |||
const string keytext = slurp("test_keys/pub/blacklisted_pub.asc"); | |||
/* import it into pep */ | |||
status = import_key(session, keytext.c_str(), keytext.length(), NULL); | |||
ASSERT_EQ(status, PEP_KEY_IMPORTED); | |||
const char* bl_fpr_1 = "279765A2FEB5B7C731B861D93E4CEFD9F7AF4684"; | |||
bool is_blacklisted = false; | |||
pEp_identity* blacklisted_identity = new_identity("blacklistedkeys@kgrothoff.org", | |||
bl_fpr_1, | |||
"TOFU_blacklistedkeys@kgrothoff.org", | |||
"Blacklist Keypair"); | |||
// Explicitly set identity, since we need the key in there | |||
status = set_identity(session, blacklisted_identity); | |||
ASSERT_OK; | |||
status = update_identity(session, blacklisted_identity); | |||
ASSERT_OK; | |||
status = blacklist_add(session, bl_fpr_1); | |||
ASSERT_OK; | |||
status = blacklist_is_listed(session, bl_fpr_1, &is_blacklisted); | |||
ASSERT_OK; | |||
ASSERT_TRUE(is_blacklisted); | |||
// We should NOT return a blacklisted key here. | |||
// FIXME: for EB - what to do when unblacklisting? | |||
status = update_identity(session, blacklisted_identity); | |||
ASSERT_OK; | |||
ASSERT_STREQ(bl_fpr_1, blacklisted_identity->fpr); | |||
// post key election this should be obvious. | |||
bool id_def, us_def, addr_def; | |||
status = get_valid_pubkey(session, blacklisted_identity, | |||
&id_def, &us_def, &addr_def, true); | |||
ASSERT_EQ(status, PEP_KEY_BLACKLISTED); | |||
ASSERT_EQ(blacklisted_identity->comm_type , PEP_ct_key_not_found); | |||
if (!(blacklisted_identity->fpr)) | |||
output_stream << "OK! blacklisted_identity->fpr is empty. Yay!" << endl; | |||
else | |||
output_stream << "Not OK. blacklisted_identity->fpr is " << blacklisted_identity->fpr << "." << endl | |||
<< "Expected it to be empty." << endl; | |||
ASSERT_TRUE(EMPTYSTR(blacklisted_identity->fpr)); | |||
/* identity is blacklisted. Now let's read in a message which contains a new key for that ID. */ | |||
// This SHOULD work with key election removal! | |||
const char* new_key = "634FAC4417E9B2A5DC2BD4AAC4AEEBBE7E62701B"; | |||
const string mailtext = slurp("test_mails/blacklist_new_key_attached.eml"); | |||
pEp_identity * me1 = new_identity("blacklistedkeys@kgrothoff.org", new_key, "TOFU_blacklistedkeys@kgrothoff.org", "Blacklisted Key Message Recipient"); | |||
status = update_identity(session, me1); | |||
message* msg_ptr = nullptr; | |||
message* dest_msg = nullptr; | |||
stringlist_t* keylist = nullptr; | |||
PEP_rating rating; | |||
PEP_decrypt_flags_t flags = 0; | |||
status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL); | |||
ASSERT_OK; | |||
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags); | |||
// Key election is gone, but getting it via mail should set a default! | |||
status = update_identity(session, me1); | |||
ASSERT_STRCASEEQ(me1->fpr, new_key); | |||
status = blacklist_delete(session, bl_fpr_1); | |||
ASSERT_OK; | |||
// Key election removal note: THIS WILL NOT SET IT BACK TO THE OLD KEY AS A DEFAULT. YOU WOULD NEED TO RESET OR BLACKLIST THE NEW KEY AND | |||
// RESET/REIMPORT THE OLD KEY AS A DEFAULT. | |||
status = update_identity(session, blacklisted_identity); | |||
ASSERT_OK; | |||
free_message(msg_ptr); | |||
free_message(dest_msg); | |||
free_stringlist(keylist); | |||
} |
@ -1,265 +0,0 @@ | |||
// This file is under GNU General Public License 3.0 | |||
// see LICENSE.txt | |||
// #include <iostream> | |||
// #include <iostream> | |||
// #include <fstream> | |||
// #include <string> | |||
// #include <cstring> // for strcmp() | |||
// #include <TEST_ASSERT.h> | |||
// #include "blacklist.h" | |||
// #include "keymanagement.h" | |||
// #include "test_util.h" | |||
// | |||
// // This file is under GNU General Public License 3.0 | |||
// // see LICENSE.txt | |||
#include <stdlib.h> | |||
#include <string> | |||
#include <cstring> // for strcmp() | |||
#include <assert.h> | |||
#include "pEpEngine.h" | |||
#include "pEp_internal.h" | |||
#include "blacklist.h" | |||
#include "keymanagement.h" | |||
#include "TestUtilities.h" | |||
#include "TestConstants.h" | |||
#include "Engine.h" | |||
#include <gtest/gtest.h> | |||
namespace { | |||
//The fixture for BlacklistTest | |||
class BlacklistTest : public ::testing::Test { | |||
public: | |||
Engine* engine; | |||
PEP_SESSION session; | |||
protected: | |||
// You can remove any or all of the following functions if its body | |||
// is empty. | |||
BlacklistTest() { | |||
// You can do set-up work for each test here. | |||
test_suite_name = ::testing::UnitTest::GetInstance()->current_test_info()->GTEST_SUITE_SYM(); | |||
test_name = ::testing::UnitTest::GetInstance()->current_test_info()->name(); | |||
test_path = get_main_test_home_dir() + "/" + test_suite_name + "/" + test_name; | |||
} | |||
~BlacklistTest() override { | |||
// You can do clean-up work that doesn't throw exceptions here. | |||
} | |||
// If the constructor and destructor are not enough for setting up | |||
// and cleaning up each test, you can define the following methods: | |||
void SetUp() override { | |||
// Code here will be called immediately after the constructor (right | |||
// before each test). | |||
// Leave this empty if there are no files to copy to the home directory path | |||
std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>(); | |||
// Get a new test Engine. | |||
engine = new Engine(test_path); | |||
ASSERT_NOTNULL(engine); | |||
// Ok, let's initialize test directories etc. | |||
engine->prep(NULL, NULL, NULL, init_files); | |||
// Ok, try to start this bugger. | |||
engine->start(); | |||
ASSERT_NOTNULL(engine->session); | |||
session = engine->session; | |||
// Engine is up. Keep on truckin' | |||
} | |||
void TearDown() override { | |||
// Code here will be called immediately after each test (right | |||
// before the destructor). | |||
engine->shut_down(); | |||
delete engine; | |||
engine = NULL; | |||
session = NULL; | |||
} | |||
private: | |||
const char* test_suite_name; | |||
const char* test_name; | |||
string test_path; | |||
// Objects declared here can be used by all tests in the BlacklistTest suite. | |||
}; | |||
} // namespace | |||
TEST_F(BlacklistTest, check_blacklist) { | |||
// blacklist test code | |||
output_stream << "adding 23 to blacklist\n"; | |||
PEP_STATUS status2 = blacklist_add(session, "23"); | |||
ASSERT_EQ(status2 , PEP_STATUS_OK); | |||
output_stream << "added.\n"; | |||
bool listed; | |||
PEP_STATUS status3 = blacklist_is_listed(session, "23", &listed); | |||
ASSERT_EQ(status3 , PEP_STATUS_OK); | |||
ASSERT_TRUE(listed); | |||
output_stream << "23 is listed.\n"; | |||
stringlist_t *blacklist; | |||
PEP_STATUS status6 = blacklist_retrieve(session, &blacklist); | |||
ASSERT_EQ(status6 , PEP_STATUS_OK); | |||
ASSERT_NOTNULL(blacklist); | |||
bool in23 = false; | |||
output_stream << "the blacklist contains now: "; | |||
for (stringlist_t *bl = blacklist; bl && bl->value; bl = bl->next) { | |||
output_stream << bl->value << ", "; | |||
if (std::strcmp(bl->value, "23") == 0) | |||
in23 = true; | |||
} | |||
output_stream << "END\n"; | |||
ASSERT_TRUE(in23); | |||
free_stringlist(blacklist); | |||
output_stream << "deleting 23 from blacklist\n"; | |||
PEP_STATUS status4 = blacklist_delete(session, "23"); | |||
ASSERT_EQ(status4 , PEP_STATUS_OK); | |||
output_stream << "deleted.\n"; | |||
PEP_STATUS status5 = blacklist_is_listed(session, "23", &listed); | |||
ASSERT_EQ(status5 , PEP_STATUS_OK); | |||
ASSERT_TRUE(!listed); | |||
output_stream << "23 is not listed any more.\n"; | |||
output_stream << "blacklist only key for identity / unblacklist key / add key" << endl; | |||
// 2797 65A2 FEB5 B7C7 31B8 61D9 3E4C EFD9 F7AF 4684 - this is the blacklisted key in blacklisted_pub.asc | |||
const string keytext = slurp("test_keys/pub/blacklisted_pub.asc"); | |||
/* FIXME: put in automated test stuff (N.B. only gdb mem examination to this point to get | |||
* fix in */ | |||
/* import it into pep */ | |||
PEP_STATUS status7 = import_key(session, keytext.c_str(), keytext.length(), NULL); | |||
const char* bl_fpr_1 = "279765A2FEB5B7C731B861D93E4CEFD9F7AF4684"; | |||
const char* bl_fpr_2 = "634FAC4417E9B2A5DC2BD4AAC4AEEBBE7E62701B"; | |||
bool is_blacklisted = false; | |||
// Clean up from previous runs | |||
PEP_STATUS status10 = blacklist_is_listed(session, bl_fpr_1, &is_blacklisted); | |||
if (is_blacklisted) { | |||
is_blacklisted = false; | |||
blacklist_delete(session, bl_fpr_1); | |||
} | |||
pEp_identity* blacklisted_identity = new_identity("blacklistedkeys@kgrothoff.org", | |||
bl_fpr_1, | |||
"TOFU_blacklistedkeys@kgrothoff.org", | |||
"Blacklist Keypair"); | |||
PEP_STATUS status = set_fpr_preserve_ident(session, blacklisted_identity, bl_fpr_1, false); | |||
ASSERT_OK; | |||
PEP_STATUS status8 = update_identity(session, blacklisted_identity); | |||
// THERE IS NO BLACKLISTING OF PEP KEYS | |||
//blacklisted_identity->comm_type = PEP_ct_pEp; | |||
blacklisted_identity->comm_type = PEP_ct_OpenPGP_unconfirmed; | |||
PEP_STATUS status99 = set_identity(session, blacklisted_identity); | |||
trust_personal_key(session, blacklisted_identity); | |||
PEP_STATUS status999 = update_identity(session, blacklisted_identity); | |||
ASSERT_EQ(blacklisted_identity->comm_type , PEP_ct_OpenPGP); | |||
PEP_STATUS status9 = blacklist_add(session, bl_fpr_1); | |||
status10 = blacklist_is_listed(session, bl_fpr_1, &is_blacklisted); | |||
PEP_STATUS status11 = update_identity(session, blacklisted_identity); | |||
/* new!!! */ | |||
ASSERT_TRUE(is_blacklisted); | |||
ASSERT_EQ(status11 , PEP_STATUS_OK); | |||
ASSERT_STREQ(bl_fpr_1, blacklisted_identity->fpr); // I don't think this should be true, but... | |||
bool id_def, us_def, addr_def; | |||
status11 = get_valid_pubkey(session, blacklisted_identity, | |||
&id_def, &us_def, &addr_def, true); | |||
if (!(blacklisted_identity->fpr)) | |||
output_stream << "OK! blacklisted_identity->fpr is empty. Yay!" << endl; | |||
else if (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0) | |||
output_stream << "OK! While this should be empty, you are probably running " << | |||
"this in your home directory instead of the test environment " << | |||
"and have leftover keys. This is an acceptable result here then. But you " << | |||
"should probably clean up after yourself :)" << endl; | |||
else | |||
output_stream << "Not OK. blacklisted_identity->fpr is " << blacklisted_identity->fpr << "." << endl | |||
<< "Expected it to be empty or (possibly) " << bl_fpr_2 << endl; | |||
ASSERT_TRUE(blacklisted_identity->fpr == NULL || blacklisted_identity->fpr[0] == '\0' || strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0); | |||
pEp_identity *me = new_identity("alice@peptest.ch", NULL, "423", "Alice Miller"); | |||
ASSERT_NOTNULL(me); | |||
PEP_STATUS status24 = myself(session, me); | |||
ASSERT_EQ(status24 , PEP_STATUS_OK); | |||
message *msg23 = new_message(PEP_dir_outgoing); | |||
ASSERT_NOTNULL(msg23); | |||
msg23->from = me; | |||
msg23->to = new_identity_list(identity_dup(blacklisted_identity)); | |||
ASSERT_TRUE(msg23->to != NULL && msg23->to->ident != NULL); | |||
PEP_rating rating23; | |||
output_stream << "testing outgoing_message_rating() with blacklisted key in to\n"; | |||
PEP_STATUS status23 = outgoing_message_rating(session, msg23, &rating23); | |||
ASSERT_EQ(status23 , PEP_STATUS_OK); | |||
ASSERT_EQ(rating23 , PEP_rating_unencrypted); | |||
free_message(msg23); | |||
const string keytext2 = slurp("test_keys/pub/blacklisted_pub2.asc"); | |||
PEP_STATUS status14 = import_key(session, keytext2.c_str(), keytext2.length(), NULL); | |||
pEp_identity* blacklisted_identity2 = new_identity("blacklistedkeys@kgrothoff.org", | |||
bl_fpr_2, | |||
NULL, | |||
"Blacklist Keypair"); | |||
PEP_STATUS status15 = update_identity(session, blacklisted_identity2); | |||
// | |||
// ASSERT_EQ((blacklisted_identity2->fpr && strcmp(blacklisted_identity2->fpr, bl_fpr_2) , 0), "blacklisted_identity2->fpr && strcmp(blacklisted_identity2->fpr); | |||
// if (blacklisted_identity2->fpr && strcmp(blacklisted_identity2->fpr, bl_fpr_2) == 0) | |||
// output_stream << "blacklisted identity's fpr successfully replaced by the unblacklisted one" << endl; | |||
// // else | |||
// // output_stream << "blacklisted_identity->fpr should be " << bl_fpr_2 << " but is " << blacklisted_identity->fpr << endl; | |||
// | |||
// PEP_STATUS status12 = blacklist_delete(session, bl_fpr_1); | |||
// PEP_STATUS status13 = update_identity(session, blacklisted_identity); | |||
// | |||
// pEp_identity* stored_identity = new_identity("blacklistedkeys@kgrothoff.org", | |||
// NULL, | |||
// blacklisted_identity->user_id, | |||
// "Blacklist Keypair"); | |||
// | |||
// PEP_STATUS status00 = update_identity(session, stored_identity); | |||
// | |||
// // FIXME | |||
// // ASSERT_EQ(stored_identity->comm_type , PEP_ct_pEp); | |||
free_identity(blacklisted_identity); | |||
free_identity(blacklisted_identity2); | |||
} |