From: Francis Dupont Date: Tue, 9 Jul 2019 09:38:15 +0000 (+0200) Subject: [576-cb-cmds-empty-value-for-next-server-parameter-is-accepted-which-causes-misconfig... X-Git-Tag: Kea-1.6.0-beta2~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a2e25d07e30f78647a110b593cafd311c23d1e6;p=thirdparty%2Fkea.git [576-cb-cmds-empty-value-for-next-server-parameter-is-accepted-which-causes-misconfiguration] Moved ElementValue specialization and changed getGlobalProperty full specialization to overloading --- diff --git a/src/lib/cc/element_value.h b/src/lib/cc/element_value.h index 964fd0ee92..ff48561f09 100644 --- a/src/lib/cc/element_value.h +++ b/src/lib/cc/element_value.h @@ -7,6 +7,7 @@ #ifndef ELEMENT_VALUE_H #define ELEMENT_VALUE_H +#include #include #include @@ -94,6 +95,22 @@ public: } }; +/// @brief The @c ElementValue specialization for IOAddress. +template<> +class ElementValue { +public: + + /// @brief Function operator extracting an @c Element value as + /// IOAddress. + /// + /// @note This does NOT support empty string value. + /// + /// @param el Element holding a value to be extracted. + asiolink::IOAddress operator()(ConstElementPtr el) const { + return (asiolink::IOAddress(el->stringValue())); + } +}; + } // end of namespace isc::data } // end of namespace isc diff --git a/src/lib/dhcpsrv/network.h b/src/lib/dhcpsrv/network.h index 0d795d6a9a..d526f30938 100644 --- a/src/lib/dhcpsrv/network.h +++ b/src/lib/dhcpsrv/network.h @@ -7,7 +7,6 @@ #ifndef NETWORK_H #define NETWORK_H -#include #include #include #include @@ -25,27 +24,6 @@ #include #include -namespace isc { -namespace data { - -/// @brief The @c ElementValue specialization for IOAddress. -template<> -class ElementValue { -public: - - /// @brief Function operator extracting an @c Element value as string. - /// - /// @note This does NOT support empty string value. - /// - /// @param el Element holding a value to be extracted. - asiolink::IOAddress operator()(ConstElementPtr el) const { - return (asiolink::IOAddress(el->stringValue())); - } -}; - -} // end of namespace isc::data -} // end of namespace isc - namespace isc { namespace dhcp { @@ -546,6 +524,14 @@ public: protected: + /// @brief Gets the optional callback function used to fetch globally + /// configured parameters. + /// + /// @return Pointer to the function. + FetchNetworkGlobalsFn getFetchGlobalsFn() const { + return (fetch_globals_fn_); + } + /// @brief Returns a value of global configuration parameter with /// a given name. /// @@ -591,6 +577,9 @@ protected: /// - uses the string value of the parameter /// - falls back when the value is empty /// + /// @note: use overloading vs specialization because full specialization + /// is not allowed in this scope. + /// /// @param property Value to be returned when it is specified or when /// no global value is found. /// @param global_name Name of the global parameter which value should @@ -598,7 +587,7 @@ protected: /// /// @return Optional value fetched from the global level or the value /// of @c property. - template<> util::Optional + util::Optional getGlobalProperty(util::Optional property, const std::string& global_name) const { if (!global_name.empty() && fetch_globals_fn_) {