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