Patch for check_disk_smb (v2.2.1-4git)

Johan Fredriksson eskil at kth.se
Thu Apr 5 13:11:33 CEST 2018


Empty password is not the same thing as no password.

--- check_disk_smb.orig	2017-07-21 18:29:16.000000000 +0200
+++ check_disk_smb.new	2018-04-05 13:10:42.450873214 +0200
@@ -81,7 +81,7 @@
 defined($user) || usage("Invalid user: $opt_u\n");
 
 defined($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = "");
-my $pass = $1 if ($opt_p =~ /(.*)/);
+my $pass = $1 if ($opt_p =~ /(.+)/);
 
 ($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 85);
 my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
@@ -191,7 +191,7 @@
 my @cmd = (
 	$smbclient,
 	"//$host/$share",
-	"-U", "$user%$pass",
+	defined($pass) ? ("-U", "$user%$pass") : ("-N"),
 	defined($workgroup) ? ("-W", $workgroup) : (),
 	defined($address) ? ("-I", $address) : (),
 	defined($opt_P) ? ("-p", $opt_P) : (),



More information about the Devel mailing list