From 39f3b5fb45a3da38f813db382ca3fea32fa3a67b Mon Sep 17 00:00:00 2001 From: heck Date: Wed, 8 Jul 2020 02:18:00 +0200 Subject: [PATCH] _if_ we should throw here, we need to do it differently... --- src/gen_cpp_Engine.ysl2 | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/gen_cpp_Engine.ysl2 b/src/gen_cpp_Engine.ysl2 index 669504b..abfa6ac 100644 --- a/src/gen_cpp_Engine.ysl2 +++ b/src/gen_cpp_Engine.ysl2 @@ -68,8 +68,31 @@ tstylesheet { choose { when "@cached = 'true'" { || - pEpLog("cached passphrase"); - PEP_STATUS status = passphrase_cache.api(::«@name»,session()`apply "parm", mode=call`); + pEpLog("cached passphrase mode"); + bool retryAfterCallback = false; + int maxRetries = 3; + int retryCount = 0; + PEP_STATUS status; + do { + // the actual target function + status = passphrase_cache.api(::«@name»,session()`apply "parm", mode=call`); + + if(status == PEP_PASSPHRASE_REQUIRED || PEP_WRONG_PASSPHRASE ) { + pEpLog("PassReq OR Wrong"); + // call the app + const char * _passphrase = "passphrase_alice"; + PEP_STATUS status = ::config_passphrase(session(),passphrase_cache.add(_passphrase)); + retryCount++; + if(retryCount > maxRetries) { + retryAfterCallback = false; + } else { + retryAfterCallback = true; + } + } else { + retryAfterCallback = false; + } + } while (retryAfterCallback); + || } otherwise { ||