#!/usr/local/bin/php . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require("guiconfig.inc"); if (!is_array($config['snmpd'])) { $config['snmpd'] = array(); $config['snmpd']['rocommunity'] = "public"; } $pconfig['enable'] = isset($config['snmpd']['enable']); $pconfig['syslocation'] = $config['snmpd']['syslocation']; $pconfig['syscontact'] = $config['snmpd']['syscontact']; $pconfig['rocommunity'] = $config['snmpd']['rocommunity']; /* disabled until some docs show up on what this does. $pconfig['rwenable'] = isset($config['snmpd']['rwenable']); $pconfig['rwcommunity'] = $config['snmpd']['rwcommunity']; */ $pconfig['trapenable'] = isset($config['snmpd']['trapenable']); $pconfig['trapserver'] = $config['snmpd']['trapserver']; $pconfig['trapserverport'] = $config['snmpd']['trapserverport']; $pconfig['trapstring'] = $config['snmpd']['trapstring']; if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['enable']) { $reqdfields = explode(" ", "rocommunity"); $reqdfieldsn = explode(",", "Community"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } if ($_POST['trapenable']) { $reqdfields = explode(" ", "trapserver"); $reqdfieldsn = explode(",", "Trap server"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); $reqdfields = explode(" ", "trapserverport"); $reqdfieldsn = explode(",", "Trap server port"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); $reqdfields = explode(" ", "trapstring"); $reqdfieldsn = explode(",", "Trap string"); do_input_validation($_POST, $reqdfields, $reqdfields, $reqdfieldsn, &$input_errors); } /* disabled until some docs show up on what this does. if ($_POST['rwenable']) { $reqdfields = explode(" ", "rwcommunity"); $reqdfieldsn = explode(",", "Write community string"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } */ if (!$input_errors) { $config['snmpd']['enable'] = $_POST['enable'] ? true : false; $config['snmpd']['syslocation'] = $_POST['syslocation']; $config['snmpd']['syscontact'] = $_POST['syscontact']; $config['snmpd']['rocommunity'] = $_POST['rocommunity']; /* disabled until some docs show up on what this does. $config['snmpd']['rwenable'] = $_POST['rwenable'] ? true : false; $config['snmpd']['rwcommunity'] = $_POST['rwcommunity']; */ $config['snmpd']['trapenable'] = $_POST['trapenable'] ? true : false; $config['snmpd']['trapserver'] = $_POST['trapserver']; $config['snmpd']['trapserverport'] = $_POST['trapserverport']; $config['snmpd']['trapstring'] = $_POST['trapstring']; write_config(); $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { config_lock(); $retval = services_snmpd_configure(); config_unlock(); } $savemsg = get_std_save_message($retval); } } ?> <?=gentitle("Services: SNMP");?>

Services: SNMP

*/ ?>
SNMP Daemon onClick="enable_change(this)"> Enable
System location
System contact
Read Community String
In most cases, "public" is used here
  onClick="enable_change(this)"> Enable Write Community String
Write community string
Please use something other then "private" here
  onClick="enable_change(this)"> Enable SNMP Traps
Trap server
Enter trap server name
Trap server port
Enter the port to send the traps to (default 162)
Trap server port
Trap string