|
|
@ -9,6 +9,7 @@ tstylesheet { |
|
|
|
|
|
|
|
template "interface" document("foundation_pEp_jniadapter_{@name}.cc", "text") |
|
|
|
|| |
|
|
|
#include <cassert> |
|
|
|
#include <pEp/blacklist.h> |
|
|
|
#include <pEp/openpgp_compat.h> |
|
|
|
#include <pEp/key_reset.h> |
|
|
@ -70,34 +71,7 @@ tstylesheet { |
|
|
|
choose { |
|
|
|
when "@cached = 'true'" { |
|
|
|
|| |
|
|
|
pEpLog("cached passphrase mode"); |
|
|
|
bool retryAgain = false; |
|
|
|
int maxRetries = 3; |
|
|
|
int retryCount = 0; |
|
|
|
PEP_STATUS status; |
|
|
|
do { |
|
|
|
// the actual target function |
|
|
|
pEpLog("calling passphrase_cache.api(::«@name»())"); |
|
|
|
status = passphrase_cache.api(::«@name»,session()`apply "parm", mode=call`); |
|
|
|
pEpLog("PEP_STATUS:" << status); |
|
|
|
if(status == PEP_PASSPHRASE_REQUIRED || status == PEP_WRONG_PASSPHRASE || status == PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED) { |
|
|
|
pEpLog("none of the cached passphrases worked"); |
|
|
|
if(retryCount < maxRetries) { |
|
|
|
// call the app |
|
|
|
char* _passphrase = passphraseRequiredCallback(status); |
|
|
|
pEpLog("callback returned, config_passphrase() with new passphrase"); |
|
|
|
PEP_STATUS status = ::config_passphrase(session(),passphrase_cache.add(_passphrase)); |
|
|
|
retryAgain = true; |
|
|
|
retryCount++; |
|
|
|
} else { |
|
|
|
pEpLog("max retries reached:" << maxRetries); |
|
|
|
retryAgain = false; |
|
|
|
} |
|
|
|
} else { |
|
|
|
retryAgain = false; |
|
|
|
} |
|
|
|
} while (retryAgain); |
|
|
|
|
|
|
|
PEP_STATUS status = passphraseWrap(::«@name», session()`apply "parm", mode=call`); |
|
|
|
|| |
|
|
|
} otherwise { |
|
|
|
|| |
|
|
|