[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Gerhard Lausser gerhard.lausser at consol.de
Tue Feb 28 22:21:23 UTC 2012


The following commit has been merged in the debian/master branch:
commit 68346431171e93a3984fea510ac7a0c524d5b5de
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date:   Thu Feb 16 23:51:32 2012 +0100

    Handle invalid livestatus queries without crashing the broker

diff --git a/shinken/modules/livestatus_broker/livestatus.py b/shinken/modules/livestatus_broker/livestatus.py
index adce32e..93e5a66 100644
--- a/shinken/modules/livestatus_broker/livestatus.py
+++ b/shinken/modules/livestatus_broker/livestatus.py
@@ -47,7 +47,11 @@ class LiveStatus(object):
 
         """
         request = LiveStatusRequest(data, self.datamgr, self.query_cache, self.db, self.pnp_path, self.return_queue, self.counters)
-        request.parse_input(data)
+        try:
+            request.parse_input(data)
+        except:
+            print "THIS QUERY IS INVALID", data
+            return '', False
         if sorted([q.my_type for q in request.queries]) == ['command', 'query', 'wait']:
             # The Multisite way
             for query in [q for q in request.queries if q.my_type == 'command']:
diff --git a/test/test_livestatus.py b/test/test_livestatus.py
index e4599ae..47841ff 100755
--- a/test/test_livestatus.py
+++ b/test/test_livestatus.py
@@ -361,6 +361,24 @@ ResponseHeader: fixed16
             print nagresponse
             self.assert_(self.lines_equal(response, nagresponse))
 
+    def test_nonsense(self):
+        self.print_header()
+        now = time.time()
+        objlist = []
+        for host in self.sched.hosts:
+            objlist.append([host, 0, 'UP'])
+        for service in self.sched.services:
+            objlist.append([service, 0, 'OK'])
+        self.scheduler_loop(1, objlist)
+        self.update_broker()
+        request = """GET hosts
+Columns: name state
+Filter: localhost
+"""
+        response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
+        print response
+        self.assert_(response == '')
+
     def test_bad_column(self):
         self.print_header()
         now = time.time()

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list