Browse Source

error handling

synchronous
Volker Birk 5 years ago
parent
commit
0fe0fe4918
  1. 6
      passphrase_cache.hxx
  2. 2
      test/test_passphrase_cache.cc

6
passphrase_cache.hxx

@ -1,4 +1,5 @@
#pragma once
#include <cassert>
#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;

2
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);

Loading…
Cancel
Save