diff --git a/passphrase_cache.hxx b/passphrase_cache.hxx index 3214f05..b9b04aa 100644 --- a/passphrase_cache.hxx +++ b/passphrase_cache.hxx @@ -1,4 +1,5 @@ #pragma once +#include #include "passphrase_cache.hh" namespace pEp { @@ -8,7 +9,10 @@ namespace pEp { PEP_STATUS status; for_each_passphrase([&](std::string passphrase) { - ::config_passphrase(session, passphrase.c_str()); + status = ::config_passphrase(session, passphrase.c_str()); + if (status) + return true; + status = f(session, a...); return status != PEP_PASSPHRASE_REQUIRED && status != PEP_WRONG_PASSPHRASE; diff --git a/test/test_passphrase_cache.cc b/test/test_passphrase_cache.cc index f29921d..d159209 100644 --- a/test/test_passphrase_cache.cc +++ b/test/test_passphrase_cache.cc @@ -44,7 +44,7 @@ int main() std::cout << "expected: two passphrases but reverse order\n"; cache.for_each_passphrase([&](std::string passphrase){std::cout << "'" << passphrase << "'\n"; return false;}); - status = cache.api(api_test1, session, str, bytes, n, sl); + status = cache.api(api_test1, session, "23", bytes, n, (::stringlist_t *) NULL); assert(status == PEP_WRONG_PASSPHRASE); status = cache.api(api_test2, session, str, bytes, n, sl); assert(status == PEP_STATUS_OK);