From 76a3b9b87e5d7addba6c1cd8e3f75176ad820a66 Mon Sep 17 00:00:00 2001 From: Johan Date: Fri, 30 Sep 2016 15:07:57 +0200 Subject: [PATCH 1/3] I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md. --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 70b46bf4a8..153762649f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -135,6 +135,7 @@ LibreNMS contributors: - Florent Bruchez (ftbz) - Bartosz Radwan (bartoszradwan) - Kate Gerry (kate66) +- Johan Zaxmy (Zaxmy) [1]: http://observium.org/ "Observium web site" Observium was written by: From 032bfe0745889ae17673d5d5fdede4966cc61025 Mon Sep 17 00:00:00 2001 From: Johan Date: Fri, 30 Sep 2016 15:08:11 +0200 Subject: [PATCH 2/3] Fixes issue-4677 --- includes/snmp.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 4f448707db..e402993e3e 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -560,8 +560,8 @@ function snmp_gen_auth(&$device) if ($device['authlevel'] === 'noAuthNoPriv') { // We have to provide a username anyway (see Net-SNMP doc) - // FIXME: There are two other places this is set - why are they ignored here? - $cmd .= ' -u root'; + $username = isset($device['authname']) ? $device['authname'] : 'root'; + $cmd .= " -u '".$username."'"; } elseif ($device['authlevel'] === 'authNoPriv') { $cmd .= " -a '".$device['authalgo']."'"; $cmd .= " -A '".$device['authpass']."'"; From 59da343f7d51a1a47e4618afdd4547c180ff4f8d Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Mon, 3 Oct 2016 18:23:59 +0100 Subject: [PATCH 3/3] changed from isset to !empty --- includes/snmp.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index e402993e3e..10e11d9110 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -560,7 +560,7 @@ function snmp_gen_auth(&$device) if ($device['authlevel'] === 'noAuthNoPriv') { // We have to provide a username anyway (see Net-SNMP doc) - $username = isset($device['authname']) ? $device['authname'] : 'root'; + $username = !empty($device['authname']) ? $device['authname'] : 'root'; $cmd .= " -u '".$username."'"; } elseif ($device['authlevel'] === 'authNoPriv') { $cmd .= " -a '".$device['authalgo']."'";