mirror of
https://github.com/vdukhovni/postfix
synced 2025-08-30 21:55:20 +00:00
postfix-1.1.11-20020821
This commit is contained in:
committed by
Viktor Dukhovni
parent
041b933666
commit
310ee456b1
@@ -6829,10 +6829,36 @@ Apologies for any names omitted.
|
|||||||
mail to be placed on the "hold" queue for manual inspection.
|
mail to be placed on the "hold" queue for manual inspection.
|
||||||
Files: global/hold_message.[hc], cleanup/cleanup_message.c.
|
Files: global/hold_message.[hc], cleanup/cleanup_message.c.
|
||||||
|
|
||||||
|
20020820
|
||||||
|
|
||||||
|
Bugfix: yesterday's HOLD pattern code did not update the
|
||||||
|
cleanup server's idea of the queue file name for error
|
||||||
|
recovery and for error reporting purposes, so that incomplete
|
||||||
|
or content rejected mail would not be deleted from the
|
||||||
|
queue, and so that the bouncer would not find the queue
|
||||||
|
file.
|
||||||
|
|
||||||
|
Feature: new header/body_checks DISCARD pattern that causes
|
||||||
|
mail to be silently discarded. Files: global/cleanup_user.h,
|
||||||
|
cleanup/cleanup_message.c.
|
||||||
|
|
||||||
|
Bugfix: the local delivery agent's mailbox duplicate delivery
|
||||||
|
eliminator was not updated when address extensions were
|
||||||
|
added to Postfix. The other local duplicate eliminators
|
||||||
|
may need revision as well. File: local/mailbox.c.
|
||||||
|
|
||||||
|
20020821
|
||||||
|
|
||||||
|
Feature: HOLD and DISCARD actions in SMTPD access tables.
|
||||||
|
These requests are propagated to the cleanup daemon,
|
||||||
|
which required a bit of redesign of internal protocols.
|
||||||
|
Files: cleanup/cleanup.c pickup/pickup.c smtpd/smtpd.c
|
||||||
|
global/post_mail.c qmqpd/qmqpd.c local/forward.c.
|
||||||
|
|
||||||
Open problems:
|
Open problems:
|
||||||
|
|
||||||
Medium: should permit_mx_backup defer delivery if DNS
|
Medium: should permit_mx_backup defer delivery if DNS has
|
||||||
has some error of some kind?
|
some error of some kind?
|
||||||
|
|
||||||
Low: all table lookups should consistently use internalized
|
Low: all table lookups should consistently use internalized
|
||||||
(unquoted) or externalized (quoted) forms as lookup keys.
|
(unquoted) or externalized (quoted) forms as lookup keys.
|
||||||
|
@@ -15,10 +15,17 @@ BUILDING WITH LDAP SUPPORT
|
|||||||
|
|
||||||
Note: Postfix no longer supports the LDAP version 1 interface.
|
Note: Postfix no longer supports the LDAP version 1 interface.
|
||||||
|
|
||||||
You need to have LDAP libraries and include files installed somewhere on
|
You need to have LDAP libraries and include files installed somewhere
|
||||||
your system, and you need to configure the Postfix Makefiles
|
on your system, and you need to configure the Postfix Makefiles
|
||||||
accordingly.
|
accordingly.
|
||||||
|
|
||||||
|
For example, to build the OpenLDAP libraries for use with Postfix
|
||||||
|
(i.e. LDAP client code only), you could use the following command:
|
||||||
|
|
||||||
|
% ./configure --without-kerberos --without-cyrus-sasl --without-tls \
|
||||||
|
--without-threads --disable-slapd --disable-slurpd \
|
||||||
|
--disable-debug --disable-shared
|
||||||
|
|
||||||
If you're using the libraries from the UM distribution
|
If you're using the libraries from the UM distribution
|
||||||
(http://www.umich.edu/~dirsvcs/ldap/ldap.html) or OpenLDAP
|
(http://www.umich.edu/~dirsvcs/ldap/ldap.html) or OpenLDAP
|
||||||
(http://www.openldap.org), something like this in the top level of your
|
(http://www.openldap.org), something like this in the top level of your
|
||||||
|
@@ -12,8 +12,14 @@ snapshot release). Patches change the patchlevel and the release
|
|||||||
date. Snapshots change only the release date, unless they include
|
date. Snapshots change only the release date, unless they include
|
||||||
the same bugfixes as a patch release.
|
the same bugfixes as a patch release.
|
||||||
|
|
||||||
Incompatible changes with Postfix snapshot 1.1.11-2002018
|
Incompatible changes with Postfix snapshot 1.1.11-20020821
|
||||||
=========================================================
|
==========================================================
|
||||||
|
|
||||||
|
After switching Postfix versions you need to "postfix reload"
|
||||||
|
because internal protocols have changed.
|
||||||
|
|
||||||
|
Incompatible changes with Postfix snapshot 1.1.11-20020818
|
||||||
|
==========================================================
|
||||||
|
|
||||||
The qmgr_site_hog_factor feature is gone (this would defer mail
|
The qmgr_site_hog_factor feature is gone (this would defer mail
|
||||||
delivery for sites that occupy too much space in the active queue,
|
delivery for sites that occupy too much space in the active queue,
|
||||||
|
@@ -115,6 +115,17 @@
|
|||||||
#
|
#
|
||||||
# OK Accept the address etc. that matches the pattern.
|
# OK Accept the address etc. that matches the pattern.
|
||||||
#
|
#
|
||||||
|
# HOLD Place the message on the hold queue, where it will
|
||||||
|
# sit until someone either deletes it or releases it
|
||||||
|
# for delivery. Mail that is placed on hold can be
|
||||||
|
# examined with the postcat(1) command, and can be
|
||||||
|
# destroyed or released with the postsuper(1) com-
|
||||||
|
# mand.
|
||||||
|
#
|
||||||
|
# DISCARD
|
||||||
|
# Claim successful delivery and silently discard the
|
||||||
|
# message.
|
||||||
|
#
|
||||||
# all-numerical
|
# all-numerical
|
||||||
# An all-numerical result is treated as OK. This for-
|
# An all-numerical result is treated as OK. This for-
|
||||||
# mat is generated by address-based relay authoriza-
|
# mat is generated by address-based relay authoriza-
|
||||||
|
@@ -29,14 +29,13 @@
|
|||||||
queue_directory = /var/spool/postfix
|
queue_directory = /var/spool/postfix
|
||||||
|
|
||||||
# The command_directory parameter specifies the location of all
|
# The command_directory parameter specifies the location of all
|
||||||
# postXXX commands. The default value is $program_directory.
|
# postXXX commands.
|
||||||
#
|
#
|
||||||
command_directory = /usr/sbin
|
command_directory = /usr/sbin
|
||||||
|
|
||||||
# The daemon_directory parameter specifies the location of all Postfix
|
# The daemon_directory parameter specifies the location of all Postfix
|
||||||
# daemon programs (i.e. programs listed in the master.cf file). The
|
# daemon programs (i.e. programs listed in the master.cf file). This
|
||||||
# default value is $program_directory. This directory must be owned
|
# directory must be owned by root.
|
||||||
# by root.
|
|
||||||
#
|
#
|
||||||
daemon_directory = /usr/libexec/postfix
|
daemon_directory = /usr/libexec/postfix
|
||||||
|
|
||||||
@@ -417,11 +416,22 @@ mail_owner = postfix
|
|||||||
# When a pattern matches, what happens next depends on the associated
|
# When a pattern matches, what happens next depends on the associated
|
||||||
# action that is specified in the right-hand side of the table:
|
# action that is specified in the right-hand side of the table:
|
||||||
#
|
#
|
||||||
# REJECT the entire message is rejected.
|
# REJECT [optional text...]
|
||||||
# REJECT text.... The text is sent to the originator.
|
# Reject the entire message. The optional text is sent to the
|
||||||
# IGNORE the header line is silently discarded.
|
# originator and is logged to the maillog file.
|
||||||
# WARN the header is logged (not rejected) with a warning message.
|
# IGNORE Silently discard the header line.
|
||||||
# WARN text... as above, and the text is logged, too.
|
# WARN [optional text...]
|
||||||
|
# Log the message header and the optional text. This is useful
|
||||||
|
# for testing. When the pattern is OK, change the WARN into a
|
||||||
|
# REJECT or into a DISCARD.
|
||||||
|
# HOLD [optional text...]
|
||||||
|
# Place the message on the hold queue. Mail on hold can be
|
||||||
|
# inspected with the postcat command, and can be destroyed or
|
||||||
|
# taken off hold (i.e. delivered) with the postsuper command.
|
||||||
|
# The matched header is logged with the optional text.
|
||||||
|
# DISCARD [optional text...]
|
||||||
|
# Claim successful delivery and silently discard the message.
|
||||||
|
# The matched header is logged with the optional text.
|
||||||
# FILTER transport:nexthop
|
# FILTER transport:nexthop
|
||||||
# after the message is queued, send the entire message through
|
# after the message is queued, send the entire message through
|
||||||
# a content filter. This requires different cleanup servers
|
# a content filter. This requires different cleanup servers
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
#
|
#
|
||||||
# Command + args: the command to be executed. The command name is
|
# Command + args: the command to be executed. The command name is
|
||||||
# relative to the Postfix program directory (pathname is controlled by
|
# relative to the Postfix program directory (pathname is controlled by
|
||||||
# the program_directory configuration variable). Adding one or more
|
# the daemon_directory configuration variable). Adding one or more
|
||||||
# -v options turns on verbose logging for that service; adding a -D
|
# -v options turns on verbose logging for that service; adding a -D
|
||||||
# option enables symbolic debugging (see the debugger_command variable
|
# option enables symbolic debugging (see the debugger_command variable
|
||||||
# in the main.cf configuration file). See individual command man pages
|
# in the main.cf configuration file). See individual command man pages
|
||||||
|
@@ -29,4 +29,4 @@ debug_peer_list =
|
|||||||
#
|
#
|
||||||
debugger_command =
|
debugger_command =
|
||||||
PATH=/usr/bin:/usr/X11R6/bin
|
PATH=/usr/bin:/usr/X11R6/bin
|
||||||
xxgdb $program_directory/$process_name $process_id & sleep 5
|
xxgdb $daemon_directory/$process_name $process_id & sleep 5
|
||||||
|
@@ -11,11 +11,22 @@
|
|||||||
# When a pattern matches, what happens next depends on the associated
|
# When a pattern matches, what happens next depends on the associated
|
||||||
# action that is specified in the right-hand side of the table:
|
# action that is specified in the right-hand side of the table:
|
||||||
#
|
#
|
||||||
# REJECT the entire message is rejected.
|
# REJECT [optional text...]
|
||||||
# REJECT text.... The text is sent to the originator.
|
# Reject the entire message. The optional text is sent to the
|
||||||
# IGNORE the header line is silently discarded.
|
# originator and is logged to the maillog file.
|
||||||
# WARN the header is logged (not rejected) with a warning message.
|
# IGNORE Silently discard the header line.
|
||||||
# WARN text... as above, and the text is logged, too.
|
# WARN [optional text...]
|
||||||
|
# Log the message header and the optional text. This is useful
|
||||||
|
# for testing. When the pattern is OK, change the WARN into a
|
||||||
|
# REJECT or into a DISCARD.
|
||||||
|
# HOLD [optional text...]
|
||||||
|
# Place the message on the hold queue. Mail on hold can be
|
||||||
|
# inspected with the postcat command, and can be destroyed or
|
||||||
|
# taken off hold (i.e. delivered) with the postsuper command.
|
||||||
|
# The matched header is logged with the optional text.
|
||||||
|
# DISCARD [optional text...]
|
||||||
|
# Claim successful delivery and silently discard the message.
|
||||||
|
# The matched header is logged with the optional text.
|
||||||
# FILTER transport:nexthop
|
# FILTER transport:nexthop
|
||||||
# after the message is queued, the message is sent through
|
# after the message is queued, the message is sent through
|
||||||
# a content filter. This requires different cleanup servers
|
# a content filter. This requires different cleanup servers
|
||||||
@@ -40,11 +51,22 @@ header_checks = regexp:/etc/postfix/header_checks
|
|||||||
# depends on the associated action that is specified in the right-hand
|
# depends on the associated action that is specified in the right-hand
|
||||||
# side of the table:
|
# side of the table:
|
||||||
#
|
#
|
||||||
# REJECT the entire message is rejected.
|
# REJECT [optional text...]
|
||||||
# REJECT text.... The text is sent to the originator.
|
# Reject the entire message. The optional text is sent to the
|
||||||
# IGNORE the header line is silently discarded.
|
# originator and is logged to the maillog file.
|
||||||
# WARN the header is logged (not rejected) with a warning message.
|
# IGNORE Silently discard the body line
|
||||||
# WARN text... as above, and the text is logged, too.
|
# WARN [optional text...]
|
||||||
|
# Log the body line and the optional text. This is useful
|
||||||
|
# for testing. When the pattern is OK, change the WARN into a
|
||||||
|
# REJECT or into a DISCARD.
|
||||||
|
# HOLD [optional text...]
|
||||||
|
# Place the message on the hold queue. Mail on hold can be
|
||||||
|
# inspected with the postcat command, and can be destroyed or
|
||||||
|
# taken off hold (i.e. delivered) with the postsuper command.
|
||||||
|
# The matched body line is logged with the optional text.
|
||||||
|
# DISCARD [optional text...]
|
||||||
|
# Claim successful delivery and silently discard the message.
|
||||||
|
# The matched body line is logged with the optional text.
|
||||||
# FILTER transport:nexthop
|
# FILTER transport:nexthop
|
||||||
# after the message is queued, the message is sent through
|
# after the message is queued, the message is sent through
|
||||||
# a content filter. This requires different cleanup servers
|
# a content filter. This requires different cleanup servers
|
||||||
|
@@ -317,10 +317,10 @@ parent_domain_matches_subdomains = debug_peer_list,fast_flush_domains,
|
|||||||
#
|
#
|
||||||
process_id_directory = pid
|
process_id_directory = pid
|
||||||
|
|
||||||
# The program_directory parameter specifies the location of Postfix
|
# The daemon_directory parameter specifies the location of Postfix
|
||||||
# support programs and daemons. This directory must be owned by root.
|
# support programs and daemons. This directory must be owned by root.
|
||||||
#
|
#
|
||||||
program_directory = /usr/libexec/postfix
|
daemon_directory = /usr/libexec/postfix
|
||||||
|
|
||||||
# The queue_directory specifies the location of the Postfix queue.
|
# The queue_directory specifies the location of the Postfix queue.
|
||||||
# This is also the root directory of Postfix daemons that run chrooted.
|
# This is also the root directory of Postfix daemons that run chrooted.
|
||||||
|
@@ -21,11 +21,24 @@
|
|||||||
# The second field is the "replacement" string - the text
|
# The second field is the "replacement" string - the text
|
||||||
# returned by the match.
|
# returned by the match.
|
||||||
#
|
#
|
||||||
# REJECT The entire message is rejected.
|
# REJECT [optional text...]
|
||||||
# REJECT text.... The text is sent to the originator.
|
# Reject the entire message. The optional text is sent to
|
||||||
# IGNORE The line is silently discarded.
|
# the originator and is logged to the maillog file.
|
||||||
# WARN The line is logged (not rejected) with a warning.
|
# IGNORE Silently discard the body line.
|
||||||
# WARN text.... As above, and the text is logged, too.
|
# WARN [optional text...]
|
||||||
|
# Log the body line and the optional text. This is
|
||||||
|
# useful for testing. When the pattern is OK, change the
|
||||||
|
# WARN into a REJECT or into a DISCARD.
|
||||||
|
# HOLD [optional text...]
|
||||||
|
# Place the message on the hold queue. Mail on hold can
|
||||||
|
# be inspected with the postcat command, and can be
|
||||||
|
# destroyed or taken off hold (i.e. delivered) with the
|
||||||
|
# postsuper command. The matched body line is logged
|
||||||
|
# together with the optional text.
|
||||||
|
# DISCARD [optional text...]
|
||||||
|
# Claim successful delivery and silently discard the
|
||||||
|
# message. The matched body line is logged together
|
||||||
|
# with the optional text.
|
||||||
# FILTER transport:nexthop
|
# FILTER transport:nexthop
|
||||||
# After the message is queued, send the entire
|
# After the message is queued, send the entire
|
||||||
# message through a content filter. This
|
# message through a content filter. This
|
||||||
|
@@ -21,19 +21,32 @@
|
|||||||
# The second field is the "replacement" string - the text
|
# The second field is the "replacement" string - the text
|
||||||
# returned by the match.
|
# returned by the match.
|
||||||
#
|
#
|
||||||
# REJECT The entire message is rejected.
|
# REJECT [optional text...]
|
||||||
# REJECT text.... The text is sent to the originator.
|
# Reject the entire message. The optional text is sent to
|
||||||
# IGNORE The header line is silently discarded.
|
# the originator and is logged to the maillog file.
|
||||||
# WARN The header is logged (not rejected) with a warning.
|
# IGNORE Silently ignore the message header.
|
||||||
# WARN text.... As above, and the text is logged, too.
|
# WARN [optional text...]
|
||||||
# FILTER transport:nexthop
|
# Log the message header and the optional text. This is
|
||||||
# After the message is queued, send the entire
|
# useful for testing. When the pattern is OK, change the
|
||||||
# message through a content filter. This
|
# WARN into a REJECT or into a DISCARD.
|
||||||
# requires different cleanup servers before
|
# HOLD [optional text...]
|
||||||
# and after the filter, with header/body
|
# Place the message on the hold queue. Mail on hold can
|
||||||
# checks turned off in the second cleanup
|
# be inspected with the postcat command, and can be
|
||||||
# server. More information about content filters
|
# destroyed or taken off hold (i.e. delivered) with the
|
||||||
# is in the Postfix FILTER_README file.
|
# postsuper command. The matched header is logged
|
||||||
|
# together with the optional text.
|
||||||
|
# DISCARD [optional text...]
|
||||||
|
# Claim successful delivery and silently discard the
|
||||||
|
# message. The matched header is logged together with
|
||||||
|
# the optional text.
|
||||||
|
# FILTER transport:nexthop
|
||||||
|
# After the message is queued, send the entire
|
||||||
|
# message through a content filter. This
|
||||||
|
# requires different cleanup servers before
|
||||||
|
# and after the filter, with header/body
|
||||||
|
# checks turned off in the second cleanup
|
||||||
|
# server. More information about content filters
|
||||||
|
# is in the Postfix FILTER_README file.
|
||||||
#
|
#
|
||||||
# Substitution of sub-strings from the matched expression is
|
# Substitution of sub-strings from the matched expression is
|
||||||
# possible using the conventional perl syntax. The macros in the
|
# possible using the conventional perl syntax. The macros in the
|
||||||
|
@@ -17,18 +17,27 @@
|
|||||||
# terminating processing of the ruleset.
|
# terminating processing of the ruleset.
|
||||||
#
|
#
|
||||||
# The result is one of the following:
|
# The result is one of the following:
|
||||||
# REJECT The entire message is rejected.
|
# REJECT [optional text...]
|
||||||
# REJECT text.... The text is sent to the originator.
|
# Reject the entire message. The optional text is sent to the
|
||||||
# IGNORE The header line is silently discarded.
|
# originator and is logged to the maillog file.
|
||||||
# WARN The header is logged (not rejected) with a warning.
|
# IGNORE Silently ignore the body line.
|
||||||
# WARN text.... As above, and the text is logged, too.
|
# WARN [optional text...]
|
||||||
# FILTER transport:nexthop
|
# Log the body line and the optional text. This is useful
|
||||||
# After the message is queued, send the entire
|
# for testing. When the pattern is OK, change the WARN into a
|
||||||
# message through a content filter. This requires
|
# REJECT or into a DISCARD.
|
||||||
# different cleanup servers before and after the
|
# HOLD [optional text...]
|
||||||
# filter, with header/body checks turned off in
|
# Place the message on the hold queue. Mail on hold can be
|
||||||
# the second cleanup server. More information about
|
# inspected with the postcat command, and can be destroyed or
|
||||||
# content filters is in the Postfix FILTER_README file.
|
# taken off hold (i.e. delivered) with the postsuper command.
|
||||||
|
# The matched body line is logged together with the optional text.
|
||||||
|
# DISCARD [optional text...]
|
||||||
|
# Claim successful delivery and silently discard the message.
|
||||||
|
# The matched body line is logged together with the optional text.
|
||||||
|
# FILTER transport:nexthop
|
||||||
|
# After the message is queued, send the entire message through
|
||||||
|
# a content filter. This requires different cleanup servers
|
||||||
|
# before and after the filter, with header/body checks turned
|
||||||
|
# off in the second cleanup server.
|
||||||
|
|
||||||
# Skip over base 64 encoded blocks. This saves lots of CPU cycles.
|
# Skip over base 64 encoded blocks. This saves lots of CPU cycles.
|
||||||
# Expressions by Liviu Daia. Amended by Victor Duchovni.
|
# Expressions by Liviu Daia. Amended by Victor Duchovni.
|
||||||
|
@@ -18,18 +18,27 @@
|
|||||||
# terminating processing of the ruleset.
|
# terminating processing of the ruleset.
|
||||||
#
|
#
|
||||||
# The result is one of the following:
|
# The result is one of the following:
|
||||||
# REJECT the entire message is rejected.
|
# REJECT [optional text...]
|
||||||
# REJECT text.... The text is sent to the originator.
|
# Reject the entire message. The optional text is sent to the
|
||||||
# IGNORE the header line is silently discarded.
|
# originator and is logged to the maillog file.
|
||||||
# WARN the header is logged (not rejected) with a warning.
|
# IGNORE Silently discard the message header.
|
||||||
# WARN text... As above, and the text is logged, too.
|
# WARN [optional text...]
|
||||||
# FILTER transport:nexthop
|
# Log the message header and the optional text. This is useful
|
||||||
# After the message is queued, send the entire
|
# for testing. When the pattern is OK, change the WARN into a
|
||||||
# message through a content filter. This requires
|
# REJECT or into a DISCARD.
|
||||||
# different cleanup servers before and after the
|
# HOLD [optional text...]
|
||||||
# filter, with header/body checks turned off in
|
# Place the message on the hold queue. Mail on hold can be
|
||||||
# the second cleanup server. More information about
|
# inspected with the postcat command, and can be destroyed or
|
||||||
# content filters is in the Postfix FILTER_README file.
|
# taken off hold (i.e. delivered) with the postsuper command.
|
||||||
|
# The matched header is logged together with the optional text.
|
||||||
|
# DISCARD [optional text...]
|
||||||
|
# Claim successful delivery and silently discard the message.
|
||||||
|
# The matched header is logged together with the optional text.
|
||||||
|
# FILTER transport:nexthop
|
||||||
|
# After the message is queued, send the entire message through
|
||||||
|
# a content filter. This requires different cleanup servers
|
||||||
|
# before and after the filter, with header/body checks turned
|
||||||
|
# off in the second cleanup server.
|
||||||
|
|
||||||
/^Subject: Make Money Fast/ REJECT
|
/^Subject: Make Money Fast/ REJECT
|
||||||
/^To: friend@public.com/ REJECT
|
/^To: friend@public.com/ REJECT
|
||||||
|
@@ -116,6 +116,17 @@ ACCESS(5) ACCESS(5)
|
|||||||
|
|
||||||
<b>OK</b> Accept the address etc. that matches the pattern.
|
<b>OK</b> Accept the address etc. that matches the pattern.
|
||||||
|
|
||||||
|
<b>HOLD</b> Place the message on the <b>hold</b> queue, where it will
|
||||||
|
sit until someone either deletes it or releases it
|
||||||
|
for delivery. Mail that is placed on hold can be
|
||||||
|
examined with the <a href="postcat.1.html"><b>postcat</b>(1)</a> command, and can be
|
||||||
|
destroyed or released with the <a href="postsuper.1.html"><b>postsuper</b>(1)</a> com-
|
||||||
|
mand.
|
||||||
|
|
||||||
|
<b>DISCARD</b>
|
||||||
|
Claim successful delivery and silently discard the
|
||||||
|
message.
|
||||||
|
|
||||||
<i>all-numerical</i>
|
<i>all-numerical</i>
|
||||||
An all-numerical result is treated as OK. This for-
|
An all-numerical result is treated as OK. This for-
|
||||||
mat is generated by address-based relay authoriza-
|
mat is generated by address-based relay authoriza-
|
||||||
|
@@ -127,21 +127,38 @@ matches a table, the action depends on the lookup result:
|
|||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
|
||||||
<dt>REJECT <dd> Reject the message, and log the header.
|
<dt>REJECT <dd>
|
||||||
|
|
||||||
<dt>REJECT text... <dd> As above, and also send the text to
|
<dt>REJECT text... <dd>
|
||||||
the originator.
|
|
||||||
|
Reject the message, log the header and the optional text,
|
||||||
|
and send the optional text to the originator.
|
||||||
|
|
||||||
<dt>IGNORE <dd> Delete the header from the message.
|
<dt>IGNORE <dd> Delete the header from the message.
|
||||||
|
|
||||||
<dt>HOLD <dd> Place the message on the <b>hold</b> queue. Mail on
|
<dt>WARN <dd>
|
||||||
hold can be inspected with the <a href="postcat.1.html">postcat</a>
|
|
||||||
command, and can be destroyed or taken off hold with the <a
|
<dt>WARN text... <dd>
|
||||||
|
|
||||||
|
Log (but do not reject) the header with a warning, and log the
|
||||||
|
optional text.
|
||||||
|
|
||||||
|
<dt>HOLD <dd>
|
||||||
|
|
||||||
|
<dt>HOLD text... <dd>
|
||||||
|
|
||||||
|
Place the message on the <b>hold</b> queue. Mail on hold can be
|
||||||
|
inspected with the <a href="postcat.1.html">postcat</a> command,
|
||||||
|
and can be destroyed or taken off hold with the <a
|
||||||
href="postsuper.1.html">postsuper</a> command.
|
href="postsuper.1.html">postsuper</a> command.
|
||||||
|
The optional text is logged together with the matched text.
|
||||||
|
|
||||||
<dt>WARN <dd> Log (but do not reject) the header with a warning.
|
<dt>DISCARD <dd>
|
||||||
|
|
||||||
<dt>WARN text... <dd> As above, and also log the text.
|
<dt>DISCARD text... <dd>
|
||||||
|
|
||||||
|
Claim successful delivery and silently discard the message.
|
||||||
|
The optional text is logged together with the matched text.
|
||||||
|
|
||||||
<dt>FILTER <i>transport</i>:<i>nexthop</i> <dd>
|
<dt>FILTER <i>transport</i>:<i>nexthop</i> <dd>
|
||||||
After the message is queued, send the entire message through
|
After the message is queued, send the entire message through
|
||||||
@@ -209,21 +226,38 @@ line matches a table, the action depends on the lookup result:
|
|||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
|
||||||
<dt>REJECT <dd> Reject the message, and log the matched line.
|
<dt>REJECT <dd>
|
||||||
|
|
||||||
<dt>REJECT text... <dd> As above, and also send the text to
|
<dt>REJECT text... <dd>
|
||||||
the originator.
|
|
||||||
|
Reject the message, log the body line and the optional text,
|
||||||
|
and send the optional text to the originator.
|
||||||
|
|
||||||
|
<dt>WARN <dd>
|
||||||
|
|
||||||
|
<dt>WARN text... <dd>
|
||||||
|
|
||||||
|
Log (but do not reject) the body line with a warning, and log the
|
||||||
|
optional text.
|
||||||
|
|
||||||
<dt>IGNORE <dd> Delete the matched line from the message.
|
<dt>IGNORE <dd> Delete the matched line from the message.
|
||||||
|
|
||||||
<dt>HOLD <dd> Place the message on the <b>hold</b> queue. Mail on
|
<dt>HOLD <dd>
|
||||||
hold can be inspected with the <a href="postcat.1.html">postcat</a>
|
|
||||||
command, and can be destroyed or taken off hold with the <a
|
<dt>HOLD text... <dd>
|
||||||
|
|
||||||
|
Place the message on the <b>hold</b> queue. Mail on hold can be
|
||||||
|
inspected with the <a href="postcat.1.html">postcat</a> command,
|
||||||
|
and can be destroyed or taken off hold with the <a
|
||||||
href="postsuper.1.html">postsuper</a> command.
|
href="postsuper.1.html">postsuper</a> command.
|
||||||
|
The optional text is logged together with the matched text.
|
||||||
|
|
||||||
<dt>WARN <dd> Log (but do not reject) the matched line with a warning.
|
<dt>DISCARD <dd>
|
||||||
|
|
||||||
<dt>WARN text... <dd> As above, and also log the text.
|
<dt>DISCARD text... <dd>
|
||||||
|
|
||||||
|
Claim successful delivery and silently discard the message.
|
||||||
|
The optional text is logged together with the matched text.
|
||||||
|
|
||||||
<dt>FILTER <i>transport</i>:<i>nexthop</i> <dd>
|
<dt>FILTER <i>transport</i>:<i>nexthop</i> <dd>
|
||||||
After the message is queued, send the entire message through
|
After the message is queued, send the entire message through
|
||||||
@@ -331,12 +365,46 @@ href="basic.html#mynetworks"> $mynetworks</a>.
|
|||||||
<dt> <i>maptype</i>:<i>mapname</i> <dd> Search the named <a
|
<dt> <i>maptype</i>:<i>mapname</i> <dd> Search the named <a
|
||||||
href="access.5.html">access database</a> for the client hostname, parent
|
href="access.5.html">access database</a> for the client hostname, parent
|
||||||
domains, client IP address, or networks obtained by stripping least
|
domains, client IP address, or networks obtained by stripping least
|
||||||
significant octets. Reject the request if the result is <b>REJECT</b>
|
significant octets.
|
||||||
or "[<b>45</b>]<i>XX text</i>". Permit the request if the result
|
|
||||||
is <b>OK</b> or <b>RELAY</b> or all-numerical. Otherwise, treat the
|
<p>
|
||||||
result as another list of UCE restrictions. The
|
|
||||||
<b>access_map_reject_code</b> parameter specifies the response code for
|
<dl compact>
|
||||||
<b>REJECT</b> results (default: <b>554</b>).
|
|
||||||
|
<dt>REJECT
|
||||||
|
<dd>Reject the request. The <b>access_map_reject_code</b> parameter
|
||||||
|
specifies the response code (default: <b>554</b>).
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<dt>[<b>45</b>]<i>XX text</i>
|
||||||
|
<dd>Reject the request. Send the numerical code and text to the SMTP client.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<dt>OK
|
||||||
|
<dt>RELAY
|
||||||
|
<dt>all-numerical
|
||||||
|
<dd>Permit the request.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<dt>HOLD
|
||||||
|
<dd> Place the message on the <b>hold</b> queue. Mail on hold can
|
||||||
|
be inspected with the <a href="postcat.1.html">postcat</a> command,
|
||||||
|
and can be destroyed or taken off hold with the <a
|
||||||
|
href="postsuper.1.html">postsuper</a> command.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<dt>DISCARD
|
||||||
|
<dd> Claim successful delivery and silently discard the message.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<dt>Other<dd> Treat the result as another list of UCE restrictions.
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
@@ -115,6 +115,14 @@ Reject the address etc. that matches the pattern. A generic
|
|||||||
error response message is generated.
|
error response message is generated.
|
||||||
.IP \fBOK\fR
|
.IP \fBOK\fR
|
||||||
Accept the address etc. that matches the pattern.
|
Accept the address etc. that matches the pattern.
|
||||||
|
.IP \fBHOLD\fR
|
||||||
|
Place the message on the \fBhold\fR queue, where it will sit
|
||||||
|
until someone either deletes it or releases it for delivery.
|
||||||
|
Mail that is placed on hold can be examined with the
|
||||||
|
\fBpostcat\fR(1) command, and can be destroyed or released with
|
||||||
|
the \fBpostsuper\fR(1) command.
|
||||||
|
.IP \fBDISCARD\fR
|
||||||
|
Claim successful delivery and silently discard the message.
|
||||||
.IP \fIall-numerical\fR
|
.IP \fIall-numerical\fR
|
||||||
An all-numerical result is treated as OK. This format is
|
An all-numerical result is treated as OK. This format is
|
||||||
generated by address-based relay authorization schemes.
|
generated by address-based relay authorization schemes.
|
||||||
|
@@ -102,6 +102,14 @@
|
|||||||
# .IP \fIall-numerical\fR
|
# .IP \fIall-numerical\fR
|
||||||
# An all-numerical result is treated as OK. This format is
|
# An all-numerical result is treated as OK. This format is
|
||||||
# generated by address-based relay authorization schemes.
|
# generated by address-based relay authorization schemes.
|
||||||
|
# .IP \fBHOLD\fR
|
||||||
|
# Place the message on the \fBhold\fR queue, where it will sit
|
||||||
|
# until someone either deletes it or releases it for delivery.
|
||||||
|
# Mail that is placed on hold can be examined with the
|
||||||
|
# \fBpostcat\fR(1) command, and can be destroyed or released with
|
||||||
|
# the \fBpostsuper\fR(1) command.
|
||||||
|
# .IP \fBDISCARD\fR
|
||||||
|
# Claim successful delivery and silently discard the message.
|
||||||
# .IP \fIrestriction...\fR
|
# .IP \fIrestriction...\fR
|
||||||
# Apply the named UCE restriction(s) (\fBpermit\fR, \fBreject\fR,
|
# Apply the named UCE restriction(s) (\fBpermit\fR, \fBreject\fR,
|
||||||
# \fBreject_unauth_destination\fR, and so on).
|
# \fBreject_unauth_destination\fR, and so on).
|
||||||
|
@@ -145,7 +145,7 @@ static int bounce_append_proto(char *service_name, VSTREAM *client)
|
|||||||
* Read the and validate the client request.
|
* Read the and validate the client request.
|
||||||
*/
|
*/
|
||||||
if (mail_command_server(client,
|
if (mail_command_server(client,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, &flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient,
|
ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_WHY, why,
|
ATTR_TYPE_STR, MAIL_ATTR_WHY, why,
|
||||||
@@ -185,7 +185,7 @@ static int bounce_notify_proto(char *service_name, VSTREAM *client, int flush)
|
|||||||
* Read and validate the client request.
|
* Read and validate the client request.
|
||||||
*/
|
*/
|
||||||
if (mail_command_server(client,
|
if (mail_command_server(client,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, &flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
@@ -233,7 +233,7 @@ static int bounce_verp_proto(char *service_name, VSTREAM *client, int flush)
|
|||||||
* Read and validate the client request.
|
* Read and validate the client request.
|
||||||
*/
|
*/
|
||||||
if (mail_command_server(client,
|
if (mail_command_server(client,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, &flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
@@ -293,7 +293,7 @@ static int bounce_one_proto(char *service_name, VSTREAM *client)
|
|||||||
* Read and validate the client request.
|
* Read and validate the client request.
|
||||||
*/
|
*/
|
||||||
if (mail_command_server(client,
|
if (mail_command_server(client,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &unused_flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, &unused_flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
|
@@ -125,6 +125,7 @@ cleanup_api.o: ../../include/attr.h
|
|||||||
cleanup_api.o: ../../include/bounce.h
|
cleanup_api.o: ../../include/bounce.h
|
||||||
cleanup_api.o: ../../include/mail_params.h
|
cleanup_api.o: ../../include/mail_params.h
|
||||||
cleanup_api.o: ../../include/mail_stream.h
|
cleanup_api.o: ../../include/mail_stream.h
|
||||||
|
cleanup_api.o: ../../include/hold_message.h
|
||||||
cleanup_api.o: cleanup.h
|
cleanup_api.o: cleanup.h
|
||||||
cleanup_api.o: ../../include/argv.h
|
cleanup_api.o: ../../include/argv.h
|
||||||
cleanup_api.o: ../../include/nvtable.h
|
cleanup_api.o: ../../include/nvtable.h
|
||||||
@@ -321,7 +322,6 @@ cleanup_message.o: ../../include/iostuff.h
|
|||||||
cleanup_message.o: ../../include/attr.h
|
cleanup_message.o: ../../include/attr.h
|
||||||
cleanup_message.o: ../../include/mime_state.h
|
cleanup_message.o: ../../include/mime_state.h
|
||||||
cleanup_message.o: ../../include/lex_822.h
|
cleanup_message.o: ../../include/lex_822.h
|
||||||
cleanup_message.o: ../../include/hold_message.h
|
|
||||||
cleanup_message.o: cleanup.h
|
cleanup_message.o: cleanup.h
|
||||||
cleanup_message.o: ../../include/maps.h
|
cleanup_message.o: ../../include/maps.h
|
||||||
cleanup_message.o: ../../include/dict.h
|
cleanup_message.o: ../../include/dict.h
|
||||||
|
@@ -226,20 +226,11 @@ static void cleanup_service(VSTREAM *src, char *unused_service, char **argv)
|
|||||||
state = cleanup_open();
|
state = cleanup_open();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send the queue id to the client. Read client processing options. If we
|
* Send the queue id to the client.
|
||||||
* can't read the client processing options we can pretty much forget
|
|
||||||
* about the whole operation.
|
|
||||||
*/
|
*/
|
||||||
attr_print(src, ATTR_FLAG_NONE,
|
attr_print(src, ATTR_FLAG_NONE,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, state->queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, state->queue_id,
|
||||||
ATTR_TYPE_END);
|
ATTR_TYPE_END);
|
||||||
if (attr_scan(src, ATTR_FLAG_STRICT,
|
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &flags,
|
|
||||||
ATTR_TYPE_END) != 1) {
|
|
||||||
state->errs |= CLEANUP_STAT_BAD;
|
|
||||||
flags = 0;
|
|
||||||
}
|
|
||||||
cleanup_control(state, flags);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX Rely on the front-end programs to enforce record size limits.
|
* XXX Rely on the front-end programs to enforce record size limits.
|
||||||
@@ -263,7 +254,8 @@ static void cleanup_service(VSTREAM *src, char *unused_service, char **argv)
|
|||||||
* our status report.
|
* our status report.
|
||||||
*/
|
*/
|
||||||
if (CLEANUP_OUT_OK(state) == 0 && type > 0) {
|
if (CLEANUP_OUT_OK(state) == 0 && type > 0) {
|
||||||
if ((state->errs & CLEANUP_STAT_CONT) == 0)
|
if ((state->errs & CLEANUP_STAT_CONT) == 0
|
||||||
|
&& (state->flags & CLEANUP_FLAG_DISCARD) == 0)
|
||||||
msg_warn("%s: skipping further client input", state->queue_id);
|
msg_warn("%s: skipping further client input", state->queue_id);
|
||||||
while (type != REC_TYPE_END
|
while (type != REC_TYPE_END
|
||||||
&& (type = rec_get(src, buf, 0)) > 0)
|
&& (type = rec_get(src, buf, 0)) > 0)
|
||||||
|
@@ -133,7 +133,8 @@ extern void PRINTFLIKE(3, 4) cleanup_out_format(CLEANUP_STATE *, int, const char
|
|||||||
#define CLEANUP_OUT_BUF(s, t, b) \
|
#define CLEANUP_OUT_BUF(s, t, b) \
|
||||||
cleanup_out((s), (t), vstring_str((b)), VSTRING_LEN((b)))
|
cleanup_out((s), (t), vstring_str((b)), VSTRING_LEN((b)))
|
||||||
|
|
||||||
#define CLEANUP_OUT_OK(s) (((s)->errs & (s)->err_mask) == 0)
|
#define CLEANUP_OUT_OK(s) \
|
||||||
|
(!((s)->errs & (s)->err_mask) && !((s)->flags & CLEANUP_FLAG_DISCARD))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cleanup_envelope.c
|
* cleanup_envelope.c
|
||||||
|
@@ -35,8 +35,9 @@
|
|||||||
/* queue_id result structure member.
|
/* queue_id result structure member.
|
||||||
/*
|
/*
|
||||||
/* cleanup_control() processes per-message flags specified by the caller.
|
/* cleanup_control() processes per-message flags specified by the caller.
|
||||||
/* These flags control the handling of data errors, and must be set
|
/* These flags control the storage of mail and the handling of errors.
|
||||||
/* before processing the first message record.
|
/* It is an error to any change error handling flags in the middle of
|
||||||
|
/* a message.
|
||||||
/* .IP CLEANUP_FLAG_BOUNCE
|
/* .IP CLEANUP_FLAG_BOUNCE
|
||||||
/* The cleanup server is responsible for returning undeliverable
|
/* The cleanup server is responsible for returning undeliverable
|
||||||
/* mail (too many hops, message too large) to the sender.
|
/* mail (too many hops, message too large) to the sender.
|
||||||
@@ -98,6 +99,7 @@
|
|||||||
#include <bounce.h>
|
#include <bounce.h>
|
||||||
#include <mail_params.h>
|
#include <mail_params.h>
|
||||||
#include <mail_stream.h>
|
#include <mail_stream.h>
|
||||||
|
#include <hold_message.h>
|
||||||
|
|
||||||
/* Application-specific. */
|
/* Application-specific. */
|
||||||
|
|
||||||
@@ -168,6 +170,8 @@ void cleanup_control(CLEANUP_STATE *state, int flags)
|
|||||||
* definition.
|
* definition.
|
||||||
*/
|
*/
|
||||||
if ((state->flags = flags) & CLEANUP_FLAG_BOUNCE) {
|
if ((state->flags = flags) & CLEANUP_FLAG_BOUNCE) {
|
||||||
|
if (state->err_mask && state->err_mask != CLEANUP_STAT_MASK_INCOMPLETE)
|
||||||
|
msg_fatal("can't set CLEANUP_FLAG_BOUNCE after initializations");
|
||||||
state->err_mask = CLEANUP_STAT_MASK_INCOMPLETE;
|
state->err_mask = CLEANUP_STAT_MASK_INCOMPLETE;
|
||||||
} else {
|
} else {
|
||||||
state->err_mask = ~CLEANUP_STAT_MASK_EXTRACT_RCPT;
|
state->err_mask = ~CLEANUP_STAT_MASK_EXTRACT_RCPT;
|
||||||
@@ -203,11 +207,28 @@ int cleanup_flush(CLEANUP_STATE *state)
|
|||||||
* If there are no errors, be very picky about queue file write errors
|
* If there are no errors, be very picky about queue file write errors
|
||||||
* because we are about to tell the sender that it can throw away its
|
* because we are about to tell the sender that it can throw away its
|
||||||
* copy of the message.
|
* copy of the message.
|
||||||
|
*
|
||||||
|
* Optionally, place the message on hold, but only if the message was
|
||||||
|
* received successfully. This involves renaming the queue file before
|
||||||
|
* "finishing" it (or else the queue manager would open it for delivery)
|
||||||
|
* and updating our own idea of the queue file name for error recovery
|
||||||
|
* and for error reporting purposes.
|
||||||
*/
|
*/
|
||||||
if (state->errs == 0) {
|
if (state->errs == 0 && (state->flags & CLEANUP_FLAG_DISCARD) == 0) {
|
||||||
|
if ((state->flags & CLEANUP_FLAG_HOLD) != 0) {
|
||||||
|
hold_message(state->temp1, state->queue_name, state->queue_id);
|
||||||
|
junk = cleanup_path;
|
||||||
|
cleanup_path = mystrdup(vstring_str(state->temp1));
|
||||||
|
myfree(junk);
|
||||||
|
vstream_control(state->handle->stream,
|
||||||
|
VSTREAM_CTL_PATH, cleanup_path,
|
||||||
|
VSTREAM_CTL_END);
|
||||||
|
}
|
||||||
state->errs = mail_stream_finish(state->handle, (VSTRING *) 0);
|
state->errs = mail_stream_finish(state->handle, (VSTRING *) 0);
|
||||||
} else {
|
} else {
|
||||||
mail_stream_cleanup(state->handle);
|
mail_stream_cleanup(state->handle);
|
||||||
|
if ((state->flags & CLEANUP_FLAG_DISCARD) != 0)
|
||||||
|
state->errs = 0;
|
||||||
}
|
}
|
||||||
state->handle = 0;
|
state->handle = 0;
|
||||||
state->dst = 0;
|
state->dst = 0;
|
||||||
@@ -254,8 +275,10 @@ int cleanup_flush(CLEANUP_STATE *state)
|
|||||||
}
|
}
|
||||||
if (REMOVE(cleanup_path))
|
if (REMOVE(cleanup_path))
|
||||||
msg_warn("remove %s: %m", cleanup_path);
|
msg_warn("remove %s: %m", cleanup_path);
|
||||||
|
} else if ((state->flags & CLEANUP_FLAG_DISCARD) != 0) {
|
||||||
|
if (REMOVE(cleanup_path))
|
||||||
|
msg_warn("remove %s: %m", cleanup_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that our queue file will not be deleted by the error handler
|
* Make sure that our queue file will not be deleted by the error handler
|
||||||
* AFTER we have taken responsibility for delivery. Better to deliver
|
* AFTER we have taken responsibility for delivery. Better to deliver
|
||||||
|
@@ -217,6 +217,13 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type, char *buf,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nvtable_update(state->attr, attr_name, attr_value);
|
nvtable_update(state->attr, attr_name, attr_value);
|
||||||
|
} else if (type == REC_TYPE_FLGS) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For safety's sake, allow setting flags only. Even this sucks when
|
||||||
|
* people set the CLEANUP_FLAG_BOUNCE flag too late in the game.
|
||||||
|
*/
|
||||||
|
cleanup_control(state, state->flags | atol(buf));
|
||||||
} else {
|
} else {
|
||||||
cleanup_out(state, type, buf, len);
|
cleanup_out(state, type, buf, len);
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +80,6 @@
|
|||||||
#include <mail_proto.h>
|
#include <mail_proto.h>
|
||||||
#include <mime_state.h>
|
#include <mime_state.h>
|
||||||
#include <lex_822.h>
|
#include <lex_822.h>
|
||||||
#include <hold_message.h>
|
|
||||||
|
|
||||||
/* Application-specific. */
|
/* Application-specific. */
|
||||||
|
|
||||||
@@ -291,10 +290,11 @@ static int cleanup_act(CLEANUP_STATE *state, char *context, const char *buf,
|
|||||||
return (CLEANUP_ACT_KEEP);
|
return (CLEANUP_ACT_KEEP);
|
||||||
}
|
}
|
||||||
if (STREQUAL(value, "WARN", command_len)) {
|
if (STREQUAL(value, "WARN", command_len)) {
|
||||||
msg_info("%s: warning: %s %.200s; from=<%s> to=<%s>: %s",
|
msg_info("%s: warning: %s %.200s; from=<%s> to=<%s>%s%s",
|
||||||
state->queue_id, context, buf, state->sender,
|
state->queue_id, context, buf, state->sender,
|
||||||
state->recip ? state->recip : "unknown",
|
state->recip ? state->recip : "unknown",
|
||||||
*optional_text ? optional_text : "content matched");
|
*optional_text ? ": " : "",
|
||||||
|
*optional_text ? optional_text : "");
|
||||||
return (CLEANUP_ACT_KEEP);
|
return (CLEANUP_ACT_KEEP);
|
||||||
}
|
}
|
||||||
if (STREQUAL(value, "FILTER", command_len)) {
|
if (STREQUAL(value, "FILTER", command_len)) {
|
||||||
@@ -307,6 +307,24 @@ static int cleanup_act(CLEANUP_STATE *state, char *context, const char *buf,
|
|||||||
}
|
}
|
||||||
return (CLEANUP_ACT_KEEP);
|
return (CLEANUP_ACT_KEEP);
|
||||||
}
|
}
|
||||||
|
if (STREQUAL(value, "DISCARD", command_len)) {
|
||||||
|
msg_info("%s: discard: %s %.200s; from=<%s> to=<%s>%s%s",
|
||||||
|
state->queue_id, context, buf, state->sender,
|
||||||
|
state->recip ? state->recip : "unknown",
|
||||||
|
*optional_text ? ": " : "",
|
||||||
|
*optional_text ? optional_text : "");
|
||||||
|
state->flags |= CLEANUP_FLAG_DISCARD;
|
||||||
|
return (CLEANUP_ACT_KEEP);
|
||||||
|
}
|
||||||
|
if (STREQUAL(value, "HOLD", command_len)) {
|
||||||
|
msg_info("%s: hold: %s %.200s; from=<%s> to=<%s>%s%s",
|
||||||
|
state->queue_id, context, buf, state->sender,
|
||||||
|
state->recip ? state->recip : "unknown",
|
||||||
|
*optional_text ? ": " : "",
|
||||||
|
*optional_text ? optional_text : "");
|
||||||
|
state->flags |= CLEANUP_FLAG_HOLD;
|
||||||
|
return (CLEANUP_ACT_KEEP);
|
||||||
|
}
|
||||||
if (*optional_text)
|
if (*optional_text)
|
||||||
msg_warn("unexpected text after command in %s map: %s",
|
msg_warn("unexpected text after command in %s map: %s",
|
||||||
map_class, value);
|
map_class, value);
|
||||||
@@ -314,10 +332,6 @@ static int cleanup_act(CLEANUP_STATE *state, char *context, const char *buf,
|
|||||||
if (STREQUAL(value, "IGNORE", command_len))
|
if (STREQUAL(value, "IGNORE", command_len))
|
||||||
return (CLEANUP_ACT_DROP);
|
return (CLEANUP_ACT_DROP);
|
||||||
|
|
||||||
if (STREQUAL(value, "HOLD", command_len)) {
|
|
||||||
hold_message(state->queue_name, state->queue_id);
|
|
||||||
return (CLEANUP_ACT_KEEP);
|
|
||||||
}
|
|
||||||
if (STREQUAL(value, "OK", command_len))
|
if (STREQUAL(value, "OK", command_len))
|
||||||
return (CLEANUP_ACT_KEEP);
|
return (CLEANUP_ACT_KEEP);
|
||||||
|
|
||||||
|
@@ -211,7 +211,7 @@ static void abounce_request_verp(const char *class, const char *service,
|
|||||||
|
|
||||||
if (attr_print(ap->fp, ATTR_FLAG_NONE,
|
if (attr_print(ap->fp, ATTR_FLAG_NONE,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, command,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, command,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
@@ -273,7 +273,7 @@ static void abounce_request(const char *class, const char *service,
|
|||||||
|
|
||||||
if (attr_print(ap->fp, ATTR_FLAG_NONE,
|
if (attr_print(ap->fp, ATTR_FLAG_NONE,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, command,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, command,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
|
@@ -182,7 +182,7 @@ int vbounce_append(int flags, const char *id, const char *recipient,
|
|||||||
if (mail_command_client(MAIL_CLASS_PRIVATE, var_soft_bounce ?
|
if (mail_command_client(MAIL_CLASS_PRIVATE, var_soft_bounce ?
|
||||||
var_defer_service : var_bounce_service,
|
var_defer_service : var_bounce_service,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_APPEND,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_APPEND,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient,
|
ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_WHY, vstring_str(why),
|
ATTR_TYPE_STR, MAIL_ATTR_WHY, vstring_str(why),
|
||||||
@@ -216,7 +216,7 @@ int bounce_flush(int flags, const char *queue, const char *id,
|
|||||||
return (-1);
|
return (-1);
|
||||||
if (mail_command_client(MAIL_CLASS_PRIVATE, var_bounce_service,
|
if (mail_command_client(MAIL_CLASS_PRIVATE, var_bounce_service,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_FLUSH,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_FLUSH,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
@@ -271,7 +271,7 @@ int vbounce_one(int flags, const char *queue, const char *id,
|
|||||||
vstring_vsprintf(why, fmt, ap);
|
vstring_vsprintf(why, fmt, ap);
|
||||||
if (mail_command_client(MAIL_CLASS_PRIVATE, var_bounce_service,
|
if (mail_command_client(MAIL_CLASS_PRIVATE, var_bounce_service,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_ONE,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_ONE,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
|
@@ -16,7 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
#define CLEANUP_FLAG_NONE 0 /* No special features */
|
#define CLEANUP_FLAG_NONE 0 /* No special features */
|
||||||
#define CLEANUP_FLAG_BOUNCE (1<<0) /* Bounce bad messages */
|
#define CLEANUP_FLAG_BOUNCE (1<<0) /* Bounce bad messages */
|
||||||
#define CLEANUP_FLAG_FILTER (2<<0) /* Enable content filter */
|
#define CLEANUP_FLAG_FILTER (1<<1) /* Enable content filter */
|
||||||
|
#define CLEANUP_FLAG_HOLD (1<<2) /* Place message on hold */
|
||||||
|
#define CLEANUP_FLAG_DISCARD (1<<3) /* Discard message */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Diagnostics.
|
* Diagnostics.
|
||||||
|
@@ -151,7 +151,7 @@ int vdefer_append(int flags, const char *id, const char *recipient,
|
|||||||
vstring_vsprintf(why, fmt, ap);
|
vstring_vsprintf(why, fmt, ap);
|
||||||
if (mail_command_client(MAIL_CLASS_PRIVATE, var_defer_service,
|
if (mail_command_client(MAIL_CLASS_PRIVATE, var_defer_service,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_APPEND,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_APPEND,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient,
|
ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_WHY, vstring_str(why),
|
ATTR_TYPE_STR, MAIL_ATTR_WHY, vstring_str(why),
|
||||||
@@ -185,7 +185,7 @@ int defer_flush(int flags, const char *queue, const char *id,
|
|||||||
{
|
{
|
||||||
if (mail_command_client(MAIL_CLASS_PRIVATE, var_defer_service,
|
if (mail_command_client(MAIL_CLASS_PRIVATE, var_defer_service,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_FLUSH,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_FLUSH,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
ATTR_TYPE_STR, MAIL_ATTR_ENCODING, encoding,
|
||||||
@@ -205,7 +205,7 @@ int defer_warn(int flags, const char *queue, const char *id,
|
|||||||
{
|
{
|
||||||
if (mail_command_client(MAIL_CLASS_PRIVATE, var_defer_service,
|
if (mail_command_client(MAIL_CLASS_PRIVATE, var_defer_service,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_WARN,
|
ATTR_TYPE_NUM, MAIL_ATTR_NREQ, BOUNCE_CMD_WARN,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_BFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_SENDER, sender,
|
ATTR_TYPE_STR, MAIL_ATTR_SENDER, sender,
|
||||||
|
@@ -94,7 +94,7 @@ static int deliver_pass_send_request(VSTREAM *stream, DELIVER_REQUEST *request,
|
|||||||
int stat;
|
int stat;
|
||||||
|
|
||||||
attr_print(stream, ATTR_FLAG_NONE,
|
attr_print(stream, ATTR_FLAG_NONE,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, request->flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_DFLAGS, request->flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, request->queue_name,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, request->queue_name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, request->queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, request->queue_id,
|
||||||
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, request->data_offset,
|
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, request->data_offset,
|
||||||
|
@@ -196,7 +196,7 @@ static int deliver_request_get(VSTREAM *stream, DELIVER_REQUEST *request)
|
|||||||
* the conversation when they send bad information.
|
* the conversation when they send bad information.
|
||||||
*/
|
*/
|
||||||
if (attr_scan(stream, ATTR_FLAG_STRICT | ATTR_FLAG_MORE,
|
if (attr_scan(stream, ATTR_FLAG_STRICT | ATTR_FLAG_MORE,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &request->flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_DFLAGS, &request->flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, queue_name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, queue_id,
|
||||||
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, &request->data_offset,
|
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, &request->data_offset,
|
||||||
|
@@ -6,13 +6,22 @@
|
|||||||
/* SYNOPSIS
|
/* SYNOPSIS
|
||||||
/* #include <hold_message.h>
|
/* #include <hold_message.h>
|
||||||
/*
|
/*
|
||||||
/* void hold_message(queue_name, queue_id)
|
/* void hold_message(path_buf, queue_name, queue_id)
|
||||||
|
/* VSTRING *path_buf;
|
||||||
/* const char *queue_name;
|
/* const char *queue_name;
|
||||||
/* const char *queue_id;
|
/* const char *queue_id;
|
||||||
/* DESCRIPTION
|
/* DESCRIPTION
|
||||||
/* The \fBhold_message\fR() routine moves the specified
|
/* The \fBhold_message\fR() routine moves the specified
|
||||||
/* queue file to the \fBhold\fR queue, where it will sit
|
/* queue file to the \fBhold\fR queue, where it will sit
|
||||||
/* until someone either destroys it or releases it.
|
/* until someone either destroys it or releases it.
|
||||||
|
/*
|
||||||
|
/* Arguments:
|
||||||
|
/* .IP path_buf
|
||||||
|
/* A null pointer, or storage for the new pathname.
|
||||||
|
/* .IP queue_name
|
||||||
|
/* Queue name with the message that needs to be placed on hold.
|
||||||
|
/* .IP queue_id
|
||||||
|
/* Queue file name with the message that needs to be placed on hold.
|
||||||
/* LICENSE
|
/* LICENSE
|
||||||
/* .ad
|
/* .ad
|
||||||
/* .fi
|
/* .fi
|
||||||
@@ -47,10 +56,11 @@
|
|||||||
|
|
||||||
/* hold_message - move message to hold queue */
|
/* hold_message - move message to hold queue */
|
||||||
|
|
||||||
void hold_message(const char *queue_name, const char *queue_id)
|
void hold_message(VSTRING *path_buf, const char *queue_name,
|
||||||
|
const char *queue_id)
|
||||||
{
|
{
|
||||||
VSTRING *old_path = vstring_alloc(100);
|
VSTRING *old_path = vstring_alloc(100);
|
||||||
VSTRING *new_path = vstring_alloc(100);
|
VSTRING *new_path = 0;
|
||||||
uid_t saved_uid;
|
uid_t saved_uid;
|
||||||
gid_t saved_gid;
|
gid_t saved_gid;
|
||||||
|
|
||||||
@@ -62,18 +72,26 @@ void hold_message(const char *queue_name, const char *queue_id)
|
|||||||
set_eugid(var_owner_uid, var_owner_gid);
|
set_eugid(var_owner_uid, var_owner_gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Your buffer or mine?
|
||||||
|
*/
|
||||||
|
if (path_buf == 0)
|
||||||
|
new_path = path_buf = vstring_alloc(100);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Grr. Don't do stupid things when this function is called multiple
|
* Grr. Don't do stupid things when this function is called multiple
|
||||||
* times. sane_rename() would emit a bogus warning about spurious NFS
|
* times. sane_rename() would emit a bogus warning about spurious NFS
|
||||||
* problems.
|
* problems.
|
||||||
*/
|
*/
|
||||||
(void) mail_queue_path(old_path, queue_name, queue_id);
|
(void) mail_queue_path(old_path, queue_name, queue_id);
|
||||||
(void) mail_queue_path(new_path, MAIL_QUEUE_HOLD, queue_id);
|
(void) mail_queue_path(path_buf, MAIL_QUEUE_HOLD, queue_id);
|
||||||
if (access(STR(old_path), F_OK) == 0) {
|
if (access(STR(old_path), F_OK) == 0) {
|
||||||
if (rename(STR(old_path), STR(new_path)) == 0
|
if (rename(STR(old_path), STR(path_buf)) == 0
|
||||||
|| access(STR(new_path), F_OK) == 0)
|
|| (access(STR(old_path), F_OK) < 0
|
||||||
msg_info("%s: placed on hold", queue_id);
|
&& access(STR(path_buf), F_OK) == 0)) {
|
||||||
else
|
if (msg_verbose)
|
||||||
|
msg_info("%s: placed on hold", queue_id);
|
||||||
|
} else
|
||||||
msg_warn("%s: could not place message on hold: %m", queue_id);
|
msg_warn("%s: could not place message on hold: %m", queue_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,5 +105,6 @@ void hold_message(const char *queue_name, const char *queue_id)
|
|||||||
* Cleanup.
|
* Cleanup.
|
||||||
*/
|
*/
|
||||||
vstring_free(old_path);
|
vstring_free(old_path);
|
||||||
vstring_free(new_path);
|
if (new_path)
|
||||||
|
vstring_free(new_path);
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
/*
|
/*
|
||||||
* External interface.
|
* External interface.
|
||||||
*/
|
*/
|
||||||
extern void hold_message(const char *, const char *);
|
extern void hold_message(VSTRING *, const char *, const char *);
|
||||||
|
|
||||||
/* LICENSE
|
/* LICENSE
|
||||||
/* .ad
|
/* .ad
|
||||||
|
@@ -811,7 +811,7 @@ extern bool var_smtpd_sasl_enable;
|
|||||||
extern char *var_smtpd_sasl_opts;
|
extern char *var_smtpd_sasl_opts;
|
||||||
|
|
||||||
#define VAR_SMTPD_SASL_REALM "smtpd_sasl_local_domain"
|
#define VAR_SMTPD_SASL_REALM "smtpd_sasl_local_domain"
|
||||||
#define DEF_SMTPD_SASL_REALM "$myhostname"
|
#define DEF_SMTPD_SASL_REALM ""
|
||||||
extern char *var_smtpd_sasl_realm;
|
extern char *var_smtpd_sasl_realm;
|
||||||
|
|
||||||
#define VAR_SMTPD_SND_AUTH_MAPS "smtpd_sender_login_maps"
|
#define VAR_SMTPD_SND_AUTH_MAPS "smtpd_sender_login_maps"
|
||||||
|
@@ -80,7 +80,9 @@ extern char *mail_pathname(const char *, const char *);
|
|||||||
#define MAIL_ATTR_NREQ "nrequest"
|
#define MAIL_ATTR_NREQ "nrequest"
|
||||||
#define MAIL_ATTR_STATUS "status"
|
#define MAIL_ATTR_STATUS "status"
|
||||||
|
|
||||||
#define MAIL_ATTR_FLAGS "flags"
|
#define MAIL_ATTR_BFLAGS "bounce_flags"
|
||||||
|
#define MAIL_ATTR_DFLAGS "delivery_flags"
|
||||||
|
#define MAIL_ATTR_RFLAGS "resolve_flags"
|
||||||
#define MAIL_ATTR_QUEUE "queue_name"
|
#define MAIL_ATTR_QUEUE "queue_name"
|
||||||
#define MAIL_ATTR_QUEUEID "queue_id"
|
#define MAIL_ATTR_QUEUEID "queue_id"
|
||||||
#define MAIL_ATTR_SENDER "sender"
|
#define MAIL_ATTR_SENDER "sender"
|
||||||
|
@@ -41,7 +41,6 @@
|
|||||||
/* command. mail_run_background() returns the process id in case
|
/* command. mail_run_background() returns the process id in case
|
||||||
/* of success.
|
/* of success.
|
||||||
/* CONFIGURATION PARAMETERS
|
/* CONFIGURATION PARAMETERS
|
||||||
/* program_directory: directory with Postfix executables;
|
|
||||||
/* fork_attempts: number of attempts to fork() a process;
|
/* fork_attempts: number of attempts to fork() a process;
|
||||||
/* fork_delay: delay in seconds between fork() attempts.
|
/* fork_delay: delay in seconds between fork() attempts.
|
||||||
/* LICENSE
|
/* LICENSE
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
* Patches change the patchlevel and the release date. Snapshots change the
|
* Patches change the patchlevel and the release date. Snapshots change the
|
||||||
* release date only, unless they include the same bugfix as a patch release.
|
* release date only, unless they include the same bugfix as a patch release.
|
||||||
*/
|
*/
|
||||||
#define MAIL_RELEASE_DATE "20020819"
|
#define MAIL_RELEASE_DATE "20020821"
|
||||||
|
|
||||||
#define VAR_MAIL_VERSION "mail_version"
|
#define VAR_MAIL_VERSION "mail_version"
|
||||||
#define DEF_MAIL_VERSION "1.1.11-" MAIL_RELEASE_DATE
|
#define DEF_MAIL_VERSION "1.1.11-" MAIL_RELEASE_DATE
|
||||||
|
@@ -141,16 +141,14 @@ static void post_mail_init(VSTREAM *stream, const char *sender,
|
|||||||
*/
|
*/
|
||||||
if (attr_scan(stream, ATTR_FLAG_STRICT,
|
if (attr_scan(stream, ATTR_FLAG_STRICT,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, id,
|
||||||
ATTR_TYPE_END) != 1
|
ATTR_TYPE_END) != 1)
|
||||||
|| attr_print(stream, ATTR_FLAG_NONE,
|
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
|
||||||
ATTR_TYPE_END) != 0)
|
|
||||||
msg_fatal("unable to contact the %s service", var_cleanup_service);
|
msg_fatal("unable to contact the %s service", var_cleanup_service);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate a minimal envelope section. The cleanup service will add a
|
* Generate a minimal envelope section. The cleanup service will add a
|
||||||
* size record.
|
* size record.
|
||||||
*/
|
*/
|
||||||
|
rec_fprintf(stream, REC_TYPE_FLGS, "%d", flags);
|
||||||
rec_fprintf(stream, REC_TYPE_TIME, "%ld", (long) now);
|
rec_fprintf(stream, REC_TYPE_TIME, "%ld", (long) now);
|
||||||
rec_fprintf(stream, REC_TYPE_ATTR, "%s=%s",
|
rec_fprintf(stream, REC_TYPE_ATTR, "%s=%s",
|
||||||
MAIL_ATTR_ORIGIN, MAIL_ATTR_ORG_LOCAL);
|
MAIL_ATTR_ORIGIN, MAIL_ATTR_ORG_LOCAL);
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#define REC_TYPE_ORCP 'O' /* original recipient, optional */
|
#define REC_TYPE_ORCP 'O' /* original recipient, optional */
|
||||||
#define REC_TYPE_WARN 'W' /* warning message time */
|
#define REC_TYPE_WARN 'W' /* warning message time */
|
||||||
#define REC_TYPE_ATTR 'A' /* named attribute for extensions */
|
#define REC_TYPE_ATTR 'A' /* named attribute for extensions */
|
||||||
|
#define REC_TYPE_FLGS 'f' /* set processing flags */
|
||||||
|
|
||||||
#define REC_TYPE_MESG 'M' /* start message records */
|
#define REC_TYPE_MESG 'M' /* start message records */
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@
|
|||||||
* allow for the presence of A records in the extracted segment, because it
|
* allow for the presence of A records in the extracted segment, because it
|
||||||
* can be requested to re-process already queued mail with `postsuper -r'.
|
* can be requested to re-process already queued mail with `postsuper -r'.
|
||||||
*/
|
*/
|
||||||
#define REC_TYPE_ENVELOPE "MCTFILSDROWVA"
|
#define REC_TYPE_ENVELOPE "MCTFILSDROWVAf"
|
||||||
#define REC_TYPE_CONTENT "XLN"
|
#define REC_TYPE_CONTENT "XLN"
|
||||||
#define REC_TYPE_EXTRACT "EDROPreAFI"
|
#define REC_TYPE_EXTRACT "EDROPreAFI"
|
||||||
|
|
||||||
|
@@ -168,7 +168,7 @@ void resolve_clnt_query(const char *addr, RESOLVE_REPLY *reply)
|
|||||||
ATTR_TYPE_STR, MAIL_ATTR_NEXTHOP, reply->nexthop,
|
ATTR_TYPE_STR, MAIL_ATTR_NEXTHOP, reply->nexthop,
|
||||||
|
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_RECIP, reply->recipient,
|
ATTR_TYPE_STR, MAIL_ATTR_RECIP, reply->recipient,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, &reply->flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_RFLAGS, &reply->flags,
|
||||||
ATTR_TYPE_END) != 4) {
|
ATTR_TYPE_END) != 4) {
|
||||||
if (msg_verbose || (errno != EPIPE && errno != ENOENT))
|
if (msg_verbose || (errno != EPIPE && errno != ENOENT))
|
||||||
msg_warn("%s: bad read: %m", myname);
|
msg_warn("%s: bad read: %m", myname);
|
||||||
|
@@ -139,14 +139,12 @@ static FORWARD_INFO *forward_open(char *sender)
|
|||||||
info->cleanup = cleanup;
|
info->cleanup = cleanup;
|
||||||
info->queue_id = mystrdup(vstring_str(buffer));
|
info->queue_id = mystrdup(vstring_str(buffer));
|
||||||
info->posting_time = time((time_t *) 0);
|
info->posting_time = time((time_t *) 0);
|
||||||
attr_print(cleanup, ATTR_FLAG_NONE,
|
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, CLEANUP_FLAG_BOUNCE,
|
|
||||||
ATTR_TYPE_END);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send initial message envelope information. For bounces, set the
|
* Send initial message envelope information. For bounces, set the
|
||||||
* designated sender: mailing list owner, posting user, whatever.
|
* designated sender: mailing list owner, posting user, whatever.
|
||||||
*/
|
*/
|
||||||
|
rec_fprintf(cleanup, REC_TYPE_FLGS, "%d", CLEANUP_FLAG_BOUNCE);
|
||||||
rec_fprintf(cleanup, REC_TYPE_TIME, "%ld", (long) info->posting_time);
|
rec_fprintf(cleanup, REC_TYPE_TIME, "%ld", (long) info->posting_time);
|
||||||
rec_fputs(cleanup, REC_TYPE_FROM, sender);
|
rec_fputs(cleanup, REC_TYPE_FROM, sender);
|
||||||
|
|
||||||
|
@@ -252,7 +252,7 @@ int deliver_mailbox(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp)
|
|||||||
*
|
*
|
||||||
* Don't come here more than once, whether or not the recipient exists.
|
* Don't come here more than once, whether or not the recipient exists.
|
||||||
*/
|
*/
|
||||||
if (been_here(state.dup_filter, "mailbox %s", state.msg_attr.user))
|
if (been_here(state.dup_filter, "mailbox %s", state.msg_attr.local))
|
||||||
return (YES);
|
return (YES);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -160,7 +160,7 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream)
|
|||||||
nexthop = (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ?
|
nexthop = (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ?
|
||||||
cp + 1 : entry->queue->name;
|
cp + 1 : entry->queue->name;
|
||||||
attr_print(stream, ATTR_FLAG_MORE,
|
attr_print(stream, ATTR_FLAG_MORE,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_DFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, message->queue_name,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, message->queue_name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, message->queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, message->queue_id,
|
||||||
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, message->data_offset,
|
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, message->data_offset,
|
||||||
|
@@ -191,6 +191,8 @@ static int copy_segment(VSTREAM *qfile, VSTREAM *cleanup, PICKUP_INFO *info,
|
|||||||
info->rcpt = mystrdup(vstring_str(buf));
|
info->rcpt = mystrdup(vstring_str(buf));
|
||||||
if (type == REC_TYPE_TIME)
|
if (type == REC_TYPE_TIME)
|
||||||
continue;
|
continue;
|
||||||
|
if (type == REC_TYPE_FLGS)
|
||||||
|
continue;
|
||||||
if (type == REC_TYPE_ATTR) {
|
if (type == REC_TYPE_ATTR) {
|
||||||
if ((error_text = split_nameval(vstring_str(buf), &attr_name,
|
if ((error_text = split_nameval(vstring_str(buf), &attr_name,
|
||||||
&attr_value)) != 0) {
|
&attr_value)) != 0) {
|
||||||
@@ -267,6 +269,15 @@ static int pickup_copy(VSTREAM *qfile, VSTREAM *cleanup,
|
|||||||
info->id, (int) (now - info->st.st_mtime) / DAY_SECONDS);
|
info->id, (int) (now - info->st.st_mtime) / DAY_SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send our processing options. In case of trouble, request that the
|
||||||
|
* cleanup service bounces its copy of the message. because the original
|
||||||
|
* input file is not readable by the bounce service.
|
||||||
|
*/
|
||||||
|
#define PICKUP_CLEANUP_FLAGS (CLEANUP_FLAG_BOUNCE | CLEANUP_FLAG_FILTER)
|
||||||
|
|
||||||
|
rec_fprintf(cleanup, REC_TYPE_FLGS, "%d", PICKUP_CLEANUP_FLAGS);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the message has a posting-time record.
|
* Make sure the message has a posting-time record.
|
||||||
*/
|
*/
|
||||||
@@ -389,23 +400,17 @@ static int pickup_file(PICKUP_INFO *info)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Contact the cleanup service and read the queue ID that it has
|
* Contact the cleanup service and read the queue ID that it has
|
||||||
* allocated. In case of trouble, request that the cleanup service
|
* allocated.
|
||||||
* bounces its copy of the message. because the original input file is
|
|
||||||
* not readable by the bounce service.
|
|
||||||
*
|
*
|
||||||
* The actual message copying code is in a separate routine, so that it is
|
* The actual message copying code is in a separate routine, so that it is
|
||||||
* easier to implement the many possible error exits without forgetting
|
* easier to implement the many possible error exits without forgetting
|
||||||
* to close files, or to release memory.
|
* to close files, or to release memory.
|
||||||
*/
|
*/
|
||||||
#define PICKUP_CLEANUP_FLAGS (CLEANUP_FLAG_BOUNCE | CLEANUP_FLAG_FILTER)
|
|
||||||
|
|
||||||
cleanup = mail_connect_wait(MAIL_CLASS_PUBLIC, var_cleanup_service);
|
cleanup = mail_connect_wait(MAIL_CLASS_PUBLIC, var_cleanup_service);
|
||||||
if (attr_scan(cleanup, ATTR_FLAG_STRICT,
|
if (attr_scan(cleanup, ATTR_FLAG_STRICT,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, buf,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, buf,
|
||||||
ATTR_TYPE_END) != 1
|
ATTR_TYPE_END) != 1) {
|
||||||
|| attr_print(cleanup, ATTR_FLAG_NONE,
|
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, PICKUP_CLEANUP_FLAGS,
|
|
||||||
ATTR_TYPE_END) != 0) {
|
|
||||||
status = KEEP_MESSAGE_FILE;
|
status = KEEP_MESSAGE_FILE;
|
||||||
} else {
|
} else {
|
||||||
info->id = mystrdup(vstring_str(buf));
|
info->id = mystrdup(vstring_str(buf));
|
||||||
|
@@ -297,6 +297,9 @@ int main(int argc, char **argv)
|
|||||||
*
|
*
|
||||||
* If something goes wrong, slurp up the input before responding to the
|
* If something goes wrong, slurp up the input before responding to the
|
||||||
* client, otherwise the client will give up after detecting SIGPIPE.
|
* client, otherwise the client will give up after detecting SIGPIPE.
|
||||||
|
*
|
||||||
|
* XXX Need to add REC_TYPE_ATTR filtering code before we can talk directly
|
||||||
|
* to the cleanup daemon.
|
||||||
*/
|
*/
|
||||||
vstream_control(VSTREAM_IN, VSTREAM_CTL_PATH, "stdin", VSTREAM_CTL_END);
|
vstream_control(VSTREAM_IN, VSTREAM_CTL_PATH, "stdin", VSTREAM_CTL_END);
|
||||||
buf = vstring_alloc(100);
|
buf = vstring_alloc(100);
|
||||||
@@ -315,13 +318,17 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (rec_type == REC_TYPE_ERROR)
|
if (rec_type == REC_TYPE_ERROR)
|
||||||
msg_fatal("uid=%ld: malformed input", (long) uid);
|
msg_fatal("uid=%ld: malformed input", (long) uid);
|
||||||
if (rec_type == REC_TYPE_TIME)
|
|
||||||
rec_fprintf(dst->stream, REC_TYPE_TIME, "%ld",
|
|
||||||
(long) time((time_t *) 0));
|
|
||||||
if (strchr(*expected, rec_type) == 0)
|
if (strchr(*expected, rec_type) == 0)
|
||||||
msg_fatal("uid=%ld: unexpected record type: %d", (long) uid, rec_type);
|
msg_fatal("uid=%ld: unexpected record type: %d", (long) uid, rec_type);
|
||||||
if (rec_type == **expected)
|
if (rec_type == **expected)
|
||||||
expected++;
|
expected++;
|
||||||
|
if (rec_type == REC_TYPE_TIME) {
|
||||||
|
rec_fprintf(dst->stream, REC_TYPE_TIME, "%ld",
|
||||||
|
(long) time((time_t *) 0));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (rec_type == REC_TYPE_FLGS)
|
||||||
|
continue;
|
||||||
if (REC_PUT_BUF(dst->stream, rec_type, buf) < 0) {
|
if (REC_PUT_BUF(dst->stream, rec_type, buf) < 0) {
|
||||||
while ((rec_type = rec_get(VSTREAM_IN, buf, var_line_limit)) > 0
|
while ((rec_type = rec_get(VSTREAM_IN, buf, var_line_limit)) > 0
|
||||||
&& rec_type != REC_TYPE_END)
|
&& rec_type != REC_TYPE_END)
|
||||||
|
@@ -155,7 +155,7 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream)
|
|||||||
nexthop = (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ?
|
nexthop = (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ?
|
||||||
cp + 1 : entry->queue->name;
|
cp + 1 : entry->queue->name;
|
||||||
attr_print(stream, ATTR_FLAG_MORE,
|
attr_print(stream, ATTR_FLAG_MORE,
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_DFLAGS, flags,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, message->queue_name,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUE, message->queue_name,
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, message->queue_id,
|
ATTR_TYPE_STR, MAIL_ATTR_QUEUEID, message->queue_id,
|
||||||
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, message->data_offset,
|
ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, message->data_offset,
|
||||||
|
@@ -182,10 +182,7 @@ static void qmqpd_open_file(QMQPD_STATE *state)
|
|||||||
* Connect to the cleanup server. Log client name/address with queue ID.
|
* Connect to the cleanup server. Log client name/address with queue ID.
|
||||||
*/
|
*/
|
||||||
state->dest = mail_stream_service(MAIL_CLASS_PUBLIC, var_cleanup_service);
|
state->dest = mail_stream_service(MAIL_CLASS_PUBLIC, var_cleanup_service);
|
||||||
if (state->dest == 0
|
if (state->dest == 0)
|
||||||
|| attr_print(state->dest->stream, ATTR_FLAG_NONE,
|
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, CLEANUP_FLAG_FILTER,
|
|
||||||
ATTR_TYPE_END) != 0)
|
|
||||||
msg_fatal("unable to connect to the %s %s service",
|
msg_fatal("unable to connect to the %s %s service",
|
||||||
MAIL_CLASS_PUBLIC, var_cleanup_service);
|
MAIL_CLASS_PUBLIC, var_cleanup_service);
|
||||||
state->cleanup = state->dest->stream;
|
state->cleanup = state->dest->stream;
|
||||||
@@ -197,6 +194,7 @@ static void qmqpd_open_file(QMQPD_STATE *state)
|
|||||||
* bloody likely, but present for the sake of consistency with all other
|
* bloody likely, but present for the sake of consistency with all other
|
||||||
* Postfix points of entrance).
|
* Postfix points of entrance).
|
||||||
*/
|
*/
|
||||||
|
rec_fprintf(state->cleanup, REC_TYPE_FLGS, "%d", CLEANUP_FLAG_FILTER);
|
||||||
rec_fprintf(state->cleanup, REC_TYPE_TIME, "%ld", (long) state->time);
|
rec_fprintf(state->cleanup, REC_TYPE_TIME, "%ld", (long) state->time);
|
||||||
if (*var_filter_xport)
|
if (*var_filter_xport)
|
||||||
rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s", var_filter_xport);
|
rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s", var_filter_xport);
|
||||||
|
@@ -230,11 +230,9 @@
|
|||||||
/* .IP \fBmail_owner\fR
|
/* .IP \fBmail_owner\fR
|
||||||
/* The owner of the mail queue and of most Postfix processes.
|
/* The owner of the mail queue and of most Postfix processes.
|
||||||
/* .IP \fBcommand_directory\fR
|
/* .IP \fBcommand_directory\fR
|
||||||
/* Directory with Postfix support commands (default:
|
/* Directory with Postfix support commands.
|
||||||
/* \fB$program_directory\fR).
|
|
||||||
/* .IP \fBdaemon_directory\fR
|
/* .IP \fBdaemon_directory\fR
|
||||||
/* Directory with Postfix daemon programs (default:
|
/* Directory with Postfix daemon programs.
|
||||||
/* \fB$program_directory\fR).
|
|
||||||
/* .IP \fBqueue_directory\fR
|
/* .IP \fBqueue_directory\fR
|
||||||
/* Top-level directory of the Postfix queue. This is also the root
|
/* Top-level directory of the Postfix queue. This is also the root
|
||||||
/* directory of Postfix daemons that run chrooted.
|
/* directory of Postfix daemons that run chrooted.
|
||||||
|
@@ -198,6 +198,9 @@ smtpd_check.o: ../../include/mail_addr_find.h
|
|||||||
smtpd_check.o: ../../include/match_parent_style.h
|
smtpd_check.o: ../../include/match_parent_style.h
|
||||||
smtpd_check.o: ../../include/strip_addr.h
|
smtpd_check.o: ../../include/strip_addr.h
|
||||||
smtpd_check.o: ../../include/virtual8.h
|
smtpd_check.o: ../../include/virtual8.h
|
||||||
|
smtpd_check.o: ../../include/cleanup_user.h
|
||||||
|
smtpd_check.o: ../../include/record.h
|
||||||
|
smtpd_check.o: ../../include/rec_type.h
|
||||||
smtpd_check.o: smtpd.h
|
smtpd_check.o: smtpd.h
|
||||||
smtpd_check.o: ../../include/mail_stream.h
|
smtpd_check.o: ../../include/mail_stream.h
|
||||||
smtpd_check.o: smtpd_sasl_glue.h
|
smtpd_check.o: smtpd_sasl_glue.h
|
||||||
|
@@ -103,8 +103,7 @@
|
|||||||
/* .IP \fBalways_bcc\fR
|
/* .IP \fBalways_bcc\fR
|
||||||
/* Address to send a copy of each message that enters the system.
|
/* Address to send a copy of each message that enters the system.
|
||||||
/* .IP \fBcommand_directory\fR
|
/* .IP \fBcommand_directory\fR
|
||||||
/* Location of Postfix support commands (default:
|
/* Location of Postfix support commands.
|
||||||
/* \fB$program_directory\fR).
|
|
||||||
/* .IP \fBdebug_peer_level\fR
|
/* .IP \fBdebug_peer_level\fR
|
||||||
/* Increment in verbose logging level when a remote host matches a
|
/* Increment in verbose logging level when a remote host matches a
|
||||||
/* pattern in the \fBdebug_peer_list\fR parameter.
|
/* pattern in the \fBdebug_peer_list\fR parameter.
|
||||||
@@ -539,12 +538,11 @@ static void mail_open_stream(SMTPD_STATE *state)
|
|||||||
if (SMTPD_STAND_ALONE(state) == 0) {
|
if (SMTPD_STAND_ALONE(state) == 0) {
|
||||||
state->dest = mail_stream_service(MAIL_CLASS_PUBLIC,
|
state->dest = mail_stream_service(MAIL_CLASS_PUBLIC,
|
||||||
var_cleanup_service);
|
var_cleanup_service);
|
||||||
if (state->dest == 0
|
if (state->dest == 0)
|
||||||
|| attr_print(state->dest->stream, ATTR_FLAG_NONE,
|
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, CLEANUP_FLAG_FILTER,
|
|
||||||
ATTR_TYPE_END) != 0)
|
|
||||||
msg_fatal("unable to connect to the %s %s service",
|
msg_fatal("unable to connect to the %s %s service",
|
||||||
MAIL_CLASS_PUBLIC, var_cleanup_service);
|
MAIL_CLASS_PUBLIC, var_cleanup_service);
|
||||||
|
rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d",
|
||||||
|
CLEANUP_FLAG_FILTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -293,6 +293,9 @@
|
|||||||
#include <match_parent_style.h>
|
#include <match_parent_style.h>
|
||||||
#include <strip_addr.h>
|
#include <strip_addr.h>
|
||||||
#include <virtual8.h>
|
#include <virtual8.h>
|
||||||
|
#include <cleanup_user.h>
|
||||||
|
#include <record.h>
|
||||||
|
#include <rec_type.h>
|
||||||
|
|
||||||
/* Application-specific. */
|
/* Application-specific. */
|
||||||
|
|
||||||
@@ -614,6 +617,29 @@ void smtpd_check_init(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* log_whatsup - log as much context as we have */
|
||||||
|
|
||||||
|
static void log_whatsup(SMTPD_STATE *state, const char *whatsup,
|
||||||
|
const char *text)
|
||||||
|
{
|
||||||
|
if (state->recipient && state->sender) {
|
||||||
|
msg_info("%s: %s from %s: %s; from=<%s> to=<%s>",
|
||||||
|
whatsup, state->where, state->namaddr, text,
|
||||||
|
state->sender, state->recipient);
|
||||||
|
} else if (state->recipient) {
|
||||||
|
msg_info("%s: %s from %s: %s; to=<%s>",
|
||||||
|
whatsup, state->where, state->namaddr, text,
|
||||||
|
state->recipient);
|
||||||
|
} else if (state->sender) {
|
||||||
|
msg_info("%s: %s from %s: %s; from=<%s>",
|
||||||
|
whatsup, state->where, state->namaddr, text,
|
||||||
|
state->sender);
|
||||||
|
} else {
|
||||||
|
msg_info("%s: %s from %s: %s",
|
||||||
|
whatsup, state->where, state->namaddr, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* smtpd_check_reject - do the boring things that must be done */
|
/* smtpd_check_reject - do the boring things that must be done */
|
||||||
|
|
||||||
static int smtpd_check_reject(SMTPD_STATE *state, int error_class,
|
static int smtpd_check_reject(SMTPD_STATE *state, int error_class,
|
||||||
@@ -682,22 +708,8 @@ static int smtpd_check_reject(SMTPD_STATE *state, int error_class,
|
|||||||
* postmaster notices, this may be the only trace left that service was
|
* postmaster notices, this may be the only trace left that service was
|
||||||
* rejected. Print the request, client name/address, and response.
|
* rejected. Print the request, client name/address, and response.
|
||||||
*/
|
*/
|
||||||
if (state->recipient && state->sender) {
|
log_whatsup(state, whatsup, STR(error_text));
|
||||||
msg_info("%s: %s from %s: %s; from=<%s> to=<%s>",
|
|
||||||
whatsup, state->where, state->namaddr, STR(error_text),
|
|
||||||
state->sender, state->recipient);
|
|
||||||
} else if (state->recipient) {
|
|
||||||
msg_info("%s: %s from %s: %s; to=<%s>",
|
|
||||||
whatsup, state->where, state->namaddr, STR(error_text),
|
|
||||||
state->recipient);
|
|
||||||
} else if (state->sender) {
|
|
||||||
msg_info("%s: %s from %s: %s; from=<%s>",
|
|
||||||
whatsup, state->where, state->namaddr, STR(error_text),
|
|
||||||
state->sender);
|
|
||||||
} else {
|
|
||||||
msg_info("%s: %s from %s: %s",
|
|
||||||
whatsup, state->where, state->namaddr, STR(error_text));
|
|
||||||
}
|
|
||||||
return (warn_if_reject ? 0 : SMTPD_CHECK_REJECT);
|
return (warn_if_reject ? 0 : SMTPD_CHECK_REJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1496,6 +1508,28 @@ static int check_table_result(SMTPD_STATE *state, const char *table,
|
|||||||
"%d <%s>: %s rejected: Access denied",
|
"%d <%s>: %s rejected: Access denied",
|
||||||
var_access_map_code, reply_name, reply_class));
|
var_access_map_code, reply_name, reply_class));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HOLD means deliver later.
|
||||||
|
*/
|
||||||
|
if (strcasecmp(value, "HOLD") == 0) {
|
||||||
|
vstring_sprintf(error_text, "<%s>: %s triggers HOLD action",
|
||||||
|
reply_name, reply_class);
|
||||||
|
log_whatsup(state, "hold", STR(error_text));
|
||||||
|
rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d",
|
||||||
|
CLEANUP_FLAG_HOLD);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DISCARD means silently discard and claim successful delivery.
|
||||||
|
*/
|
||||||
|
if (strcasecmp(value, "DISCARD") == 0) {
|
||||||
|
vstring_sprintf(error_text, "<%s>: %s triggers DISCARD action",
|
||||||
|
reply_name, reply_class);
|
||||||
|
log_whatsup(state, "discard", STR(error_text));
|
||||||
|
rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d",
|
||||||
|
CLEANUP_FLAG_DISCARD);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All-numeric result probably means OK - some out-of-band authentication
|
* All-numeric result probably means OK - some out-of-band authentication
|
||||||
* mechanism uses this as time stamp.
|
* mechanism uses this as time stamp.
|
||||||
|
@@ -291,7 +291,7 @@ int resolve_proto(VSTREAM *stream)
|
|||||||
ATTR_TYPE_STR, MAIL_ATTR_TRANSPORT, STR(channel),
|
ATTR_TYPE_STR, MAIL_ATTR_TRANSPORT, STR(channel),
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_NEXTHOP, STR(nexthop),
|
ATTR_TYPE_STR, MAIL_ATTR_NEXTHOP, STR(nexthop),
|
||||||
ATTR_TYPE_STR, MAIL_ATTR_RECIP, STR(nextrcpt),
|
ATTR_TYPE_STR, MAIL_ATTR_RECIP, STR(nextrcpt),
|
||||||
ATTR_TYPE_NUM, MAIL_ATTR_FLAGS, flags,
|
ATTR_TYPE_NUM, MAIL_ATTR_RFLAGS, flags,
|
||||||
ATTR_TYPE_END);
|
ATTR_TYPE_END);
|
||||||
|
|
||||||
if (vstream_fflush(stream) != 0) {
|
if (vstream_fflush(stream) != 0) {
|
||||||
|
@@ -94,13 +94,6 @@
|
|||||||
|
|
||||||
#ifdef HAS_LDAP
|
#ifdef HAS_LDAP
|
||||||
|
|
||||||
/*
|
|
||||||
* Older APIs have weird memory freeing behavior.
|
|
||||||
*/
|
|
||||||
#if !defined(LDAP_API_VERSION) || (LDAP_API_VERSION < 2000)
|
|
||||||
#error "Your LDAP version is too old"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -110,6 +103,13 @@
|
|||||||
#include <ldap.h>
|
#include <ldap.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Older APIs have weird memory freeing behavior.
|
||||||
|
*/
|
||||||
|
#if !defined(LDAP_API_VERSION) || (LDAP_API_VERSION < 2000)
|
||||||
|
#error "Your LDAP version is too old"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Handle differences between LDAP SDK's constant definitions */
|
/* Handle differences between LDAP SDK's constant definitions */
|
||||||
#ifndef LDAP_CONST
|
#ifndef LDAP_CONST
|
||||||
#define LDAP_CONST const
|
#define LDAP_CONST const
|
||||||
@@ -187,22 +187,14 @@ static int dict_ldap_get_errno(LDAP * ld)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
#if (LDAP_API_VERSION >= 2000)
|
|
||||||
if (ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &rc) != LDAP_OPT_SUCCESS)
|
if (ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &rc) != LDAP_OPT_SUCCESS)
|
||||||
rc = LDAP_OTHER;
|
rc = LDAP_OTHER;
|
||||||
#else
|
|
||||||
rc = dict_ldap->ld->ld_errno;
|
|
||||||
#endif
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dict_ldap_set_errno(LDAP * ld, int rc)
|
static int dict_ldap_set_errno(LDAP * ld, int rc)
|
||||||
{
|
{
|
||||||
#if (LDAP_API_VERSION >= 2000)
|
|
||||||
(void) ldap_set_option(ld, LDAP_OPT_ERROR_NUMBER, &rc);
|
(void) ldap_set_option(ld, LDAP_OPT_ERROR_NUMBER, &rc);
|
||||||
#else
|
|
||||||
ld->ld_errno = rc;
|
|
||||||
#endif
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,13 +312,9 @@ static int dict_ldap_connect(DICT_LDAP *dict_ldap)
|
|||||||
* Configure alias dereferencing for this connection. Thanks to Mike
|
* Configure alias dereferencing for this connection. Thanks to Mike
|
||||||
* Mattice for this, and to Hery Rakotoarisoa for the v3 update.
|
* Mattice for this, and to Hery Rakotoarisoa for the v3 update.
|
||||||
*/
|
*/
|
||||||
#if (LDAP_API_VERSION >= 2000)
|
|
||||||
if (ldap_set_option(dict_ldap->ld, LDAP_OPT_DEREF,
|
if (ldap_set_option(dict_ldap->ld, LDAP_OPT_DEREF,
|
||||||
&(dict_ldap->dereference)) != LDAP_OPT_SUCCESS)
|
&(dict_ldap->dereference)) != LDAP_OPT_SUCCESS)
|
||||||
msg_warn("%s: Unable to set dereference option.", myname);
|
msg_warn("%s: Unable to set dereference option.", myname);
|
||||||
#else
|
|
||||||
dict_ldap->ld->ld_deref = dict_ldap->dereference;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(LDAP_OPT_DEBUG_LEVEL) && defined(LBER_OPT_LOG_PRINT_FN)
|
#if defined(LDAP_OPT_DEBUG_LEVEL) && defined(LBER_OPT_LOG_PRINT_FN)
|
||||||
if (dict_ldap->debuglevel > 0 &&
|
if (dict_ldap->debuglevel > 0 &&
|
||||||
|
Reference in New Issue
Block a user