Browse Source

patch to check_disk_smb to allow empty passwords

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1163 f882894a-f735-0410-b71e-b25c423dba1c
M. Sean Finney 21 years ago
parent
commit
cf35fb4b92
1 changed files with 3 additions and 3 deletions
  1. 3 3
      plugins-scripts/check_disk_smb.pl

+ 3 - 3
plugins-scripts/check_disk_smb.pl

@@ -76,7 +76,7 @@ my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/);
 my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/);
 my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/);
 ($user) || usage("Invalid user: $opt_u\n");
 ($user) || usage("Invalid user: $opt_u\n");
 
 
-($opt_p) || ($opt_p = shift) || ($opt_p = "guest");
+($opt_p) || ($opt_p = shift) || ($opt_p = "");
 my $pass = $1 if ($opt_p =~ /(.*)/);
 my $pass = $1 if ($opt_p =~ /(.*)/);
 
 
 ($opt_w) || ($opt_w = shift) || ($opt_w = 85);
 ($opt_w) || ($opt_w = shift) || ($opt_w = 85);
@@ -123,10 +123,10 @@ alarm($TIMEOUT);
 # Execute an "ls" on the share using smbclient program
 # Execute an "ls" on the share using smbclient program
 # get the results into $res
 # get the results into $res
 if (defined($workgroup)) {
 if (defined($workgroup)) {
-	$res = qx/$smbclient \/\/$host\/$share $pass -W $workgroup -U $user $smbclientoptions -c ls/;
+	$res = qx/$smbclient \/\/$host\/$share -W $workgroup -U $user%$pass $smbclientoptions -c ls/;
 } else {
 } else {
 	print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose);
 	print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose);
-	$res = qx/$smbclient \/\/$host\/$share $pass -U $user $smbclientoptions -c ls/;
+	$res = qx/$smbclient \/\/$host\/$share -U $user%$pass $smbclientoptions -c ls/;
 }
 }
 #Turn off alarm
 #Turn off alarm
 alarm(0);
 alarm(0);