From 9b0530443514fc432e6eeb81b67a11cfe7d2bfb1 Mon Sep 17 00:00:00 2001 From: Jean Flach Date: Mon, 24 Aug 2015 17:19:12 +0200 Subject: [PATCH] Add config error on empty port in Endpoints fixes #9623 --- lib/remote/endpoint.cpp | 8 ++++++++ lib/remote/endpoint.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index 29068ac0d..bdbfed088 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -57,6 +57,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 JsonRpcConnection::Ptr& client) { bool was_master = ApiListener::GetInstance()->IsMaster(); diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index 0738572fe..cd8aac117 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -56,6 +56,7 @@ public: protected: virtual void OnAllConfigLoaded(void) override; + virtual void ValidatePort(const String& value, const ValidationUtils& utils) override; private: mutable boost::mutex m_ClientsLock;