mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[3186] Disabled use of isc::log logging in user_chk hook library.
Interrim checkin. Use of isc::logging has been disabled. Initializing the dictionary (MessageInitializer::loadDictionary) cores on Debian. This has something to do with the libary being opened and closed without calling load during Kea configuration parsing and the later reopening the library. See trac#3198.
This commit is contained in:
@@ -38,7 +38,8 @@ libdhcp_user_chk_la_SOURCES += user_file.cc user_file.h
|
||||
libdhcp_user_chk_la_SOURCES += user_registry.cc user_registry.h
|
||||
libdhcp_user_chk_la_SOURCES += version.cc
|
||||
|
||||
nodist_libdhcp_user_chk_la_SOURCES = user_chk_messages.cc user_chk_messages.h
|
||||
# Until logging in dynamically loaded libraries is fixed, exclude these.
|
||||
#nodist_libdhcp_user_chk_la_SOURCES = user_chk_messages.cc user_chk_messages.h
|
||||
|
||||
libdhcp_user_chk_la_CXXFLAGS = $(AM_CXXFLAGS)
|
||||
libdhcp_user_chk_la_CPPFLAGS = $(AM_CPPFLAGS) $(LOG4CPLUS_INCLUDES)
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// load_unload.cc
|
||||
|
||||
#include <hooks/hooks.h>
|
||||
#include <user_chk_log.h>
|
||||
#include <user_registry.h>
|
||||
#include <user_file.h>
|
||||
|
||||
@@ -32,9 +31,6 @@ const char* user_chk_output_fname = "/tmp/user_check_output.txt";
|
||||
extern "C" {
|
||||
|
||||
int load(LibraryHandle&) {
|
||||
|
||||
isc::log::MessageInitializer::loadDictionary();
|
||||
|
||||
// non-zero indicates an error.
|
||||
int ret_val = 0;
|
||||
try {
|
||||
@@ -61,7 +57,8 @@ int load(LibraryHandle&) {
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
LOG_ERROR(user_chk_logger, USER_CHK_HOOK_LOAD_ERROR).arg(ex.what());
|
||||
std::cout << "DHCP UserCheckHook could not be loaded: "
|
||||
<< ex.what() << std::endl;
|
||||
ret_val = 1;
|
||||
}
|
||||
|
||||
@@ -77,7 +74,8 @@ int unload() {
|
||||
} catch (const std::exception& ex) {
|
||||
// On the off chance something goes awry, catch it and log it.
|
||||
// @todo Not sure if we should return a non-zero result or not.
|
||||
LOG_ERROR(user_chk_logger, USER_CHK_HOOK_UNLOAD_ERROR).arg(ex.what());
|
||||
std::cout << "DHCP UserCheckHook could not be unloaded: "
|
||||
<< ex.what() << std::endl;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#include <dhcp/pkt6.h>
|
||||
#include <dhcpsrv/subnet.h>
|
||||
#include <user_registry.h>
|
||||
#include <user_chk_log.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
@@ -39,7 +38,8 @@ void generate_output_record(const std::string& id_type_str,
|
||||
// This callout is called at the "subnet4_select" hook.
|
||||
int subnet4_select(CalloutHandle& handle) {
|
||||
if (!user_registry) {
|
||||
LOG_ERROR(user_chk_logger, USER_CHK_SUBNET4_SELECT_REGISTRY_NULL);
|
||||
std::cout << "DHCP UserCheckHook : subnet4_select UserRegistry is null"
|
||||
<< std::endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ int subnet4_select(CalloutHandle& handle) {
|
||||
false);
|
||||
}
|
||||
} catch (const std::exception& ex) {
|
||||
LOG_ERROR(user_chk_logger, USER_CHK_SUBNET4_SELECT_ERROR)
|
||||
.arg(ex.what());
|
||||
std::cout << "DHCP UserCheckHook : subnet6_select unexpected error: "
|
||||
<< ex.what() << std::endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,8 @@ int subnet4_select(CalloutHandle& handle) {
|
||||
// This callout is called at the "subnet6_select" hook.
|
||||
int subnet6_select(CalloutHandle& handle) {
|
||||
if (!user_registry) {
|
||||
LOG_ERROR(user_chk_logger, USER_CHK_SUBNET4_SELECT_REGISTRY_NULL);
|
||||
std::cout << "DHCP UserCheckHook : subnet6_select UserRegistry is null"
|
||||
<< std::endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -125,8 +126,8 @@ int subnet6_select(CalloutHandle& handle) {
|
||||
false);
|
||||
}
|
||||
} catch (const std::exception& ex) {
|
||||
LOG_ERROR(user_chk_logger, USER_CHK_SUBNET6_SELECT_ERROR)
|
||||
.arg(ex.what());
|
||||
std::cout << "DHCP UserCheckHook : subnet6_select unexpected error: "
|
||||
<< ex.what() << std::endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,8 @@ libdhcp_user_chk_unittests_SOURCES += ../subnet_select_co.cc
|
||||
libdhcp_user_chk_unittests_SOURCES += ../version.cc
|
||||
libdhcp_user_chk_unittests_SOURCES += ../user.cc ../user.h
|
||||
libdhcp_user_chk_unittests_SOURCES += ../user_chk_log.cc ../user_chk_log.h
|
||||
libdhcp_user_chk_unittests_SOURCES += ../user_chk_messages.cc ../user_chk_messages.h
|
||||
# Until logging in dynamically loaded libraries is fixed, exclude these.
|
||||
#libdhcp_user_chk_unittests_SOURCES += ../user_chk_messages.cc ../user_chk_messages.h
|
||||
libdhcp_user_chk_unittests_SOURCES += ../user_data_source.cc ../user_data_source.h
|
||||
libdhcp_user_chk_unittests_SOURCES += ../user_file.cc ../user_file.h
|
||||
libdhcp_user_chk_unittests_SOURCES += ../user_registry.cc ../user_registry.h
|
||||
|
Reference in New Issue
Block a user