[Pkg-nagios-changes] [pkg-nagios-plugins] 150/413: fix check_disk_smb

Jan Wagner waja at moszumanska.debian.org
Tue Nov 26 23:13:17 UTC 2013


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins.

commit f84baee39c7e29a7afe174a9de2d1878734c8fb0
Author: Jan Wagner <waja at cyconet.org>
Date:   Thu Jul 3 08:29:00 2008 +0000

    fix check_disk_smb
---
 debian/changelog                                   |  2 +
 .../patches/34_fix_smbclient_check_disk_smb.dpatch | 61 ++++++++++++++++++++--
 2 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1b427dc..3478090 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ nagios-plugins (1.4.12-2) UNRELEASED; urgency=low
   * add 40_check_http_status_line.dpatch to add content of the status_line
     into the check_http output (Closes: #486932)
   * clean patches from reject files left from dpatch-edit-patch
+  * fix 34_fix_smbclient_check_disk_smb.dpatch, thanks Stephane Chazelas
+    <stephane at artesyncp.com> for helping out here (Closes: #488820)
 
  -- Jan Wagner <waja at cyconet.org>  Wed, 18 Jun 2008 13:53:00 +0200
 
diff --git a/debian/patches/34_fix_smbclient_check_disk_smb.dpatch b/debian/patches/34_fix_smbclient_check_disk_smb.dpatch
index 231b0a7..0e53eb1 100755
--- a/debian/patches/34_fix_smbclient_check_disk_smb.dpatch
+++ b/debian/patches/34_fix_smbclient_check_disk_smb.dpatch
@@ -6,8 +6,8 @@
 
 @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
+--- nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl	2008-07-02 23:08:03.000000000 +0200
++++ nagios-plugins-1.4.12/plugins-scripts/check_disk_smb.pl	2008-07-02 23:10:42.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);
@@ -38,9 +38,64 @@ diff -urNad nagios-plugins-1.4.12~/plugins-scripts/check_disk_smb.pl nagios-plug
  
  # Options checking
  
+@@ -73,13 +67,12 @@
+ 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");
++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 = "");
++defined($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = "");
+ my $pass = $1 if ($opt_p =~ /(.*)/);
+-$pass = "-N" if ($opt_p eq "");
+ 
+ ($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 85);
+ my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
+@@ -163,23 +156,19 @@
+ 
+ # 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/;
+-	}
+-}
++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
++++ nagios-plugins-1.4.12/plugins-scripts/utils.pm.in	2008-07-02 23:08:04.000000000 +0200
 @@ -8,7 +8,8 @@
  
  require Exporter;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins.git



More information about the Pkg-nagios-changes mailing list