#!/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, EXEC
use strict;
use warnings;
use Barracuda::Sudo::Lib;

=pod

=head1 NAME

service

=head1 DESCRIPTION

This sudoer wraps calls to '/sbin/service'; it accepts two arguments: a whitelisted service and one of either 'start', 'stop', 'restart', or 'reload'.

=cut

my @whitelist = (
    'pcapd',
    'squidd',
    'brsd'
);

my @args = get_argv(Barracuda::Sudo::Lib::is_whitelisted(@whitelist),
                    Barracuda::Sudo::Lib::is_whitelisted('start', 'stop', 'restart', 'reload'));

system_succeed("/sbin/service", @args);
