* fix: detect a failed SNMP walk by exit code, not by device data
cacti_snmp_walk() discarded the entire walk when its output contained the word
Timeout. That output is the walk itself, one line per OID, so a device with an
ifAlias of 'Timeout Monitor' or a matching sysDescr emptied the result and
data_query.php then dropped every index for the device.
The check could not detect a real timeout either. net-snmp writes that to
stderr and neither walk command redirects it, so the matched string was always
device data. cacti_snmp_get() already reads the exit code for exactly this
reason; exec_into_array() exposes it by reference.
Also refuse a walk with empty credentials, matching cacti_snmp_get, get_raw and
getnext. An unknown v3 protocol previously built a credential-less snmpwalk and
failed with no log line.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test: cover the credential guard and refresh the security baselines
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test: give the exec_into_array stub the real signature
The stub dropped the by-reference exit code that lib/functions.php exposes, so
any code reading it saw 0 regardless of what the command returned. That is why
the walk's failure detection could regress to matching stdout without a test
noticing.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
* test: expect the exit-code wording for a failed walk
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
---------
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>