diff options
-rwxr-xr-x | plugins-scripts/check_disk_smb.pl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index c3f33ed..870e4e7 100755 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl | |||
@@ -64,26 +64,26 @@ my $smbclientoptions=""; | |||
64 | # Options checking | 64 | # Options checking |
65 | 65 | ||
66 | ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); | 66 | ($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); |
67 | my $host = $1 if ($opt_H =~ /([-_.A-Za-z0-9]+\$?)/); | 67 | my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9]+\$?)$/); |
68 | ($host) || usage("Invalid host: $opt_H\n"); | 68 | ($host) || usage("Invalid host: $opt_H\n"); |
69 | 69 | ||
70 | ($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n"); | 70 | ($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n"); |
71 | my $share = $1 if ($opt_s =~ /([-_.A-Za-z0-9]+\$?)/); | 71 | my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/); |
72 | ($share) || usage("Invalid share: $opt_s\n"); | 72 | ($share) || usage("Invalid share: $opt_s\n"); |
73 | 73 | ||
74 | ($opt_u) || ($opt_u = shift) || ($opt_u = "guest"); | 74 | ($opt_u) || ($opt_u = shift) || ($opt_u = "guest"); |
75 | my $user = $1 if ($opt_u =~ /([-_.A-Za-z0-9\\]+)/); | 75 | my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/); |
76 | ($user) || usage("Invalid user: $opt_u\n"); | 76 | ($user) || usage("Invalid user: $opt_u\n"); |
77 | 77 | ||
78 | ($opt_p) || ($opt_p = shift) || ($opt_p = "guest"); | 78 | ($opt_p) || ($opt_p = shift) || ($opt_p = "guest"); |
79 | my $pass = $1 if ($opt_p =~ /(.*)/); | 79 | my $pass = $1 if ($opt_p =~ /(.*)/); |
80 | 80 | ||
81 | ($opt_w) || ($opt_w = shift) || ($opt_w = 85); | 81 | ($opt_w) || ($opt_w = shift) || ($opt_w = 85); |
82 | my $warn = $1 if ($opt_w =~ /([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])/); | 82 | my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/); |
83 | ($warn) || usage("Invalid warning threshold: $opt_w\n"); | 83 | ($warn) || usage("Invalid warning threshold: $opt_w\n"); |
84 | 84 | ||
85 | ($opt_c) || ($opt_c = shift) || ($opt_c = 95); | 85 | ($opt_c) || ($opt_c = shift) || ($opt_c = 95); |
86 | my $crit = $1 if ($opt_c =~ /([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])/); | 86 | my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/); |
87 | ($crit) || usage("Invalid critical threshold: $opt_c\n"); | 87 | ($crit) || usage("Invalid critical threshold: $opt_c\n"); |
88 | 88 | ||
89 | # check if both warning and critical are percentage or size | 89 | # check if both warning and critical are percentage or size |