Hi Blues,
*** Warning - for testing only ***
Included openwebmail codes into BQ code base to fix
auto-reply to local users that will cause infinite looping.
ie: mailer-daemon, etc
--- /usr/local/sbin/vacation.pl 2006-07-25 20:02:25.000000000 +0800
+++ /usr/local/sbin/vacation.pl.testing.patricko 2006-07-25 20:01:44.000000000
+0800 @@ -16,6 +16,18 @@
use FileHandle;
use I18nMail;
+my @ignores = (
+ 'daemon',
+ 'postmaster',
+ 'mailer-daemon',
+ 'mailer',
+ 'root',
+ );
+
+my ($opt_d)=(1);
+
+my @aliases = ();
+
my ($message_file,$user_from) = @ARGV;
my $Sendmail = Sauce::Config::bin_sendmail;
@@ -85,7 +97,7 @@
while (<STDIN>)
{
- if (/From:\s*(.+)/) { $from = $1; }
+ if (/^From:\s*(\S+)/) { $from = $1; }
elsif (/Reply-To:\s*(.+)/) { $replyto = $1; }
elsif (/Sender:\s*(.+)/) { $sender = $1; }
elsif (/Return-path:\s*(.+)/) { $returnpath = $1; }
@@ -100,6 +112,17 @@
elsif ($returnpath) { $sendto = $returnpath; }
else { exit; }
+
+
+ for (@ignores) {
+ if ($from =~ /^$_$/i ) {
+ log_debug("Message from ignored user $_, autoreply canceled\n") if ($opt_d);
+ exit 0;
+ }
+ }
+
+
+
my %vacadb;
my $vacadb = tie(%vacadb,'DB_File',"$Vaca_dir/.$username.db",O_RDWR|O_CREAT,0666)
@@ -176,3 +199,25 @@
undef $db;
}
+
+########### THIS FUNCTION FROM OPENWEBMAIL ###############
+sub log_debug {
+ my @msg=@_;
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
+ my ($today, $time);
+
+ ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime;
+ $today=sprintf("%4d%02d%02d", $year+1900, $mon+1, $mday);
+ $time=sprintf("%02d%02d%02d",$hour,$min, $sec);
+
+ open(Z, ">> /tmp/vacation.debug");
+
+ # unbuffer mode
+ select(Z); local $| = 1;
+ select(STDOUT);
+
+ print Z "$today $time ", join(" ",@msg), "\n";
+ close(Z);
+
+ chmod(0666, "/tmp/vacation.debug");
+}
On Mon, 24 Jul 2006 21:20:42 +0200
Michael Stauber <bq (at mark) solarspeed.net> wrote:
> Hi patricko,
>
> > I thought of alterating the vacation.pl to write as root for .db
> > But after reading up on sendmail clientmqueue, I know this is not
> > possible.
> >
> > Why?
> > The design of clientmqueue, prevented root access to .forward
> > So have to drop 'chown permission on .db in /home/sites to root.'
>
> At the worst change the line ...
>
> O DontBlameSendmail=forwardfileingroupwritabledirpath
>
> ... in /etc/mail/sendmail.cf to this:
>
> O DontBlameSendmail=forwardfileingroupwritabledirpath,
> ForwardFileInUnsafeDirPath, ForwardFileInUnsafeDirPathSafe
>
> (all on one line, of course)
>
> It relaxes sendmails strictness on .forward files.
>
> --
>
> With best regards,
>
> Michael Stauber