Browse Source

JNI-156 - Remove all blacklist functions

JNI-156
heck 4 years ago
parent
commit
0c36123b91
  1. 2
      src/codegen/gen_cpp_Engine.ysl2
  2. 7
      src/codegen/pEp.yml2
  3. 82
      src/cxx/basic_api.cc

2
src/codegen/gen_cpp_Engine.ysl2

@ -13,7 +13,7 @@ tstylesheet {
template "interface" document("../cxx/foundation_pEp_jniadapter_{@name}.cc", "text") template "interface" document("../cxx/foundation_pEp_jniadapter_{@name}.cc", "text")
|| ||
#include <cassert> #include <cassert>
#include <pEp/blacklist.h> #include <pEp/pEpEngine.h>
#include <pEp/openpgp_compat.h> #include <pEp/openpgp_compat.h>
#include <pEp/key_reset.h> #include <pEp/key_reset.h>
#include <pEp/Adapter.hh> #include <pEp/Adapter.hh>

7
src/codegen/pEp.yml2

@ -149,10 +149,6 @@ namespace pEp {
returns Rating rating returns Rating rating
); );
method cached=true blacklist_retrieve(
returns stringlist blacklist
);
// TODO: WTF is... // TODO: WTF is...
method cached=true own_message_private_key_details( method cached=true own_message_private_key_details(
in message msg, in message msg,
@ -264,9 +260,6 @@ namespace pEp {
basic void trustPersonalKey(identity ident); basic void trustPersonalKey(identity ident);
basic void trustOwnKey(identity ident); basic void trustOwnKey(identity ident);
basic identitylist importKey(bytearray key); basic identitylist importKey(bytearray key);
basic void blacklist_add(string fpr);
basic void blacklist_delete(string fpr);
basic bool blacklist_is_listed(string fpr);
basic void config_passive_mode(bool enable); basic void config_passive_mode(bool enable);
basic void config_unencrypted_subject(bool enable); basic void config_unencrypted_subject(bool enable);
basic string getCrashdumpLog(int maxlines); basic string getCrashdumpLog(int maxlines);

82
src/cxx/basic_api.cc

@ -1,5 +1,4 @@
#include <pEp/keymanagement.h> #include <pEp/keymanagement.h>
#include <pEp/blacklist.h>
#include <pEp/Adapter.hh> #include <pEp/Adapter.hh>
#include <pEp/pEpLog.hh> #include <pEp/pEpLog.hh>
@ -340,88 +339,7 @@ JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1config_1unencrypt
::config_unencrypted_subject(session(), static_cast<bool>(enable)); ::config_unencrypted_subject(session(), static_cast<bool>(enable));
} }
JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1blacklist_1add(JNIEnv *env,
jobject obj,
jbyteArray fpr
)
{
std::mutex *mutex_local = nullptr;
{
std::lock_guard<std::mutex> l(global_mutex);
pEpLog("called with lock_guard");
mutex_local = get_engine_java_object_mutex(env, obj);
}
std::lock_guard<std::mutex> l(*mutex_local);
const char *_fpr = to_string(env, fpr);
if(_fpr == NULL){
throw_pEp_Exception(env, PEP_OUT_OF_MEMORY);
return;
}
PEP_STATUS status = passphraseWrap(::blacklist_add, session(), _fpr);
if (status != PEP_STATUS_OK) {
throw_pEp_Exception(env, status);
return;
}
}
JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1blacklist_1delete(JNIEnv *env,
jobject obj,
jbyteArray fpr)
{
std::mutex *mutex_local = nullptr;
{
std::lock_guard<std::mutex> l(global_mutex);
pEpLog("called with lock_guard");
mutex_local = get_engine_java_object_mutex(env, obj);
}
std::lock_guard<std::mutex> l(*mutex_local);
const char *_fpr = to_string(env, fpr);
if(_fpr == NULL){
throw_pEp_Exception(env, PEP_OUT_OF_MEMORY);
return;
}
PEP_STATUS status = passphraseWrap(::blacklist_delete, session(), _fpr);
if (status != PEP_STATUS_OK) {
throw_pEp_Exception(env, status);
return;
}
}
JNIEXPORT jboolean JNICALL Java_foundation_pEp_jniadapter_Engine__1blacklist_1is_1listed(JNIEnv *env,
jobject obj,
jbyteArray fpr)
{
std::mutex *mutex_local = nullptr;
{
std::lock_guard<std::mutex> l(global_mutex);
pEpLog("called with lock_guard");
mutex_local = get_engine_java_object_mutex(env, obj);
}
std::lock_guard<std::mutex> l(*mutex_local);
const char *_fpr = to_string(env, fpr);
bool _listed = 0;
if(_fpr == NULL){
throw_pEp_Exception(env, PEP_OUT_OF_MEMORY);
return 0;
}
PEP_STATUS status = passphraseWrap(::blacklist_is_listed, session(), _fpr, &_listed);
if (status != PEP_STATUS_OK) {
throw_pEp_Exception(env, status);
return 0;
}
return (jboolean)_listed;
}
JNIEXPORT jbyteArray JNICALL Java_foundation_pEp_jniadapter_Engine__1getCrashdumpLog(JNIEnv *env, JNIEXPORT jbyteArray JNICALL Java_foundation_pEp_jniadapter_Engine__1getCrashdumpLog(JNIEnv *env,
jobject obj, jobject obj,

Loading…
Cancel
Save