scan_cifs: fix comment typo and indentation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2020-06-30 15:12:19 +02:00
parent 9afd3be18c
commit 436773fd78

View File

@ -1191,12 +1191,10 @@ sub scan_nfs {
sub scan_cifs { sub scan_cifs {
my ($server_in, $user, $password, $domain) = @_; my ($server_in, $user, $password, $domain) = @_;
my $server; my $server = resolv_server($server_in);
if (!($server = resolv_server ($server_in))) { die "unable to resolve address for server '${server_in}'\n" if !$server;
die "unable to resolve address for server '${server_in}'\n";
}
# we support only Windows grater than 2012 cifsscan so use smb3 # we only support Windows 2012 and newer, so just use smb3
my $cmd = ['/usr/bin/smbclient', '-m', 'smb3', '-d', '0', '-L', $server]; my $cmd = ['/usr/bin/smbclient', '-m', 'smb3', '-d', '0', '-L', $server];
if (defined($user)) { if (defined($user)) {
die "password is required\n" if !defined($password); die "password is required\n" if !defined($password);
@ -1208,16 +1206,16 @@ sub scan_cifs {
my $res = {}; my $res = {};
run_command($cmd, run_command($cmd,
outfunc => sub { noerr => 1,
my $line = shift; errfunc => sub { },
if ($line =~ m/(\S+)\s*Disk\s*(\S*)/) { outfunc => sub {
$res->{$1} = $2; my $line = shift;
} elsif ($line =~ m/(NT_STATUS_(\S*))/) { if ($line =~ m/(\S+)\s*Disk\s*(\S*)/) {
$res->{$1} = ''; $res->{$1} = $2;
} } elsif ($line =~ m/(NT_STATUS_(\S*))/) {
}, $res->{$1} = '';
errfunc => sub {}, }
noerr => 1 },
); );
return $res; return $res;