SF.net SVN: postfixadmin:[734] trunk/VIRTUAL_VACATION/vacation.pl
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2009-10-21 08:00:17
|
Revision: 734 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=734&view=rev Author: GingerDog Date: 2009-10-21 08:00:07 +0000 (Wed, 21 Oct 2009) Log Message: ----------- vacation.pl: see email conversation with st...@ba... and #2835877 (https://sourceforge.net/tracker/?func=detail&aid=2835877&group_id=191583&atid=937964); thanks to stevan for taking the time to explain why he was right :) - this change makes the vacation script look for user#do...@va...main in the alias table, rather than user@domain, which is a better check (as it implies they also have vacation turned on) Modified Paths: -------------- trunk/VIRTUAL_VACATION/vacation.pl Modified: trunk/VIRTUAL_VACATION/vacation.pl =================================================================== --- trunk/VIRTUAL_VACATION/vacation.pl 2009-10-20 19:25:20 UTC (rev 733) +++ trunk/VIRTUAL_VACATION/vacation.pl 2009-10-21 08:00:07 UTC (rev 734) @@ -17,7 +17,7 @@ # Slightly better logging which includes messageid # Avoid infinite loops with domain aliases # -# 2005-01-19 Troels Arvin <tr...@ar...> +# 2005-01-19 Troels Arvin <troels at arvin.dk> # PostgreSQL-version. # Normalized DB schema from one vacation table ("vacation") # to two ("vacation", "vacation_notification"). Uses @@ -27,18 +27,18 @@ # to try to avoid SQL injection. # International characters are now handled well. # -# 2005-01-21 Troels Arvin <tr...@ar...> +# 2005-01-21 Troels Arvin <troels at arvin.dk> # Uses the Email::Valid package to avoid sending notices # to obviously invalid addresses. # -# 2007-08-15 David Goodwin <da...@pa...> +# 2007-08-15 David Goodwin <david at palepurple.co.uk> # Use the Perl Mail::Sendmail module for sending mail # Check for headers that start with blank lines (patch from forum) # -# 2007-08-20 Martin Ambroz <am...@tr...> +# 2007-08-20 Martin Ambroz <amsys at trustica.cz> # Added initial Unicode support # -# 2008-05-09 Fabio Bonelli <fab...@li...> +# 2008-05-09 Fabio Bonelli <fabiobonelli at libero.it> # Properly handle failed queries to vacation_notification. # Fixed log reporting. # @@ -326,10 +326,13 @@ $realemail = $email; $logger->debug("Found '\$email'\ has vacation active"); } else { + my $vemail = $email; + $vemail =~ s/\@/#/g; + $vemail = $vemail . "\@" . $vacation_domain; $logger->debug("Looking for alias records that \'$email\' resolves to with vacation turned on"); - $query = qq{SELECT goto FROM alias WHERE address=? AND (goto LIKE ? OR goto LIKE ? OR goto LIKE ?)}; + $query = qq{SELECT goto FROM alias WHERE address=? AND (goto LIKE ? OR goto LIKE ? OR goto LIKE ? OR goto = ?)}; $stm = $dbh->prepare($query) or panic_prepare($query); - $stm->execute($email,"$email,%","%,$email","%,$email,%") or panic_execute($query,"address='$email'"); + $stm->execute($email,"$vemail,%","%,$vemail","%,$vemail,%", "$vemail") or panic_execute($query,"address='$email'"); $rv = $stm->rows; # Recipient is an alias, check if mailbox has vacation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |