[Nagiosplug-checkins] nagiosplug/plugins-scripts utils.pm.in, 1.10, 1.11
Ton Voon
tonvoon at users.sourceforge.net
Fri Oct 27 17:37:33 CEST 2006
Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3566
Modified Files:
utils.pm.in
Log Message:
More edge testcases. Allow anything if ends with a . as long as correct
characters
Index: utils.pm.in
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/utils.pm.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- utils.pm.in 26 Oct 2006 21:02:21 -0000 1.10
+++ utils.pm.in 27 Oct 2006 15:37:31 -0000 1.11
@@ -53,9 +53,16 @@
sub is_hostname {
my $host1 = shift;
- if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z0-9][-a-zA-Z0-9]+(\.[a-zA-Z0-9][-a-zA-Z0-9]+)*)$/) {
+ return 0 unless defined $host1;
+ if ($host1 =~ m/^[\d\.]+$/ && $host1 !~ /\.$/) {
+ if ($host1 =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) {
+ return 1;
+ } else {
+ return 0;
+ }
+ } elsif ($host1 =~ m/^[a-zA-Z0-9][-a-zA-Z0-9]+(\.[a-zA-Z0-9][-a-zA-Z0-9]+)*\.?$/) {
return 1;
- }else{
+ } else {
return 0;
}
}
More information about the Commits
mailing list