#!/home/product/code/webui-perl/bin/perl -T -I /home/product/code/firmware/current/lib/perl5
#SUDOER_USERS: nobody
#SUDOER_RUNAS_USERS: root, mta
#SUDOER_TAGS: NOPASSWD, NOEXEC
use strict;
use warnings;
use Barracuda::Sudo::Lib;
use Fcntl;
=pod

=head1 NAME

test_smb_mount

=head1 DESCRIPTION

The script verifies that the SMB mount point is accessible and writeable.

=cut

my $file_name = time() . rand();
my $fh = open_hardlink_path('/mnt/smb/' . $file_name, (O_RDWR | O_EXCL | O_CREAT));
failwith (250, "Failed to create file /mnt/smb/$file_name") if !defined $fh;
print $fh "TEST";
close $fh;


#open teh directory and remove the test file.
my $dh = open_hardlink_path('/mnt/smb/', (O_RDONLY));
failwith (250, "Failed to open directory /mnt/smb") if !defined $dh;
chdir $dh;
unlink $file_name;
close $dh;

