diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-27 15:37:31 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-27 15:37:31 +0000 |
commit | 6c61b8c7bfeaedfca53832c16b00b81f85ca5186 (patch) | |
tree | f647c7ada073ed41ea560444ca456ae2e366a34e /plugins-scripts/utils.pm.in | |
parent | 299c6bab02f4a2068a7ba8bdfefc6c155f7d7364 (diff) | |
download | monitoring-plugins-6c61b8c7bfeaedfca53832c16b00b81f85ca5186.tar.gz |
More edge testcases. Allow anything if ends with a . as long as correct
characters
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1531 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins-scripts/utils.pm.in')
-rw-r--r-- | plugins-scripts/utils.pm.in | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins-scripts/utils.pm.in b/plugins-scripts/utils.pm.in index e2458359..8449b544 100644 --- a/plugins-scripts/utils.pm.in +++ b/plugins-scripts/utils.pm.in | |||
@@ -53,9 +53,16 @@ sub usage { | |||
53 | 53 | ||
54 | sub is_hostname { | 54 | sub is_hostname { |
55 | my $host1 = shift; | 55 | my $host1 = shift; |
56 | 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]+)*)$/) { | 56 | return 0 unless defined $host1; |
57 | if ($host1 =~ m/^[\d\.]+$/ && $host1 !~ /\.$/) { | ||
58 | if ($host1 =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) { | ||
59 | return 1; | ||
60 | } else { | ||
61 | return 0; | ||
62 | } | ||
63 | } elsif ($host1 =~ m/^[a-zA-Z0-9][-a-zA-Z0-9]+(\.[a-zA-Z0-9][-a-zA-Z0-9]+)*\.?$/) { | ||
57 | return 1; | 64 | return 1; |
58 | }else{ | 65 | } else { |
59 | return 0; | 66 | return 0; |
60 | } | 67 | } |
61 | } | 68 | } |