Log subject common name also.
May help understanding problems.
This commit is contained in:
@@ -13,6 +13,8 @@
|
|||||||
#include <Wt/WLogger.h>
|
#include <Wt/WLogger.h>
|
||||||
#include <Wt/WApplication.h>
|
#include <Wt/WApplication.h>
|
||||||
#include <Wt/WEnvironment.h>
|
#include <Wt/WEnvironment.h>
|
||||||
|
#include <Wt/WSslCertificate.h>
|
||||||
|
#include <Wt/WSslInfo.h>
|
||||||
#include <gpgme++/error.h>
|
#include <gpgme++/error.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
@@ -26,10 +28,26 @@ static void LogGpgMEError(const GpgME::Error& e)
|
|||||||
if (e.code() == 0)
|
if (e.code() == 0)
|
||||||
return;
|
return;
|
||||||
std::unique_lock<std::mutex> lock(gs_logGpgMEError);
|
std::unique_lock<std::mutex> lock(gs_logGpgMEError);
|
||||||
|
|
||||||
|
const vector<WSslCertificate::DnAttribute> * dnAttr
|
||||||
|
= &(WApplication::instance()->environment().sslInfo()
|
||||||
|
->clientCertificate().subjectDn());
|
||||||
|
WString subjectCommonName = WString::Empty;
|
||||||
|
for (uint i = 0; i < dnAttr->size(); i++)
|
||||||
|
{
|
||||||
|
if (dnAttr->at(i).name() == WSslCertificate::DnAttributeName::CommonName)
|
||||||
|
{
|
||||||
|
subjectCommonName = dnAttr->at(i).value();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const string logfile = WApplication::appRoot() + string("gpgme.log");
|
const string logfile = WApplication::appRoot() + string("gpgme.log");
|
||||||
WLogger logger;
|
WLogger logger;
|
||||||
logger.setFile(logfile);
|
logger.setFile(logfile);
|
||||||
logger.entry("") << WLogger::timestamp
|
logger.entry("") << WLogger::timestamp
|
||||||
|
<< WLogger::sep << subjectCommonName
|
||||||
<< WLogger::sep << WApplication::instance()->environment().userAgent()
|
<< WLogger::sep << WApplication::instance()->environment().userAgent()
|
||||||
<< WLogger::sep << std::to_string(e.code())
|
<< WLogger::sep << std::to_string(e.code())
|
||||||
<< WLogger::sep << e.asString();
|
<< WLogger::sep << e.asString();
|
||||||
|
|||||||
Reference in New Issue
Block a user