diff --git a/debian/changelog b/debian/changelog index 22b3c7c..87869f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,13 +26,15 @@ nagios-plugins (1.4.12-1) UNRELEASED; urgency=low informations see REQUIREMENTS) * add 33_fix_emb_check_disk_smb.dpatch which fixes processing via embedded perl of check_disk_smb (Closes: #478906) + * add 34_fix_smbclient_check_disk_smb.dpatch which fixes usage of smbclient + (Closes: #478942) [ Alexander Wirt ] * Call smbclient with -N (supress password prompt) if no password is supplied. Thanks to Josip Rodin for the patch (Closes: #425129) * Add myself to uploaders - -- Jan Wagner Sun, 04 May 2008 14:18:55 +0200 + -- Jan Wagner Fri, 06 Jun 2008 12:25:59 +0200 nagios-plugins (1.4.11-2) unstable; urgency=low diff --git a/debian/patches/00list b/debian/patches/00list index df3ef67..49af3e1 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -8,4 +8,5 @@ 27_check_radius_segfault.dpatch 32_check_ldap_pointer.dpatch 33_fix_emb_check_disk_smb.dpatch +34_fix_smbclient_check_disk_smb.dpatch 50_misc_typos.dpatch diff --git a/debian/patches/34_fix_smbclient_check_disk_smb.dpatch b/debian/patches/34_fix_smbclient_check_disk_smb.dpatch new file mode 100755 index 0000000..8008e51 --- /dev/null +++ b/debian/patches/34_fix_smbclient_check_disk_smb.dpatch @@ -0,0 +1,153 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 34_fix_smbclient_check_disk_smb.dpatch by Jan Wagner +## patch provided by Stephane Chazelas +## +## DP: Fixes use of smbclient + +@DPATCH@ +diff -urNad nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl +--- nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl 2008-06-06 12:19:16.000000000 +0200 ++++ nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl 2008-06-06 12:19:16.000000000 +0200 +@@ -26,17 +26,13 @@ + use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose); + use vars qw($PROGNAME); + use lib utils.pm ; +-use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); ++use utils qw($TIMEOUT %ERRORS &print_revision &support &usage &output_and_error_of); + + sub print_help (); + sub print_usage (); + + $PROGNAME = "check_disk_smb"; + +-$ENV{'PATH'}=''; +-$ENV{'BASH_ENV'}=''; +-$ENV{'ENV'}=''; +- + Getopt::Long::Configure('bundling'); + GetOptions + ("v" => \$verbose, "verbose" => \$verbose, +@@ -59,9 +55,7 @@ + + if ($opt_h) {print_help(); exit $ERRORS{'OK'};} + +-my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; +-my $smbclientoptions= $opt_P ? "-p $opt_P " : ""; +- ++my $smbclient = $utils::PATH_TO_SMBCLIENT; + + # Options checking + +diff -urNad nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl.rej nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl.rej +--- nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl.rej 1970-01-01 01:00:00.000000000 +0100 ++++ nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl.rej 2008-06-06 12:19:16.000000000 +0200 +@@ -0,0 +1,66 @@ ++*************** ++*** 72,80 **** ++ my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/); ++ ($share) || usage("Invalid share: $opt_s\n"); ++ ++- ($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"); ++ ++ ($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = ""); ++ my $pass = $1 if ($opt_p =~ /(.*)/); ++--- 66,74 ---- ++ my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/); ++ ($share) || usage("Invalid share: $opt_s\n"); ++ +++ defined($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest"); +++ my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]*)$/); +++ defined($user) || usage("Invalid user: $opt_u\n"); ++ ++ ($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = ""); ++ my $pass = $1 if ($opt_p =~ /(.*)/); ++*************** ++*** 162,184 **** ++ ++ # Execute an "ls" on the share using smbclient program ++ # get the results into $res ++- if (defined($workgroup)) { ++- if (defined($address)) { ++- print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls\n" if ($verbose); ++- $res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls/; ++- } else { ++- print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -c ls\n" if ($verbose); ++- $res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -c ls/; ++- } ++- } else { ++- if (defined($address)) { ++- print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -I $address -c ls\n" if ($verbose); ++- $res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -I $address -c ls/; ++- } else { ++- print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); ++- $res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -c ls/; ++- } ++- } ++ #Turn off alarm ++ alarm(0); ++ ++--- 156,174 ---- ++ ++ # Execute an "ls" on the share using smbclient program ++ # get the results into $res +++ my @cmd = ( +++ $smbclient, +++ "//$host/$share", +++ "-U", "$user%$pass", +++ defined($workgroup) ? ("-W", $workgroup) : (), +++ defined($address) ? ("-I", $address) : (), +++ defined($opt_P) ? ("-p", $opt_P) : (), +++ "-c", "ls" +++ ); +++ +++ print join(" ", @cmd) . "\n" if ($verbose); +++ $res = output_and_error_of(@cmd) or exit $ERRORS{"UNKNOWN"}; +++ ++ #Turn off alarm ++ alarm(0); ++ +diff -urNad nagios-plugins-1.4.12~/plugins-scripts/utils.pm.in nagios-plugins-1.4.12/plugins-scripts/utils.pm.in +--- nagios-plugins-1.4.12~/plugins-scripts/utils.pm.in 2007-07-07 13:55:48.000000000 +0200 ++++ nagios-plugins-1.4.12/plugins-scripts/utils.pm.in 2008-06-06 12:21:06.000000000 +0200 +@@ -8,7 +8,8 @@ + + require Exporter; + @ISA = qw(Exporter); +-@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage); ++@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage ++ &output_of &output_and_error_of); + + #use strict; + #use vars($TIMEOUT %ERRORS); +@@ -67,4 +68,29 @@ + } + } + ++sub output_of { ++ local *CMD; ++ local $/ = undef; ++ if (open CMD, "-|", @_) { ++ return ; ++ close CMD; ++ } ++ return undef; ++} ++ ++sub output_and_error_of { ++ local *CMD; ++ local $/ = undef; ++ my $pid = open CMD, "-|"; ++ if (defined($pid)) { ++ if ($pid) { ++ return ; ++ } else { ++ open STDERR, ">&STDOUT" and exec @_; ++ exit(1); ++ } ++ } ++ return undef; ++} ++ + 1;