From: Jean Flach Date: Mon, 24 Aug 2015 15:19:12 +0000 (+0200) Subject: Add config error on empty port in Endpoints X-Git-Tag: v2.3.9~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0513be27b4d1bbf5f03a00fe449da809c95c11d7;p=icinga2 Add config error on empty port in Endpoints fixes #9623 Conflicts: lib/remote/endpoint.cpp lib/remote/endpoint.hpp --- diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index a7a9e7afe..9332aa922 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -56,6 +56,14 @@ void Endpoint::OnAllConfigLoaded(void) BOOST_THROW_EXCEPTION(ScriptError("Endpoint '" + GetName() + "' does not belong to a zone.", GetDebugInfo())); } +void Endpoint::ValidatePort(const String& value, const ValidationUtils& utils) +{ + ObjectImpl::ValidatePort(value, utils); + + if (value.IsEmpty()) + BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("enpoint_port"), "Port may not be empty.")); +} + void Endpoint::AddClient(const ApiClient::Ptr& client) { bool was_master = ApiListener::GetInstance()->IsMaster(); diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index 3411b32aa..f2dd73275 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -56,6 +56,7 @@ public: protected: virtual void OnAllConfigLoaded(void); + virtual void ValidatePort(const String& value, const ValidationUtils& utils) override; private: mutable boost::mutex m_ClientsLock;