#!/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 Barracuda::Sudo::SafeOpen;
use Fcntl;

=pod

=head1 NAME

sub_expired

=head1 DESCRIPTION

touches or removes /etc/barracuda/sub_expired; accepts either 'create' or 'destroy' as arguments

=cut

my ($arg) = get_argv(Barracuda::Sudo::is_whitelisted('create','destroy'));

if ($arg == 'create') {
    my $fh = Barracuda::Sudo::SafeOpen::open_hardlink_path('/etc/barracuda/sub_expired', O_WRONLY) or die $!;
    close $fh;
}
if ($arg == 'destroy') {
    unlink '/etc/barracuda/sub_expired' or die $!;
}

