]> git.pld-linux.org Git - packages/cacti.git/blob - cacti-bug-1634.patch
requires php 5.4
[packages/cacti.git] / cacti-bug-1634.patch
1 commit 32f1538a4a382b7b27e2340705e9b034f335ae6e
2 Author: cigamit <jimmy@sqmail.org>
3 Date:   Sat Jun 2 12:16:13 2018 -0500
4
5     Resolving Issue #1634
6     
7     * Default snmp quick print setting resulting in false poller ASSERTS on
8     some php releases
9     * Also enhance the cacti snmp functions to require only 3 or 4
10     parameters.
11     * Minor format change to the vendor file classSNMP.php.  No functional
12     change.
13
14 diff --git a/include/phpsnmp/classSNMP.php b/include/phpsnmp/classSNMP.php
15 index e0f5b86d..ffa4aa88 100644
16 --- a/include/phpsnmp/classSNMP.php
17 +++ b/include/phpsnmp/classSNMP.php
18 @@ -150,7 +150,7 @@ class SNMP {
19                                 $backup['valueretrieval'] = snmp_get_valueretrieval();
20                                 snmp_set_valueretrieval($this->valueretrieval);
21  
22 -                               $backup['quick_print']    = snmp_get_quick_print();
23 +                               $backup['quick_print'] = snmp_get_quick_print();
24                                 snmp_set_quick_print($this->quick_print);
25  
26                                 if ($this->oid_output_format !== NULL) {
27 diff --git a/lib/snmp.php b/lib/snmp.php
28 index 885a07ee..382f94aa 100644
29 --- a/lib/snmp.php
30 +++ b/lib/snmp.php
31 @@ -47,8 +47,8 @@ if (!class_exists('SNMP')) {
32         include_once($config['include_path'] . '/phpsnmp/classSNMP.php');
33  }
34  
35 -function cacti_snmp_session($hostname, $community, $version, $auth_user, $auth_pass,
36 -       $auth_proto, $priv_pass, $priv_proto, $context, $engineid,
37 +function cacti_snmp_session($hostname, $community, $version, $auth_user = '', $auth_pass = '',
38 +       $auth_proto = '', $priv_pass = '', $priv_proto = '', $context = '', $engineid = '',
39         $port = 161, $timeout = 500, $retries = 0, $max_oids = 10) {
40  
41         switch ($version) {
42 @@ -74,6 +74,7 @@ function cacti_snmp_session($hostname, $community, $version, $auth_user, $auth_p
43                 $session->valueretrieval = SNMP_VALUE_LIBRARY;
44         }
45  
46 +       $session->quick_print = false;
47         $session->max_oids = $max_oids;
48  
49         if (read_config_option('oid_increasing_check_disable') == 'on') {
50 @@ -105,8 +106,8 @@ function cacti_snmp_session($hostname, $community, $version, $auth_user, $auth_p
51         return $session;
52  }
53  
54 -function cacti_snmp_get($hostname, $community, $oid, $version, $auth_user, $auth_pass,
55 -       $auth_proto, $priv_pass, $priv_proto, $context,
56 +function cacti_snmp_get($hostname, $community, $oid, $version, $auth_user = '', $auth_pass = '',
57 +       $auth_proto = '', $priv_pass = '', $priv_proto = '', $context = '',
58         $port = 161, $timeout = 500, $retries = 0, $environ = SNMP_POLLER,
59         $engineid = '', $value_output_format = SNMP_STRING_OUTPUT_GUESS) {
60  
61 @@ -198,8 +199,8 @@ function cacti_snmp_get($hostname, $community, $oid, $version, $auth_user, $auth
62         return $snmp_value;
63  }
64  
65 -function cacti_snmp_get_raw($hostname, $community, $oid, $version, $auth_user, $auth_pass,
66 -       $auth_proto, $priv_pass, $priv_proto, $context,
67 +function cacti_snmp_get_raw($hostname, $community, $oid, $version, $auth_user = '', $auth_pass = '',
68 +       $auth_proto = '', $priv_pass = '', $priv_proto = '', $context = '',
69         $port = 161, $timeout = 500, $retries = 0, $environ = SNMP_POLLER,
70         $engineid = '', $value_output_format = SNMP_STRING_OUTPUT_GUESS) {
71  
72 @@ -287,8 +288,8 @@ function cacti_snmp_get_raw($hostname, $community, $oid, $version, $auth_user, $
73         return $snmp_value;
74  }
75  
76 -function cacti_snmp_getnext($hostname, $community, $oid, $version, $auth_user, $auth_pass,
77 -       $auth_proto, $priv_pass, $priv_proto, $context,
78 +function cacti_snmp_getnext($hostname, $community, $oid, $version, $auth_user = '', $auth_pass = '',
79 +       $auth_proto = '', $priv_pass = '', $priv_proto = '', $context = '',
80         $port = 161, $timeout = 500, $retries = 0, $environ = SNMP_POLLER,
81         $engineid = '', $value_output_format = SNMP_STRING_OUTPUT_GUESS) {
82  
83 @@ -530,8 +531,8 @@ function cacti_snmp_session_getnext($session, $oid) {
84         return $out;
85  }
86  
87 -function cacti_snmp_walk($hostname, $community, $oid, $version, $auth_user, $auth_pass,
88 -       $auth_proto, $priv_pass, $priv_proto, $context,
89 +function cacti_snmp_walk($hostname, $community, $oid, $version, $auth_user = '', $auth_pass = '',
90 +       $auth_proto = '', $priv_pass = '', $priv_proto = '', $context = '',
91         $port = 161, $timeout = 500, $retries = 0, $max_oids = 10, $environ = SNMP_POLLER,
92         $engineid = '', $value_output_format = SNMP_STRING_OUTPUT_GUESS) {
93  
94 commit afa01553f574554f782bbed3d2f1efaa355df2d0
95 Author: cigamit <jimmy@sqmail.org>
96 Date:   Sat Jun 2 20:16:28 2018 -0500
97
98     Additional Change for Issue #1634
99
100 diff --git a/cmd.php b/cmd.php
101 index 0820444d..5a17c7c6 100644
102 --- a/cmd.php
103 +++ b/cmd.php
104 @@ -525,7 +525,7 @@ if ((sizeof($polling_items) > 0) && (read_config_option('poller_enabled') == 'on
105  
106                                                         if (isset($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']])) {
107                                                                 $sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']]->quick_print = true;
108 -                                                               $output = cacti_snmp_session_get($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']], $index_item['arg1'], true);
109 +                                                               $output = cacti_snmp_session_get($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']], $index_item['arg1']);
110                                                         } else {
111                                                                 $output = 'U';
112                                                         }
113 commit 9311987e8a22e9c838bc879ff8eceae7abfbeb65
114 Author: cigamit <jimmy@sqmail.org>
115 Date:   Sat Jun 2 20:26:48 2018 -0500
116
117     Last update for issue #1634
118
119 diff --git a/cmd.php b/cmd.php
120 index 5a17c7c6..3061dc41 100644
121 --- a/cmd.php
122 +++ b/cmd.php
123 @@ -524,7 +524,6 @@ if ((sizeof($polling_items) > 0) && (read_config_option('poller_enabled') == 'on
124                                                         open_snmp_session($host_id, $item);
125  
126                                                         if (isset($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']])) {
127 -                                                               $sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']]->quick_print = true;
128                                                                 $output = cacti_snmp_session_get($sessions[$host_id . '_' . $item['snmp_version'] . '_' . $item['snmp_port']], $index_item['arg1']);
129                                                         } else {
130                                                                 $output = 'U';
This page took 0.10094 seconds and 3 git commands to generate.