]> granicus.if.org Git - icinga2/commitdiff
Add config error on empty port in Endpoints
authorJean Flach <jean-marcel.flach@netways.de>
Mon, 24 Aug 2015 15:19:12 +0000 (17:19 +0200)
committerJean Flach <jean-marcel.flach@netways.de>
Tue, 25 Aug 2015 14:44:32 +0000 (16:44 +0200)
fixes #9623

lib/remote/endpoint.cpp
lib/remote/endpoint.hpp

index 29068ac0d235c6fcd39c14fe22d68a5de0714303..bdbfed08835146520a80f744f2c573b7f31a538e 100644 (file)
@@ -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<Endpoint>::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();
index 0738572fe9049f47b5249ba60a705ad79377c91e..cd8aac1175ec28ce40e9e0befe06e5fe01185625 100644 (file)
@@ -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;