Browse Source

just cosmetics

JNI-114
heck 5 years ago
parent
commit
5f85c064a1
  1. 1
      .hgignore
  2. 7
      src/passphrase_callback.hh
  3. 12
      src/passphrase_callback.hxx

1
.hgignore

@ -39,6 +39,7 @@ IdentityFlags.java
SyncHandshakeSignal.java SyncHandshakeSignal.java
CipherSuite.java CipherSuite.java
passphrase_status_list.yml2
status_list.yml2 status_list.yml2
ndk*/ ndk*/

7
src/passphrase_callback.hh

@ -7,9 +7,8 @@ namespace pEp {
char* passphraseRequiredCallback(const PEP_STATUS status); char* passphraseRequiredCallback(const PEP_STATUS status);
template<typename... A> PEP_STATUS passphraseWrap( template<typename... A> PEP_STATUS passphraseWrap(PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a);
PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a); }
}; }
};
#include "passphrase_callback.hxx" #include "passphrase_callback.hxx"

12
src/passphrase_callback.hxx

@ -5,8 +5,7 @@
namespace pEp { namespace pEp {
namespace JNIAdapter { namespace JNIAdapter {
template<typename... A> PEP_STATUS passphraseWrap( template<typename... A> PEP_STATUS passphraseWrap(PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a) {
PEP_STATUS f(PEP_SESSION, A...), PEP_SESSION session, A... a) {
pEpLog("cached passphrase mode"); pEpLog("cached passphrase mode");
bool retryAgain = false; bool retryAgain = false;
int maxRetries = 3; int maxRetries = 3;
@ -17,15 +16,16 @@ namespace pEp {
pEpLog("calling passphrase_cache.api from basic_api"); pEpLog("calling passphrase_cache.api from basic_api");
status = passphrase_cache.api(f, session, a...); status = passphrase_cache.api(f, session, a...);
pEpLog("PEP_STATUS:" << status); pEpLog("PEP_STATUS:" << status);
if (status == PEP_PASSPHRASE_REQUIRED || status == PEP_WRONG_PASSPHRASE if (status == PEP_PASSPHRASE_REQUIRED ||
|| status == PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED) { status == PEP_WRONG_PASSPHRASE ||
status == PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED)
{
pEpLog("none of the cached passphrases worked"); pEpLog("none of the cached passphrases worked");
if (retryCount < maxRetries) { if (retryCount < maxRetries) {
// call the app // call the app
char *_passphrase = passphraseRequiredCallback(status); char *_passphrase = passphraseRequiredCallback(status);
pEpLog("callback returned, config_passphrase() with new passphrase"); pEpLog("callback returned, config_passphrase() with new passphrase");
PEP_STATUS status = ::config_passphrase(session, PEP_STATUS status = ::config_passphrase(session, passphrase_cache.add(_passphrase));
passphrase_cache.add(_passphrase));
retryAgain = true; retryAgain = true;
retryCount++; retryCount++;
} else { } else {

Loading…
Cancel
Save