a99945
From a04a9acd5d399b700da17f90430c7efbf6719c25 Mon Sep 17 00:00:00 2001
a99945
From: Nikos Mavrogiannopoulos <nmav@redhat.com>
a99945
Date: Mon, 26 Jun 2017 13:11:40 +0200
a99945
Subject: [PATCH] use warning messages for failing to enumerate store
a99945
a99945
In systems which use p11-kit to register all available PKCS#11
a99945
modules, an unconfigured softhsm will always fail to load and
a99945
print the following to syslog:
a99945
Jun 26 13:29:05 host wget[6407]: ObjectStore.cpp(59): Failed to enumerate object in /var/lib/softhsm/tokens
a99945
Jun 26 13:29:05 host wget[6407]: SoftHSM.cpp(476): Could not load the object store
a99945
a99945
That can be output to any command utilizing p11-kit (e.g., applications
a99945
using gnutls or engine_pkcs11 applications).
a99945
a99945
To avoid that unnecessary print, I decreased the log level of
a99945
the message to warning and set the default configuration to
a99945
print only error messages to syslog.
a99945
a99945
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
a99945
---
a99945
 src/lib/SoftHSM.cpp                  | 2 +-
a99945
 src/lib/common/softhsm2.conf.in      | 2 +-
a99945
 src/lib/object_store/ObjectStore.cpp | 2 +-
a99945
 3 files changed, 3 insertions(+), 3 deletions(-)
a99945
a99945
diff --git a/src/lib/SoftHSM.cpp b/src/lib/SoftHSM.cpp
a99945
index 26dd6e5..bed5aa6 100644
a99945
--- a/src/lib/SoftHSM.cpp
a99945
+++ b/src/lib/SoftHSM.cpp
a99945
@@ -473,7 +473,7 @@ CK_RV SoftHSM::C_Initialize(CK_VOID_PTR pInitArgs)
a99945
 	objectStore = new ObjectStore(Configuration::i()->getString("directories.tokendir", DEFAULT_TOKENDIR));
a99945
 	if (!objectStore->isValid())
a99945
 	{
a99945
-		ERROR_MSG("Could not load the object store");
a99945
+		WARNING_MSG("Could not load the object store");
a99945
 		delete objectStore;
a99945
 		objectStore = NULL;
a99945
 		delete sessionObjectStore;
a99945
diff --git a/src/lib/common/softhsm2.conf.in b/src/lib/common/softhsm2.conf.in
a99945
index b208cb6..bd0a60b 100644
a99945
--- a/src/lib/common/softhsm2.conf.in
a99945
+++ b/src/lib/common/softhsm2.conf.in
a99945
@@ -4,4 +4,4 @@ directories.tokendir = @softhsmtokendir@
a99945
 objectstore.backend = file
a99945
 
a99945
 # ERROR, WARNING, INFO, DEBUG
a99945
-log.level = INFO
a99945
+log.level = ERROR
a99945
diff --git a/src/lib/object_store/ObjectStore.cpp b/src/lib/object_store/ObjectStore.cpp
a99945
index 171cede..3cde15f 100644
a99945
--- a/src/lib/object_store/ObjectStore.cpp
a99945
+++ b/src/lib/object_store/ObjectStore.cpp
a99945
@@ -56,7 +56,7 @@ ObjectStore::ObjectStore(std::string inStorePath)
a99945
 
a99945
 	if (!storeDir.isValid())
a99945
 	{
a99945
-		ERROR_MSG("Failed to enumerate object store in %s", storePath.c_str());
a99945
+		WARNING_MSG("Failed to enumerate object store in %s", storePath.c_str());
a99945
 
a99945
 		return;
a99945
 	}
a99945
-- 
a99945
2.13.6
a99945