Code

Fix Debian bug #478906: Failure when run via ePN
authorHolger Weiss <holger@zedat.fu-berlin.de>
Sun, 11 Apr 2010 07:54:10 +0000 (09:54 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Sun, 11 Apr 2010 07:54:10 +0000 (09:54 +0200)
| When perl plugin scripts are run with the embedded perl interpreter in
| nagios3, the "shift" perl command doesn't shift @ARGV, but @_ (which
| happens to contain the same thing as @ARGV at the time the script was
| started).
|
| [...]
|
| A fix is to replace all the instances of "shift" with "shift @ARGV".

[ http://bugs.debian.org/478906 ]

(Fixed by Stephane Chazelas, forwarded by Jan Wagner.)

NEWS
THANKS.in
plugins-scripts/check_disk_smb.pl

diff --git a/NEWS b/NEWS
index 5827db694941ab46b9cb2d7414751dc0b5850016..7efebbd7f995aa9528be456d38883eb6eee58833 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ This file documents the major additions and syntax changes between releases.
        Fix regression introduced in #1867716 where partially valid performance strings would not be printed anymore
        Fix regression in check_http ssl checks on some servers - make SNI an option
        Fix guest mode support in check_disk_smb
        Fix regression introduced in #1867716 where partially valid performance strings would not be printed anymore
        Fix regression in check_http ssl checks on some servers - make SNI an option
        Fix guest mode support in check_disk_smb
+       Fix check_disk_smb failure when run via ePN
        WARNINGS
        Updated developer documentation to say that performance labels should not have an equals sign or
        single quote in the label
        WARNINGS
        Updated developer documentation to say that performance labels should not have an equals sign or
        single quote in the label
index cc6e1941a656383d46c329d0e39877d8a412e140..f62a4d8ee4c72ee88a745bf427e73ca8055877cd 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
@@ -262,3 +262,4 @@ Jimmy Bergman
 Konstantin Khomoutov
 Josip Rodin
 Dann Frazier
 Konstantin Khomoutov
 Josip Rodin
 Dann Frazier
+Stephane Chazelas
index 022fa505ceabe4913e102e6cd1b6696dbdd322a5..ca593d468480bb9384324914d530cef495339992 100755 (executable)
@@ -64,27 +64,27 @@ my $smbclientoptions= $opt_P ? "-p $opt_P " : "";
 
 # Options checking
 
 
 # Options checking
 
-($opt_H) || ($opt_H = shift) || usage("Host name not specified\n");
+($opt_H) || ($opt_H = shift @ARGV) || usage("Host name not specified\n");
 my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
 ($host) || usage("Invalid host: $opt_H\n");
 
 my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
 ($host) || usage("Invalid host: $opt_H\n");
 
-($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n");
+($opt_s) || ($opt_s = shift @ARGV) || usage("Share volume not specified\n");
 my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/);
 ($share) || usage("Invalid share: $opt_s\n");
 
 my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/);
 ($share) || usage("Invalid share: $opt_s\n");
 
-($opt_u) || ($opt_u = shift) || ($opt_u = "guest");
+($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest");
 my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/);
 ($user) || usage("Invalid user: $opt_u\n");
 
 my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/);
 ($user) || usage("Invalid user: $opt_u\n");
 
-($opt_p) || ($opt_p = shift) || ($opt_p = "");
+($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = "");
 my $pass = $1 if ($opt_p =~ /(.*)/);
 $pass = "-N" if ($opt_p eq "");
 
 my $pass = $1 if ($opt_p =~ /(.*)/);
 $pass = "-N" if ($opt_p eq "");
 
-($opt_w) || ($opt_w = shift) || ($opt_w = 85);
+($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 85);
 my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
 ($warn) || usage("Invalid warning threshold: $opt_w\n");
 
 my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
 ($warn) || usage("Invalid warning threshold: $opt_w\n");
 
-($opt_c) || ($opt_c = shift) || ($opt_c = 95);
+($opt_c) || ($opt_c = shift @ARGV) || ($opt_c = 95);
 my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
 ($crit) || usage("Invalid critical threshold: $opt_c\n");
 
 my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
 ($crit) || usage("Invalid critical threshold: $opt_c\n");