[pkg-nagios-changes] [Git][nagios-team/pkg-nagvis][upstream] New upstream version 1.9.25

Bas Couwenberg gitlab at salsa.debian.org
Fri Feb 26 13:45:18 GMT 2021



Bas Couwenberg pushed to branch upstream at Debian Nagios Maintainer Group / pkg-nagvis


Commits:
8ee84ed4 by Bas Couwenberg at 2021-02-26T14:38:38+01:00
New upstream version 1.9.25
- - - - -


5 changed files:

- ChangeLog
- share/server/core/classes/GlobalBackendmklivestatus.php
- share/server/core/classes/GlobalMapCfg.php
- share/server/core/classes/ViewMapAddModify.php
- share/server/core/defines/global.php


Changes:

=====================================
ChangeLog
=====================================
@@ -1,3 +1,15 @@
+1.9.25
+  * FIX: Fix map corruption regression introduced with 1.9.24
+  This issue was triggered by objects on a map having a numeric "object_id"
+  attribute. The issue resulted in map configuration files without "define
+  global" object at the beginning of the map. In this situation NagVis will
+  show an error like "Error: (0) in_array() expects parameter 2 to be array, bool given".
+  You will have to find the problematic map config (.cfg) and readd the global
+  section.
+  * FIX: Fix editing map options when object_id not set in global section object
+  * FIX: Fix possible map corruption caused by object ID cleanup (#280)
+  * FIX: Fix missing socket string in some livestatus backend error messages
+
 1.9.24
   * FIX: Fix more PHP 7.4 incompatibilites (#265)
     (This fixes one issue related to the PDO auth module and one issue related


=====================================
share/server/core/classes/GlobalBackendmklivestatus.php
=====================================
@@ -85,7 +85,8 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface {
         $this->backendId = $backendId;
 
         // Parse the socket params
-        $this->parseSocket(cfg('backend_'.$backendId, 'socket'));
+        $this->socketSpec = cfg('backend_'.$backendId, 'socket');
+        $this->parseSocket($this->socketSpec);
 
         // Run preflight checks
         if($this->socketType == 'unix' && !$this->checkSocketExists()) {
@@ -95,7 +96,7 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface {
 
         if(!function_exists('fsockopen')) {
             throw new BackendConnectionProblem(l('The PHP function fsockopen is not available. Needed by backend [BACKENDID].',
-                               Array('BACKENDID' => $this->backendId, 'SOCKET' => $this->socketPath)));
+                               Array('BACKENDID' => $this->backendId, 'SOCKET' => $this->socketSpec)));
         }
 
         return true;
@@ -239,7 +240,7 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface {
             $this->CONNECT_EXC = new BackendConnectionProblem(
                                      l('Unable to connect to the [SOCKET] in backend [BACKENDID]: [MSG]',
                                                Array('BACKENDID' => $this->backendId,
-                                                     'SOCKET'    => $this->socketPath,
+                                                     'SOCKET'    => $this->socketSpec,
                                                      'MSG'       => $error_msg)));
             throw $this->CONNECT_EXC;
         }
@@ -312,13 +313,13 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface {
         if($write=== false)
             throw new BackendConnectionProblem(l('Problem while writing to socket [SOCKET] in backend [BACKENDID]: [MSG]',
                                                  Array('BACKENDID' => $this->backendId,
-                                                       'SOCKET'    => $this->socketPath,
+                                                       'SOCKET'    => $this->socketSpec,
                                                        'MSG'       => 'Error while sending query to socket.')));
 
         if($write !== strlen($query))
             throw new BackendConnectionProblem(l('Problem while writing to socket [SOCKET] in backend [BACKENDID]: [MSG]',
                                                  Array('BACKENDID' => $this->backendId,
-                                                       'SOCKET'    => $this->socketPath,
+                                                       'SOCKET'    => $this->socketSpec,
                                                        'MSG'       => 'Connection terminated.')));
 
 
@@ -333,7 +334,7 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface {
         if($read === false)
             throw new BackendConnectionProblem(l('Problem while reading from socket [SOCKET] in backend [BACKENDID]: [MSG]',
                                                  Array('BACKENDID' => $this->backendId,
-                                                       'SOCKET'    => $this->socketPath,
+                                                       'SOCKET'    => $this->socketSpec,
                                                        'MSG'       => 'Error while reading socket (header)')));
 
         // Extract status code
@@ -349,7 +350,7 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface {
         if($read === false) {
             throw new BackendConnectionProblem(l('Problem while reading from socket [SOCKET] in backend [BACKENDID]: [MSG]',
                                                  Array('BACKENDID' => $this->backendId,
-                                                       'SOCKET'    => $this->socketPath,
+                                                       'SOCKET'    => $this->socketSpec,
                                                        'MSG'       => 'Error while reading socket (content)')));
         }
 
@@ -357,7 +358,7 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface {
         if($status != "200") {
             throw new BackendConnectionProblem(l('Problem while reading from socket [SOCKET] in backend [BACKENDID]: [MSG]',
                                                  Array('BACKENDID' => $this->backendId,
-                                                       'SOCKET'    => $this->socketPath,
+                                                       'SOCKET'    => $this->socketSpec,
                                                        'MSG'       => $read)));
         }
 


=====================================
share/server/core/classes/GlobalMapCfg.php
=====================================
@@ -341,17 +341,9 @@ class GlobalMapCfg {
             if($sFirstChar == '}') {
                 if($obj['type'] === 'global')
                     $id = 0;
-                else {
+                else
                     $id = isset($obj['object_id']) ? $obj['object_id'] : '_'.$iObjId;
 
-                    // In case a numeric object_id is read from the config,
-                    // normalize it to the "_[id]" format (which get's replaced
-                    // later in verifyObjectIds)
-                    if (is_numeric($obj['object_id'])) {
-                        $id = '_'.$obj['object_id'];
-                    }
-                }
-
                 // It might happen that there is a duplicate object on the map
                 // This generates a new object_id for the later objects
                 if(isset($this->mapConfig[$id])) {
@@ -974,10 +966,16 @@ class GlobalMapCfg {
         foreach(array_keys($this->mapConfig) AS $id) {
             $todo = false;
 
+            if($id === 0)
+                continue;
+
+            // object_id which is numeric and used as $this->mapConfig key is casted to
+            // int by PHP. Fix this by casting back to str here.
+            $id = strval($id);
+
             // Replace default integer object IDs (are added with "_[index]" during config parsing)
-            if($id !== 0 && $id[0] == '_') {
+            if($id[0] == '_')
                 $todo = true;
-            }
 
             // Remove duplicates by generating new IDs for the later objects
             if(isset($alreadySeen[$id])) {


=====================================
share/server/core/classes/ViewMapAddModify.php
=====================================
@@ -164,7 +164,8 @@ class ViewMapAddModify {
                     $this->MAPCFG->storeUpdateElement($this->object_id);
                 } else {
                     // add/modify case: Rewrite whole object with the given attributes
-                    $this->MAPCFG->updateElement($this->object_id, $this->attrs, true);
+                    $object_id = $this->object_id === '0' ? 0 : $this->object_id;
+                    $this->MAPCFG->updateElement($object_id, $this->attrs, true);
                 }
 
                 $t = $this->object_type == 'global' ? l('map configuration') : $this->object_type;


=====================================
share/server/core/defines/global.php
=====================================
@@ -23,7 +23,7 @@
  *****************************************************************************/
  
 // NagVis Version
-define('CONST_VERSION', '1.9.24');
+define('CONST_VERSION', '1.9.25');
 
 // Set PHP error handling to standard level
 // Different levels for php versions below 5.1 because PHP 5.1 reports



View it on GitLab: https://salsa.debian.org/nagios-team/pkg-nagvis/-/commit/8ee84ed4661d7e2ec1be7ebe8231e7661b536a5a

-- 
View it on GitLab: https://salsa.debian.org/nagios-team/pkg-nagvis/-/commit/8ee84ed4661d7e2ec1be7ebe8231e7661b536a5a
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nagios-changes/attachments/20210226/cd58a850/attachment-0001.htm>


More information about the pkg-nagios-changes mailing list