13#include <boost/algorithm/string.hpp> 
   38    if (!hook_scripts_path_checker_ || reset) {
 
   39        hook_scripts_path_checker_.reset(
new PathChecker(DEFAULT_HOOK_SCRIPTS_PATH, 
"KEA_HOOK_SCRIPTS_PATH"));
 
   40        if (!explicit_path.empty()) {
 
   41            hook_scripts_path_checker_->getPath(
true, explicit_path);
 
   45    return (hook_scripts_path_checker_->getPath());
 
 
   50    if (!hook_scripts_path_checker_) {
 
   54    return (hook_scripts_path_checker_->validatePath(libpath));
 
 
   59    if (!hooks_path_checker_ || reset) {
 
   60        hooks_path_checker_.reset(
new PathChecker(DEFAULT_HOOKS_PATH, 
"KEA_HOOKS_PATH"));
 
   61        if (!explicit_path.empty()) {
 
   62            hooks_path_checker_->getPath(
true, explicit_path);
 
   66    return (hooks_path_checker_->getPath());
 
 
   71    if (!hooks_path_checker_) {
 
   76        return (hooks_path_checker_->validatePath(libpath));
 
 
   96    for (
auto const& library_entry : value->listValue()) {
 
  102                " one or more entries in the hooks-libraries list is not" 
  103                " a map (" << library_entry->getPosition() << 
")");
 
  108        bool lib_found = 
false;
 
  117        for (
auto const& entry_item : library_entry->mapValue()) {
 
  118            if (entry_item.first == 
"library") {
 
  121                        " error: value of 'library' element is not a string" 
  122                        " giving the path to a hooks library (" <<
 
  123                        entry_item.second->getPosition() << 
")");
 
  129                    cfgname = (entry_item.second)->stringValue();
 
  131                } 
catch  (
const std::exception& ex) {
 
  133                        " error: " << ex.what() << 
" (" 
  134                        << entry_item.second->getPosition() << 
")");
 
  143            if (entry_item.first == 
"parameters") {
 
  144                parameters = entry_item.second;
 
  150                      << entry_item.first << 
"(" 
  151                      << library_entry->getPosition() << 
")");
 
  156                " one or more hooks-libraries elements are missing the" 
  157                " name of the library"  <<
 
  158                " (" << library_entry->getPosition() << 
")");
 
  161        libraries.
add(libname, parameters, cfgname);
 
 
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
To be removed. Please use ConfigError instead.
static std::string validatePath(const std::string libpath)
Validates a script path (script loaded by a hook) against the supported path.
static std::string getHookScriptsPath(bool reset=false, const std::string explicit_path="")
Fetches the supported script path.
Wrapper class that holds hooks libraries configuration.
void clear()
Removes all configured hooks libraries.
void add(const std::string &libname, isc::data::ConstElementPtr parameters, const std::string &cfgname="")
Adds additional hooks libraries.
static std::string validatePath(const std::string libpath)
Validates a library path against the supported path for hooks libraries.
void parse(HooksConfig &libraries, isc::data::ConstElementPtr value)
Parses parameters value.
static std::string getHooksPath(bool reset=false, const std::string explicit_path="")
Fetches the supported Hooks path.
Embodies a supported path against which file paths can be validated.
A generic exception that is thrown if a parameter given violates security check but enforcement is la...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
boost::shared_ptr< const Element > ConstElementPtr
const isc::log::MessageID HOOKS_LIBPATH_SECURITY_WARNING
isc::log::Logger hooks_logger("hooks")
Hooks Logger.
boost::shared_ptr< PathChecker > PathCheckerPtr
Defines a pointer to a PathChecker.
Defines the logger used by the top-level component of kea-lfc.