It does not give you a good reason when things break, I
got upset at that, and here is my solution:
I've checked this against the latest version in cvs,
and this seems to maintain happiness. If it doesn't
have a really good reason, then it will spit out the
reason from smbclient.
Starting in line 173:
} else {
#$answer = "Result from smbclient not suitable\n";
$_ = $lines[$#lines];
$answer = "BAD: $_\n";
$state = "UNKNOWN";
foreach (@lines) {
if (/Access denied/) {
$answer = "Access Denied\n";
$state = "CRITICAL";
last;
}
if (/(Unknown host \w*)/) {
$answer = "$1\n";
$state = "CRITICAL";
last;
}
if (/(You specified an invalid share
name)/) {
$answer = "Invalid share name
\\\\$host\\$share\n";
$state = "CRITICAL";
last;
}
if (/(Bad password)/) {
$answer = "Invalid
Username/Password on: \\\\$host\\$sha
re\n";
$state = "WARNING";
last;
}
}
}