aboutsummaryrefslogtreecommitdiffstats
path: root/packages/nut
diff options
context:
space:
mode:
authorRyan Wagoner <rsw686@pfsense.org>2007-02-18 01:12:06 +0000
committerRyan Wagoner <rsw686@pfsense.org>2007-02-18 01:12:06 +0000
commit62be77b87821b9f794bbe2aaa2a67072a2af64c8 (patch)
treec203a1c2b45b0bc015c428e44acd4cafd88ebdf6 /packages/nut
parent936e4e2958efef52d4ebb77f7ca78726d70b43ef (diff)
downloadpfsense-packages-62be77b87821b9f794bbe2aaa2a67072a2af64c8.tar.gz
pfsense-packages-62be77b87821b9f794bbe2aaa2a67072a2af64c8.tar.bz2
pfsense-packages-62be77b87821b9f794bbe2aaa2a67072a2af64c8.zip
-only allow Aa-Zz 0-9 _ - in the ups name field
-correct field names for input validation
Diffstat (limited to 'packages/nut')
-rw-r--r--packages/nut/nut.inc18
1 files changed, 11 insertions, 7 deletions
diff --git a/packages/nut/nut.inc b/packages/nut/nut.inc
index 32af50cf..abf3e73f 100644
--- a/packages/nut/nut.inc
+++ b/packages/nut/nut.inc
@@ -129,23 +129,27 @@
/* monitor remote validation */
if($post['monitor'] == 'remote') {
if(!$post['remotename'])
- $input_errors[] = 'You must specify a name in the \'Remote Name\' field';
+ $input_errors[] = 'You must specify a name in the \'Remote UPS Name\' field';
+ if($post['remotename'] && !eregi('^[a-z0-9_.-]+$', $post['remotename']))
+ $input_errors[] = 'Only [Aa-Zz], [0-9], and [-_] accepted in the \'Remote UPS Name\' field';
if(!$post['remoteaddr'] || !nut_validate_ip($post['remoteaddr'],false))
- $input_errors[] = 'You must specify a valid address \'Remote Address\' field';
+ $input_errors[] = 'You must specify a valid address \'Remote UPS Address\' field';
if(!$post['remoteuser'])
- $input_errors[] = 'You must specify a name in the \'Remote User\' field';
+ $input_errors[] = 'You must specify a name in the \'Remote UPS User\' field';
if(!$post['remotepass'])
- $input_errors[] = 'You must specify a name in the \'Remote Password\' field';
+ $input_errors[] = 'You must specify a name in the \'Remote UPS Password\' field';
}
/* monitor local validation */
elseif($post['monitor'] == 'local') {
if(!$post['name'])
- $input_errors[] = 'You must specify a name in the \'Name\' field';
+ $input_errors[] = 'You must specify a name in the \'Local UPS Name\' field';
+ if($post['name'] && !eregi('^[a-z0-9_.-]+$', $post['name']))
+ $input_errors[] = 'Only [Aa-Zz], [0-9], and [-_] accepted in the \'Local UPS Name\' field';
if(!$post['driver'])
- $input_errors[] = 'You must select a driver in the \'Driver\' field';
+ $input_errors[] = 'You must select a driver in the \'Local UPS Driver\' field';
if(!$post['port'])
- $input_errors[] = 'You must select a port in the \'Port\' field';
+ $input_errors[] = 'You must select a port in the \'Local UPS Port\' field';
if($post['allowaddr'] && !nut_validate_ip($post['allowaddr'],true))
$input_errors[] = 'You must specify a valid address \'Local Remote Access Address\' field';
}