Permalink
Browse files

Use p11_kit_strerror in logError

  • Loading branch information...
1 parent 25109e2 commit ba146ce721d324b15b4fc924b75656a27cad32cb @cmouse cmouse committed Mar 30, 2015
Showing with 6 additions and 3 deletions.
  1. +6 −3 pdns/pkcs11signers.cc
@@ -7,6 +7,7 @@
#include <boost/assign/list_of.hpp>
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
+#include <boost/format.hpp>
#include <p11-kit/p11-kit.h>
#include "pdns/dnssecinfra.hh"
@@ -208,7 +209,8 @@ class Pkcs11Slot {
void logError(const std::string& operation) const {
if (d_err) {
- L<<Logger::Error<<"PKCS#11 operation " << operation << " failed: " << d_err << endl;
+ std::string msg = boost::str( boost::format("PKCS#11 operation %s failed: %s (0x%X)") % operation % p11_kit_strerror(d_err) % d_err );
+ L<<Logger::Error<< msg << endl;
}
}
public:
@@ -280,9 +282,10 @@ class Pkcs11Token {
void logError(const std::string& operation) const {
if (d_err) {
- L<<Logger::Error<<"PKCS#11 operation " << operation << " failed: " << d_err << endl;
+ std::string msg = boost::str( boost::format("PKCS#11 operation %s failed: %s (0x%X)") % operation % p11_kit_strerror(d_err) % d_err );
+ L<<Logger::Error<< msg << endl;
}
- };
+ }
public:
Pkcs11Token(const boost::shared_ptr<Pkcs11Slot>& slot, const std::string& label);

0 comments on commit ba146ce

Please sign in to comment.