From: Jan Schneider Date: Wed, 16 Sep 2009 12:51:24 +0000 (+0200) Subject: MFB: Fix procmail vacation rule (micha@kovoks.nl, Bug #7052). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=19e4902b7388356321c589fd133a66046649fd52;p=horde.git MFB: Fix procmail vacation rule (micha@kovoks.nl, Bug #7052). --- diff --git a/ingo/docs/CHANGES b/ingo/docs/CHANGES index c721eeba4..543f396b7 100644 --- a/ingo/docs/CHANGES +++ b/ingo/docs/CHANGES @@ -10,6 +10,7 @@ v2.0-git v1.2.3-cvs ---------- +[jan] Fix procmail vacation rule (micha@kovoks.nl, Bug #7052). [jan] Prevent deadlock with vacation rule in maildrop driver (Bug #8577). diff --git a/ingo/lib/Script/Procmail.php b/ingo/lib/Script/Procmail.php index f0228432d..c2b26f313 100644 --- a/ingo/lib/Script/Procmail.php +++ b/ingo/lib/Script/Procmail.php @@ -467,63 +467,64 @@ class Procmail_Recipe { $this->_action[] = '{'; foreach ($params['action-value']['addresses'] as $address) { if (!empty($address)) { - $this->_action[] = ' FILEDATE=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && ' + $this->_action[] = ' :0'; + $this->_action[] = ' * ^TO_' . $address; + $this->_action[] = ' {'; + $this->_action[] = ' FILEDATE=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && ' . $this->_params['ls'] . ' -lcn --time-style=+%s ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' | ' . 'awk \'{ print $6 + (' . $days * 86400 . ') }\'`'; - $this->_action[] = ' DATE=`' . $this->_params['date'] . ' +%s`'; - $this->_action[] = ' DUMMY=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && ' + $this->_action[] = ' DATE=`' . $this->_params['date'] . ' +%s`'; + $this->_action[] = ' DUMMY=`test -f ${VACATION_DIR:-.}/\'.vacation.' . $address . '\' && ' . 'test $FILEDATE -le $DATE && ' . 'rm ${VACATION_DIR:-.}/\'.vacation.' . $address . '\'`'; if ($timed) { - $this->_action[] = ' START=' . $params['action-value']['start']; - $this->_action[] = ' END=' . $params['action-value']['end']; + $this->_action[] = ' START=' . $params['action-value']['start']; + $this->_action[] = ' END=' . $params['action-value']['end']; } $this->_action[] = ''; - $this->_action[] = ' :0 h'; - $this->_action[] = ' SUBJECT=| formail -xSubject:'; + $this->_action[] = ' :0 h'; + $this->_action[] = ' SUBJECT=| formail -xSubject:'; $this->_action[] = ''; - $this->_action[] = ' :0 Whc: ${VACATION_DIR:-.}/vacation.lock'; + $this->_action[] = ' :0 Whc: ${VACATION_DIR:-.}/vacation.lock'; if ($timed) { - $this->_action[] = ' * ? test $DATE -gt $START && test $END -gt $DATE'; - $this->_action[] = ' {'; - $this->_action[] = ' :0 Whc'; + $this->_action[] = ' * ? test $DATE -gt $START && test $END -gt $DATE'; + $this->_action[] = ' {'; + $this->_action[] = ' :0 Wh'; } - $this->_action[] = ' * ^TO_' . $address; - $this->_action[] = ' * !^X-Loop: ' . $address; - $this->_action[] = ' * !^X-Spam-Flag: YES'; + $this->_action[] = ' * ^TO_' . $address; + $this->_action[] = ' * !^X-Loop: ' . $address; + $this->_action[] = ' * !^X-Spam-Flag: YES'; if (count($params['action-value']['excludes']) > 0) { foreach ($params['action-value']['excludes'] as $exclude) { if (!empty($exclude)) { - $this->_action[] = ' * !^From.*' . $exclude; + $this->_action[] = ' * !^From.*' . $exclude; } } } if ($params['action-value']['ignorelist']) { - $this->_action[] = ' * !^FROM_DAEMON'; + $this->_action[] = ' * !^FROM_DAEMON'; } - $this->_action[] = ' | formail -rD 8192 ${VACATION_DIR:-.}/.vacation.' . $address; - $this->_action[] = ' :0 ehc'; - $this->_action[] = ' | (formail -rI"Precedence: junk" \\'; - $this->_action[] = ' -a"From: <' . $address . '>" \\'; - $this->_action[] = ' -A"X-Loop: ' . $address . '" \\'; + $this->_action[] = ' | formail -rD 8192 ${VACATION_DIR:-.}/.vacation.' . $address; + $this->_action[] = ' :0 eh'; + $this->_action[] = ' | (formail -rI"Precedence: junk" \\'; + $this->_action[] = ' -a"From: <' . $address . '>" \\'; + $this->_action[] = ' -A"X-Loop: ' . $address . '" \\'; if (Horde_Mime::is8bit($params['action-value']['reason'])) { - $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" \\'; - $this->_action[] = ' -i"Content-Transfer-Encoding: quoted-printable" \\'; - $this->_action[] = ' -i"Content-Type: text/plain; charset=' . Horde_Nls::getCharset() . '" ; \\'; + $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" \\'; + $this->_action[] = ' -i"Content-Transfer-Encoding: quoted-printable" \\'; + $this->_action[] = ' -i"Content-Type: text/plain; charset=' . Horde_Nls::getCharset() . '" ; \\'; $reason = Horde_Mime::quotedPrintableEncode($params['action-value']['reason'], "\n"); } else { - $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" ; \\'; + $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" ; \\'; $reason = $params['action-value']['reason']; } $reason = addcslashes($reason, "\\\n\r\t\"`"); - $this->_action[] = ' ' . $this->_params['echo'] . ' -e "' . $reason . '" \\'; - $this->_action[] = ' ) | $SENDMAIL -f' . $address . ' -oi -t'; - $this->_action[] = ''; - $this->_action[] = ' :0'; - $this->_action[] = ' /dev/null'; + $this->_action[] = ' ' . $this->_params['echo'] . ' -e "' . $reason . '" \\'; + $this->_action[] = ' ) | $SENDMAIL -f' . $address . ' -oi -t'; if ($timed) { - $this->_action[] = ' }'; + $this->_action[] = ' }'; } + $this->_action[] = ' }'; } } $this->_action[] = '}';