From 5c0734b7ab1a0de9a5612ac886ee0577cf1e9f28 Mon Sep 17 00:00:00 2001 From: jeroen Date: Mon, 22 Aug 2022 21:22:56 +0200 Subject: [PATCH] Update vacation.pl: -c wording change and remove some LF/CR --- VIRTUAL_VACATION/vacation.pl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/VIRTUAL_VACATION/vacation.pl b/VIRTUAL_VACATION/vacation.pl index eb37755..7c16022 100755 --- a/VIRTUAL_VACATION/vacation.pl +++ b/VIRTUAL_VACATION/vacation.pl @@ -22,7 +22,7 @@ use Getopt::Std; use DBI; use POSIX qw(strftime); -# -c = location of the SQL config file for OpenSMTPD +# -c = name SQL config file for OpenSMTPD, located in /etc/mail # -l = logging of virtual vacation parsed report/filter streams and decisions # -v = verbose (extra flag) logging of report stream # -d = debug (extra flag) logging of filter stream @@ -35,8 +35,8 @@ my $db_user = ''; my $db_pass = ''; my $db_name = ''; -if ($opt_c && -e $opt_c) { - open (my $fh_config, '<', $opt_c); +if ($opt_c && -e "/etc/mail/$opt_c") { + open (my $fh_config, '<', "/etc/mail/$opt_c"); while (my $line = <$fh_config>) { chomp $line; if ($line =~ /^host\s+(.*)$/) { $db_host = $1; } @@ -112,22 +112,17 @@ while (my $line = <>) { dolog($fh, "$sid to: $email, from: $from", $opt_l); $selvacation->bind_param(1, $email); $selvacation->execute; - if ($selvacation->rows == 1) { dolog($fh, "$sid found OOO for $email", $opt_l); my @vacation_msg = $selvacation->fetchrow_array; - $selcache->bind_param(1, $email); $selcache->bind_param(2, $from); $selcache->execute; - if ($selcache->rows == 0) { dolog($fh, "$sid sending OOO to $from", $opt_l); - $upcache->bind_param(1, $from); $upcache->bind_param(2, $email); $upcache->execute; - open my $fh_email, "|-", "/usr/sbin/sendmail -t"; print $fh_email "From: $email\n"; print $fh_email "To: $from\n";;