Pass snmp-auth parameters enclosed by single-quotes

This commit is contained in:
f0o
2015-08-20 19:19:15 +00:00
parent e15bbe1dde
commit 5e858b63e5

View File

@@ -748,7 +748,7 @@ function snmp_gen_auth(&$device) {
$cmd = ''; $cmd = '';
if ($device['snmpver'] === 'v3') { if ($device['snmpver'] === 'v3') {
$cmd = ' -v3 -n "" -l '.$device['authlevel']; $cmd = " -v3 -n '' -l '".$device['authlevel']."'";
if ($device['authlevel'] === 'noAuthNoPriv') { if ($device['authlevel'] === 'noAuthNoPriv') {
// We have to provide a username anyway (see Net-SNMP doc) // We have to provide a username anyway (see Net-SNMP doc)
@@ -756,16 +756,16 @@ function snmp_gen_auth(&$device) {
$cmd .= ' -u root'; $cmd .= ' -u root';
} }
else if ($device['authlevel'] === 'authNoPriv') { else if ($device['authlevel'] === 'authNoPriv') {
$cmd .= ' -a '.$device['authalgo']; $cmd .= " -a '".$device['authalgo']."'";
$cmd .= ' -A "'.$device['authpass'].'"'; $cmd .= " -A '".$device['authpass']."'";
$cmd .= ' -u '.$device['authname']; $cmd .= " -u '".$device['authname']."'";
} }
else if ($device['authlevel'] === 'authPriv') { else if ($device['authlevel'] === 'authPriv') {
$cmd .= ' -a '.$device['authalgo']; $cmd .= " -a '".$device['authalgo']."'";
$cmd .= ' -A "'.$device['authpass'].'"'; $cmd .= " -A '".$device['authpass']."'";
$cmd .= ' -u '.$device['authname']; $cmd .= " -u '".$device['authname']."'";
$cmd .= ' -x '.$device['cryptoalgo']; $cmd .= " -x '".$device['cryptoalgo']."'";
$cmd .= ' -X "'.$device['cryptopass'].'"'; $cmd .= " -X '".$device['cryptopass']."'";
} }
else { else {
if ($debug) { if ($debug) {