resolve conflicts

This commit is contained in:
perry 2003-03-08 19:43:56 +00:00
parent b5fe7b6a73
commit 83fbadc93f
20 changed files with 375 additions and 103 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: main.cf,v 1.5 2002/12/24 20:26:59 perry Exp $
# $NetBSD: main.cf,v 1.6 2003/03/08 19:43:57 perry Exp $
#
# Global Postfix configuration file. This file lists only a subset
# of all 250+ parameters. See the sample-xxx.cf files for a full list.
@ -174,21 +174,29 @@ mail_owner = postfix
#
# - You define $mydestination domain recipients in files other than
# /etc/passwd, /etc/aliases, or the $virtual_alias_maps files.
# For example, you define $mydestination domain recipients in
# For example, you define $mydestination domain recipients in
# the $virtual_mailbox_maps files.
#
# - You redefined the local delivery agent in master.cf.
# - You redefine the local delivery agent in master.cf.
#
# - You redefined the "local_transport" setting in main.cf.
# - You redefine the "local_transport" setting in main.cf.
#
# - You use the "luser_relay", "mailbox_transport", or "fallback_transport"
# feature of the Postfix local delivery agent (see sample-local.cf).
#
# Details are described in the LOCAL_RECIPIENT_README file.
#
# Beware: if the Postfix SMTP server runs chrooted, you probably have
# to copy the passwd (not shadow) database into the jail, and perhaps
# other files. This is system dependent.
# to access the passwd file via the proxymap service, in order to
# overcome chroot restrictions. The alternative, having a copy of
# the system passwd file in the chroot jail is just not practical.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left-hand side, specify a bare username, an @domain.tld
# wild-card, or specify a user@domain.tld address.
#
#local_recipient_maps = unix:passwd.byname $alias_maps
#local_recipient_maps = proxy:unix:passwd.byname $alias_maps
#local_recipient_maps =
# The unknown_local_recipient_reject_code specifies the SMTP server
@ -305,6 +313,10 @@ unknown_local_recipient_reject_code = 450
#
# If this parameter is defined, then the SMTP server will reject
# mail for unknown relay users. This feature is off by default.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left-hand side, specify an @domain.tld wild-card, or specify
# a user@domain.tld address.
#
#relay_recipient_maps = hash:/etc/postfix/relay_recipients

View File

@ -1,4 +1,4 @@
# $NetBSD: master.cf,v 1.2 2002/12/24 21:37:43 perry Exp $
# $NetBSD: master.cf,v 1.3 2003/03/08 19:43:57 perry Exp $
#
#
# Postfix master process configuration file. Each line describes how
@ -68,27 +68,28 @@
# DO NOT SHARE THE POSTFIX QUEUE BETWEEN MULTIPLE POSTFIX INSTANCES.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 nqmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
flush unix n - n 1000? 0 flush
smtp unix - - n - - smtp
relay unix - - n - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
smtp inet n - n - - smtpd
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 nqmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
#
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
@ -100,12 +101,12 @@ maildrop unix - n n - - pipe
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix - n n - - pipe
old-cyrus unix - n n - - pipe
flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
cyrus unix - n n - - pipe
cyrus unix - n n - - pipe
user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
uucp unix - n n - - pipe
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)

View File

@ -426,7 +426,6 @@ test -n "$create" && {
if [ -n "$create" -a "$type" = "d" -a -n "$create_flag" -a ! -d "$path" ]
then
mkdir $path || exit 1
$CHATTR $path >/dev/null 2>/dev/null
set_permission=1
# Update all owner/group/mode settings.
elif [ -n "$set_perms" ]
@ -535,6 +534,15 @@ EOF
$POSTCONF -e "$unknown_local = 450" || exit 1
fi
# Add missing proxymap service to master.cf.
grep '^proxymap.*proxymap' $config_directory/master.cf >/dev/null || {
echo Editing $config_directory/master.cf, adding missing entry for proxymap service
cat >>$config_directory/master.cf <<EOF || exit 1
proxymap unix - - n - - proxymap
EOF
}
}
# A reminder if this is the first time Postfix is being installed.

View File

@ -1,4 +1,4 @@
# $NetBSD: sample-local.cf,v 1.2 2002/12/24 21:37:44 perry Exp $
# $NetBSD: sample-local.cf,v 1.3 2003/03/08 19:43:57 perry Exp $
#
# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF
# HERE JUST SERVES AS AN EXAMPLE.
@ -13,6 +13,10 @@
# precedence, from highest to lowest priority: mailbox_transport,
# mailbox_command_maps, mailbox_command, home_mailbox.
#
# MISCELLANEOUS PARAMETERS
#
# The biff parameter specifies whether or not to contact the biff
# server. This server sends "new mail" notifications to users who
# have requested new mail notification with "biff y".

View File

@ -1,4 +1,4 @@
# $NetBSD: sample-misc.cf,v 1.2 2002/12/24 21:37:44 perry Exp $
# $NetBSD: sample-misc.cf,v 1.3 2003/03/08 19:43:58 perry Exp $
#
# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF
# HERE JUST SERVES AS AN EXAMPLE.
@ -145,8 +145,8 @@ inet_interfaces = all
# The ipc_idle parameter bounds the idle time for internal communication
# channels after which a client disconnects voluntarily. The purpose
# is to allow servers to terminate voluntarily after they become
# idle. Currently this is used by the address resolving and rewriting
# clients.
# idle. This is used, for example, by the address resolving and
# rewriting clients.
#
# Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks).
# The default time unit is s (seconds).
@ -227,7 +227,7 @@ max_use = 100
# a name matches a lookup key. Continue long lines by starting the
# next line with whitespace.
#
# See sample-local.cf for a description of the local_recipient_maps
# See sample-smtpd.cf for a description of the local_recipient_maps
# and unknown_local_recipient_reject_code parameters. By default,
# the SMTP server rejects mail for recipients not listed with the
# local_recipient_maps parameter.

View File

@ -1,4 +1,4 @@
# $NetBSD: sample-pcre-body.cf,v 1.2 2002/12/24 21:37:45 perry Exp $
# $NetBSD: sample-pcre-body.cf,v 1.3 2003/03/08 19:43:58 perry Exp $
#
#
# Sample pcre (PERL-compatible regular expression) map file for
@ -53,7 +53,8 @@
# 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.
# is in the Postfix FILTER_README file. This feature
# overrides the main.cf content_filter setting.
#
# Substitution of sub-strings from the matched expression is
# possible using the conventional perl syntax. The macros in the

View File

@ -1,12 +1,12 @@
# $NetBSD: sample-pcre-header.cf,v 1.2 2002/12/24 21:37:45 perry Exp $
# $NetBSD: sample-pcre-header.cf,v 1.3 2003/03/08 19:43:58 perry Exp $
#
#
# Sample pcre (PERL-compatible regular expression) map file for
# message header filtering. See pcre_table(5) for syntax description.
#
# Message headers are filtered one at a time. This filter understands
# multi-line message headers. However, the message header filter has
# no knowledge of MIME headers that are embedded in the message body.
# multi-line message headers, including MIME headers in the message
# body.
#
# The first field is a perl-like regular expression. The expression
# delimiter can be any character except whitespace, or characters
@ -54,7 +54,8 @@
# 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.
# is in the Postfix FILTER_README file. This feature
# overrides the main.cf content_filter setting.
#
# Substitution of sub-strings from the matched expression is
# possible using the conventional perl syntax. The macros in the

View File

@ -1,4 +1,4 @@
# $NetBSD: sample-regexp-body.cf,v 1.2 2002/12/24 21:37:45 perry Exp $
# $NetBSD: sample-regexp-body.cf,v 1.3 2003/03/08 19:43:58 perry Exp $
#
# Sample regexp message body filter lookup "table". See regexp_table(5)
# for a description of the syntax.
@ -45,7 +45,8 @@
# 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.
# off in the second cleanup server. This overrides the main.cf
# content filter setting.
# Skip over base 64 encoded blocks. This saves lots of CPU cycles.
# Expressions by Liviu Daia. Amended by Victor Duchovni.

View File

@ -1,11 +1,10 @@
# $NetBSD: sample-regexp-header.cf,v 1.2 2002/12/24 21:37:45 perry Exp $
# $NetBSD: sample-regexp-header.cf,v 1.3 2003/03/08 19:43:58 perry Exp $
#
# Sample regexp message header filter lookup "table". See regexp_table(5)
# for a description of the syntax.
#
# Message headers are filtered one at a time. This filter understands
# multi-line mail headers. However, the message header filter has no
# knowledge of MIME headers that are embedded in the message body.
# multi-line mail headers, including MIME headers in the message body.
#
# The general format of a table entry is PATTERN RESULT.
#
@ -46,7 +45,8 @@
# 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.
# off in the second cleanup server. This overrides the main.cf
# content filter setting.
/^Subject: Make Money Fast/ REJECT
/^To: friend@public.com/ REJECT

View File

@ -1,4 +1,4 @@
# $NetBSD: sample-smtpd.cf,v 1.2 2002/12/24 21:37:46 perry Exp $
# $NetBSD: sample-smtpd.cf,v 1.3 2003/03/08 19:43:58 perry Exp $
#
# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF
# HERE JUST SERVES AS AN EXAMPLE.
@ -6,6 +6,75 @@
# This file contains example settings of Postfix configuration parameters
# that control the SMTP server program.
# REJECTING MAIL FOR UNKNOWN LOCAL USERS
#
# The local_recipient_maps parameter specifies optional lookup tables
# with all names or addresses of users that are local with respect
# to $mydestination and $inet_interfaces.
#
# If this parameter is defined, then the SMTP server will reject
# mail for unknown local users. This parameter is defined by default.
#
# To turn off local recipient checking in the SMTP server, specify
# local_recipient_maps = (i.e. empty).
#
# The default setting assumes that you use the default Postfix local
# delivery agent for local delivery. You need to update the
# local_recipient_maps setting if:
#
# - You define $mydestination domain recipients in files other than
# /etc/passwd, /etc/aliases, or the $virtual_alias_maps files.
# For example, you define $mydestination domain recipients in
# the $virtual_mailbox_maps files.
#
# - You redefine the local delivery agent in master.cf.
#
# - You redefine the "local_transport" setting in main.cf.
#
# - You use the "luser_relay", "mailbox_transport", or "fallback_transport"
# feature of the Postfix local delivery agent (see sample-local.cf).
#
# Details are described in the LOCAL_RECIPIENT_README file.
#
# Beware: if the Postfix SMTP server runs chrooted, you probably have
# to access the passwd file via the proxymap service, in order to
# overcome chroot restrictions. The alternative, having a copy of
# the system passwd file in the chroot jail is just not practical.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left-hand side, specify a bare username, an @domain.tld
# wild-card, or specify a user@domain.tld address.
#
#local_recipient_maps =
#local_recipient_maps = unix:passwd.byname $alias_maps
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
# The unknown_local_recipient_reject_code specifies the SMTP server
# response code when a recipient domain matches $mydestination or
# $inet_interfaces, while $local_recipient_maps is non-empty and the
# recipient address or address local-part is not found.
#
# The default setting is 550 (reject mail) but it is safer to start
# with 450 (try again later) until you are certain that your
# local_recipient_maps settings are OK.
#
#unknown_local_recipient_reject_code = 450
unknown_local_recipient_reject_code = 550
# REJECTING UNKNOWN RELAY USERS
#
# The relay_recipient_maps parameter specifies optional lookup tables
# with all addresses in the domains that match $relay_domains.
#
# If this parameter is defined, then the SMTP server will reject
# mail for unknown relay users. This feature is off by default.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left-hand side, specify an @domain.tld wild-card, or specify
# a user@domain.tld address.
#
#relay_recipient_maps = hash:/etc/postfix/relay_recipients
#
# SENDER ANTI-SPOOFING
#
@ -209,6 +278,7 @@ mynetworks_style = subnet
# Discard the message if the result is DISCARD text...
# Hold the message in the queue if the result is HOLD text...
# Release mail "on hold" with the postsuper(1) command.
# Filter the message if the result is FILTER transport:nexthop.
# Permit the SMTP client if the result is OK or all numerical.
# reject_rbl_client domain.tld: reject if the reversed client IP address
# is listed in an A record under domain.tld.
@ -255,6 +325,7 @@ smtpd_helo_required = no
# Discard the message if the result is DISCARD text...
# Hold the message in the queue if the result is HOLD text...
# Release mail "on hold" with the postsuper(1) command.
# Filter the message if the result is FILTER transport:nexthop.
# Permit the HELO command if the result is OK or all numerical.
# reject: reject the request. Place this at the end of a restriction.
# permit: permit the request. Place this at the end of a restriction.
@ -292,6 +363,7 @@ smtpd_helo_restrictions =
# Discard the message if the result is DISCARD text...
# Hold the message in the queue if the result is HOLD text...
# Release mail "on hold" with the postsuper(1) command.
# Filter the message if the result is FILTER transport:nexthop.
# Permit the sender if the result is OK or all numerical.
# reject_sender_login_mismatch: reject if $smtpd_sender_login_maps specifies
# a MAIL FROM address owner, but the client is not (SASL) logged in as
@ -363,6 +435,7 @@ smtpd_sender_restrictions =
# Discard the message if the result is DISCARD text...
# Hold the message in the queue if the result is HOLD text...
# Release mail "on hold" with the postsuper(1) command.
# Filter the message if the result is FILTER transport:nexthop.
# Permit the recipient if the result is OK or all numerical.
# reject_non_fqdn_recipient: reject recipient address that is not in FQDN form
# reject: reject the request. Place this at the end of a restriction.

View File

@ -191,10 +191,6 @@ case "$SYSTEM.$RELEASE" in
echo "See the RELEASE_NOTES file for more information." 1>&2
exit 1
fi
if [ -f /usr/include/pcre/pcre.h ]
then
CCARGS="$CCARGS -DHAS_PCRE -I/usr/include/pcre"
fi
# GDBM locks the DBM .pag file after open. This breaks postmap.
# if [ -f /usr/include/gdbm-ndbm.h ]
# then
@ -206,11 +202,15 @@ case "$SYSTEM.$RELEASE" in
# GDBM_LIBS=gdbm
# fi
SYSLIBS="-ldb"
for name in nsl resolv pcre $GDBM_LIBS
for name in nsl resolv $GDBM_LIBS
do
test -e /usr/lib/lib$name.a -o -e /usr/lib/lib$name.so \
-o -e /lib/lib$name.a -o -e /lib/lib$name.so \
&& SYSLIBS="$SYSLIBS -l$name"
for lib in /usr/lib64 /lib64 /usr/lib /lib
do
test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
SYSLIBS="$SYSLIBS -l$name"
break
}
done
done
;;
IRIX*.5.*) SYSTYPE=IRIX5
@ -288,6 +288,20 @@ Rhapsody.5*|Darwin.*)
*) echo "Unknown system type: $SYSTEM $RELEASE" 1>&2; exit 1;;
esac
#
# PCRE 3.x has a pcre-config utility so we don't have to guess.
#
case "$CCARGS" in
*-DHAS_PCRE*) ;;
*-DNO_PCRE*) ;;
*) pcre_cflags=`(pcre-config --cflags) 2>/dev/null` &&
pcre_libs=`(pcre-config --libs) 2>/dev/null` && {
CCARGS="$CCARGS -DHAS_PCRE $pcre_cflags"
AUXLIBS="$AUXLIBS $pcre_libs"
}
;;
esac
# Defaults that can be overruled (make makefiles CC=cc OPT=-O6 DEBUG=)
# Disable optimizations by default when compiling for Purify. Disable
# optimizations by default with gcc 2.8, until the compiler is known to

View File

@ -20,7 +20,7 @@ SRCS = been_here.c bounce.c canon_addr.c cleanup_strerror.c clnt_stream.c \
tok822_resolve.c tok822_rewrite.c tok822_tree.c xtext.c bounce_log.c \
flush_clnt.c mail_conf_time.c mbox_conf.c mbox_open.c abounce.c \
verp_sender.c match_parent_style.c mime_state.c header_token.c \
strip_addr.c virtual8_maps.c hold_message.c
strip_addr.c virtual8_maps.c hold_message.c dict_proxy.c mail_dict.c
OBJS = been_here.o bounce.o canon_addr.o cleanup_strerror.o clnt_stream.o \
debug_peer.o debug_process.o defer.o deliver_completed.o \
deliver_flock.o deliver_pass.o deliver_request.o domain_list.o \
@ -42,7 +42,7 @@ OBJS = been_here.o bounce.o canon_addr.o cleanup_strerror.o clnt_stream.o \
tok822_resolve.o tok822_rewrite.o tok822_tree.o xtext.o bounce_log.o \
flush_clnt.o mail_conf_time.o mbox_conf.o mbox_open.o abounce.o \
verp_sender.o match_parent_style.o mime_state.o header_token.o \
strip_addr.o virtual8_maps.o hold_message.o
strip_addr.o virtual8_maps.o hold_message.o dict_proxy.o mail_dict.o
HDRS = been_here.h bounce.h canon_addr.h cleanup_user.h clnt_stream.h \
config.h debug_peer.h debug_process.h defer.h deliver_completed.h \
deliver_flock.h deliver_pass.h deliver_request.h domain_list.h \
@ -60,7 +60,8 @@ HDRS = been_here.h bounce.h canon_addr.h cleanup_user.h clnt_stream.h \
sys_exits.h timed_ipc.h tok822.h xtext.h bounce_log.h flush_clnt.h \
mbox_conf.h mbox_open.h abounce.h qmqp_proto.h verp_sender.h \
match_parent_style.h quote_flags.h mime_state.h header_token.h \
lex_822.h strip_addr.h virtual8_maps.h hold_message.h
lex_822.h strip_addr.h virtual8_maps.h hold_message.h dict_proxy.h \
mail_dict.h
TESTSRC = rec2stream.c stream2rec.c recdump.c
WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \
-Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
@ -237,7 +238,7 @@ tests: tok822_test mime_test mime_nest mime_8bit mime_dom mime_trunc \
virtual8_test
tok822_test: tok822_parse tok822_parse.in tok822_parse.ref
./tok822_parse <tok822_parse.in >tok822_parse.tmp
./tok822_parse <tok822_parse.in >tok822_parse.tmp 2>&1
diff tok822_parse.ref tok822_parse.tmp
rm -f tok822_parse.tmp
@ -489,6 +490,22 @@ deliver_request.o: ../../include/attr.h
deliver_request.o: mail_open_ok.h
deliver_request.o: recipient_list.h
deliver_request.o: deliver_request.h
dict_proxy.o: dict_proxy.c
dict_proxy.o: ../../include/sys_defs.h
dict_proxy.o: ../../include/msg.h
dict_proxy.o: ../../include/mymalloc.h
dict_proxy.o: ../../include/stringops.h
dict_proxy.o: ../../include/vstring.h
dict_proxy.o: ../../include/vbuf.h
dict_proxy.o: ../../include/vstream.h
dict_proxy.o: ../../include/attr.h
dict_proxy.o: ../../include/dict.h
dict_proxy.o: ../../include/argv.h
dict_proxy.o: mail_proto.h
dict_proxy.o: ../../include/iostuff.h
dict_proxy.o: mail_params.h
dict_proxy.o: clnt_stream.h
dict_proxy.o: dict_proxy.h
domain_list.o: domain_list.c
domain_list.o: ../../include/sys_defs.h
domain_list.o: ../../include/match_list.h
@ -712,6 +729,15 @@ mail_date.o: ../../include/msg.h
mail_date.o: ../../include/vstring.h
mail_date.o: ../../include/vbuf.h
mail_date.o: mail_date.h
mail_dict.o: mail_dict.c
mail_dict.o: ../../include/sys_defs.h
mail_dict.o: ../../include/dict.h
mail_dict.o: ../../include/vstream.h
mail_dict.o: ../../include/vbuf.h
mail_dict.o: ../../include/argv.h
mail_dict.o: ../../include/msg.h
mail_dict.o: dict_proxy.h
mail_dict.o: mail_dict.h
mail_error.o: mail_error.c
mail_error.o: ../../include/sys_defs.h
mail_error.o: mail_error.h
@ -996,6 +1022,7 @@ pipe_command.o: ../../include/stringops.h
pipe_command.o: ../../include/iostuff.h
pipe_command.o: ../../include/timed_wait.h
pipe_command.o: ../../include/set_ugid.h
pipe_command.o: ../../include/set_eugid.h
pipe_command.o: ../../include/argv.h
pipe_command.o: mail_params.h
pipe_command.o: mail_copy.h

View File

@ -1298,13 +1298,33 @@ extern char *var_smtpd_exp_filter;
* Heuristic to reject unknown local recipients at the SMTP port.
*/
#define VAR_LOCAL_RCPT_MAPS "local_recipient_maps"
#define DEF_LOCAL_RCPT_MAPS "unix:passwd.byname $alias_maps"
#define DEF_LOCAL_RCPT_MAPS "proxy:unix:passwd.byname $alias_maps"
extern char *var_local_rcpt_maps;
#define VAR_LOCAL_RCPT_CODE "unknown_local_recipient_reject_code"
#define DEF_LOCAL_RCPT_CODE 550
extern int var_local_rcpt_code;
/*
* List of pre-approved maps that are OK to open with the proxymap service.
*/
#define VAR_PROXY_READ_MAPS "proxy_read_maps"
#define DEF_PROXY_READ_MAPS "$" VAR_LOCAL_RCPT_MAPS \
" $" VAR_MYDEST \
" $" VAR_VIRT_ALIAS_MAPS \
" $" VAR_VIRT_ALIAS_DOMS \
" $" VAR_VIRT_MAILBOX_MAPS \
" $" VAR_VIRT_MAILBOX_DOMS \
" $" VAR_RELAY_RCPT_MAPS \
" $" VAR_RELAY_DOMAINS \
" $" VAR_CANONICAL_MAPS \
" $" VAR_SEND_CANON_MAPS \
" $" VAR_RCPT_CANON_MAPS \
" $" VAR_RELOCATED_MAPS \
" $" VAR_TRANSPORT_MAPS \
" $" VAR_MYNETWORKS
extern char *var_proxy_read_maps;
/*
* Other.
*/

View File

@ -77,6 +77,11 @@
/* Append a line break after each comma token, instead of appending
/* whitespace. It is up to the caller to concatenate short lines to
/* produce longer ones.
/* .IP TOK822_STR_TRNC
/* Truncate non-address information to 250 characters per address, to
/* protect Sendmail systems that are vulnerable to the problem in CERT
/* advisory CA-2003-07.
/* This flag has effect with tok822_externalize() only.
/* .PP
/* The macro TOK_822_NONE expresses that none of the above features
/* should be activated.
@ -85,9 +90,9 @@
/* TOK822_STR_TERM flags. This is useful for most token to string
/* conversions.
/*
/* The macro TOK822_STR_HEAD combines the TOK822_STR_TERM and
/* TOK822_STR_LINE flags. This is useful for the special case of
/* token to mail header conversion.
/* The macro TOK822_STR_HEAD combines the TOK822_STR_TERM,
/* TOK822_STR_LINE and TOK822_STR_TRNC flags. This is useful for
/* the special case of token to mail header conversion.
/*
/* tok822_internalize() converts a token list to string form,
/* without quoting. White space is inserted where appropriate.
@ -235,25 +240,97 @@ VSTRING *tok822_internalize(VSTRING *vp, TOK822 *tree, int flags)
return (vp);
}
/* strip_address - strip non-address text from address expression */
static void strip_address(VSTRING *vp, int start, TOK822 *addr)
{
VSTRING *tmp;
/*
* Emit plain <address>. Discard any comments or phrases.
*/
msg_warn("stripping too many comments from address: %.100s...",
vstring_str(vp) + start);
vstring_truncate(vp, start);
VSTRING_ADDCH(vp, '<');
if (addr) {
tmp = vstring_alloc(100);
tok822_internalize(tmp, addr, TOK822_STR_TERM);
quote_822_local_flags(vp, vstring_str(tmp),
QUOTE_FLAG_8BITCLEAN | QUOTE_FLAG_APPEND);
vstring_free(tmp);
}
VSTRING_ADDCH(vp, '>');
}
/* tok822_externalize - token tree to string, external form */
VSTRING *tok822_externalize(VSTRING *vp, TOK822 *tree, int flags)
{
VSTRING *tmp;
TOK822 *tp;
int start;
TOK822 *addr;
int addr_len;
/*
* Guard against a Sendmail buffer overflow (CERT advisory CA-2003-07).
* The problem was that Sendmail could store too much non-address text
* (comments, phrases, etc.) into a static 256-byte buffer.
*
* When the buffer fills up, fixed Sendmail versions remove comments etc.
* and reduce the information to just <$g>, which expands to <address>.
* No change is made when an address expression (text separated by
* commas) contains no address. This fix reportedly also protects
* Sendmail systems that are still vulnerable to this problem.
*
* Postfix takes the same approach, grudgingly. To avoid unnecessary damage,
* Postfix removes comments etc. only when the amount of non-address text
* in an address expression (text separated by commas) exceeds 250 bytes.
*
* With Sendmail, the address part of an address expression is the
* right-most <> instance in that expression. If an address expression
* contains no <>, then Postfix guarantees that it contains at most one
* non-comment string; that string is the address part of the address
* expression, so there is no ambiguity.
*
* Finally, we note that stress testing shows that other code in Sendmail
* 8.12.8 bluntly truncates ``text <address>'' to 256 bytes even when
* this means chopping the <address> somewhere in the middle. This is a
* loss of control that we're not entirely comfortable with. However,
* unbalanced quotes and dangling backslash do not seem to influence the
* way that Sendmail parses headers, so this is not an urgent problem.
*/
#define MAX_NONADDR_LENGTH 250
#define RESET_NONADDR_LENGTH { \
start = VSTRING_LEN(vp); \
addr = 0; \
addr_len = 0; \
}
#define ENFORCE_NONADDR_LENGTH do { \
if (addr && VSTRING_LEN(vp) - addr_len > start + MAX_NONADDR_LENGTH) \
strip_address(vp, start, addr->head); \
} while(0)
if (flags & TOK822_STR_WIPE)
VSTRING_RESET(vp);
if (flags & TOK822_STR_TRNC)
RESET_NONADDR_LENGTH;
for (tp = tree; tp; tp = tp->next) {
switch (tp->type) {
case ',':
if (flags & TOK822_STR_TRNC)
ENFORCE_NONADDR_LENGTH;
VSTRING_ADDCH(vp, tp->type);
if (flags & TOK822_STR_LINE) {
VSTRING_ADDCH(vp, '\n');
continue;
}
break;
VSTRING_ADDCH(vp, (flags & TOK822_STR_LINE) ? '\n' : ' ');
if (flags & TOK822_STR_TRNC)
RESET_NONADDR_LENGTH;
continue;
/*
* XXX In order to correctly externalize an address, it is not
@ -263,10 +340,13 @@ VSTRING *tok822_externalize(VSTRING *vp, TOK822 *tree, int flags)
* the issue of atoms in the domain part that would need quoting.
*/
case TOK822_ADDR:
addr = tp;
tmp = vstring_alloc(100);
tok822_internalize(tmp, tp->head, TOK822_STR_TERM);
addr_len = VSTRING_LEN(vp);
quote_822_local_flags(vp, vstring_str(tmp),
QUOTE_FLAG_8BITCLEAN | QUOTE_FLAG_APPEND);
addr_len = VSTRING_LEN(vp) - addr_len;
vstring_free(tmp);
break;
case TOK822_ATOM:
@ -286,6 +366,13 @@ VSTRING *tok822_externalize(VSTRING *vp, TOK822 *tree, int flags)
case TOK822_STARTGRP:
VSTRING_ADDCH(vp, ':');
break;
case '<':
if (tp->next && tp->next->type == '>') {
addr = tp;
addr_len = 0;
}
VSTRING_ADDCH(vp, '<');
break;
default:
if (tp->type >= TOK822_MINTOK)
msg_panic("tok822_externalize: unknown operator %d", tp->type);
@ -294,6 +381,9 @@ VSTRING *tok822_externalize(VSTRING *vp, TOK822 *tree, int flags)
if (tok822_append_space(tp))
VSTRING_ADDCH(vp, ' ');
}
if (flags & TOK822_STR_TRNC)
ENFORCE_NONADDR_LENGTH;
if (flags & TOK822_STR_TERM)
VSTRING_TERMINATE(vp);
return (vp);
@ -616,11 +706,14 @@ int main(int unused_argc, char **unused_argv)
vstream_printf("Internalized:\n%s\n\n",
vstring_str(tok822_internalize(vp, list, TOK822_STR_DEFL)));
vstream_fflush(VSTREAM_OUT);
vstream_printf("Externalized, no newlines inserted:\n%s\n\n",
vstring_str(tok822_externalize(vp, list, TOK822_STR_DEFL)));
vstring_str(tok822_externalize(vp, list,
TOK822_STR_DEFL | TOK822_STR_TRNC)));
vstream_fflush(VSTREAM_OUT);
vstream_printf("Externalized, newlines inserted:\n%s\n\n",
vstring_str(tok822_externalize(vp, list,
TOK822_STR_DEFL | TOK822_STR_LINE)));
TOK822_STR_DEFL | TOK822_STR_LINE | TOK822_STR_TRNC)));
vstream_fflush(VSTREAM_OUT);
tok822_free_tree(list);
}

View File

@ -282,12 +282,14 @@ MASTER_SERV *get_master_ent()
mymalloc(sizeof(*MASTER_INET_ADDRLIST(serv)));
inet_addr_list_init(MASTER_INET_ADDRLIST(serv));
inet_addr_host(MASTER_INET_ADDRLIST(serv), host);
inet_addr_list_uniq(MASTER_INET_ADDRLIST(serv));
serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
} else if (strcasecmp(var_inet_interfaces, DEF_INET_INTERFACES) == 0) {
MASTER_INET_ADDRLIST(serv) = 0; /* wild-card */
serv->listen_fd_count = 1;
} else {
MASTER_INET_ADDRLIST(serv) = own_inet_addr_list(); /* virtual */
inet_addr_list_uniq(MASTER_INET_ADDRLIST(serv));
serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
}
MASTER_INET_PORT(serv) = mystrdup(port);

View File

@ -517,22 +517,6 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
resolve_clnt_init(&reply);
for (recipient = list.info; recipient < list.info + list.len; recipient++) {
/*
* This may be a bit late in the game, but it is the most convenient
* place to scrutinize the destination address syntax. We have a
* complete queue file, so bouncing is easy. That luxury is not
* available to the cleanup service. The main issue is that we want
* to have this test in one place, instead of having to do this in
* every front-ent program.
*/
if ((at = strrchr(recipient->address, '@')) != 0
&& (at + 1)[strspn(at + 1, "[]0123456789.")] != 0
&& valid_hostname(at + 1, DONT_GRIPE) == 0) {
qmgr_bounce_recipient(message, recipient,
"bad host/domain syntax: \"%s\"", at + 1);
continue;
}
/*
* Resolve the destination to (transport, nexthop, address). The
* result address may differ from the one specified by the sender.
@ -616,9 +600,12 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
* on the recipient delimiter if one is defined, but doing a proper
* job requires knowledge of local aliases. Yuck! I don't want to
* duplicate delivery-agent specific knowledge in the queue manager.
*
* XXX The nexthop field is overloaded to serve as destination and as
* queue name. Should have separate fields for queue name and for
* destination.
* destination, so that we don't have to make a special case for the
* error delivery agent (where nexthop is arbitrary text). See also:
* qmgr_deliver.c.
*/
at = strrchr(STR(reply.recipient), '@');
len = (at ? (at - STR(reply.recipient)) : strlen(STR(reply.recipient)));
@ -633,7 +620,8 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
transport = qmgr_transport_create(STR(reply.transport));
queue = 0;
}
if (transport->recipient_limit == 1) {
if (strcmp(transport->name, MAIL_SERVICE_ERROR) != 0
&& transport->recipient_limit == 1) {
VSTRING_SPACE(reply.nexthop, len + 2);
memmove(STR(reply.nexthop) + len + 1, STR(reply.nexthop),
LEN(reply.nexthop) + 1);

View File

@ -371,8 +371,7 @@ SMTP_SESSION *smtp_connect(char *destination, VSTRING *why)
/*
* First try to deliver to the indicated destination, then try to deliver
* to the optional fall-back relays. Each can be a list of destinations
* by itself, with domain, host, [], numerical address, and port.
* to the optional fall-back relays.
*/
sites = argv_alloc(1);
argv_add(sites, destination, (char *) 0);

View File

@ -990,6 +990,7 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
int prev_rec_type;
int first = 1;
VSTRING *why = 0;
int saved_err;
/*
* Sanity checks. With ESMTP command pipelining the client can send DATA
@ -1150,12 +1151,13 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
/*
* Cleanup. The client may send another MAIL command.
*/
saved_err = state->err;
chat_reset(state, var_smtpd_hist_thrsh);
mail_reset(state);
rcpt_reset(state);
if (why)
vstring_free(why);
return (state->err);
return (saved_err);
}
/* rset_cmd - process RSET */
@ -1469,7 +1471,7 @@ static void smtpd_proto(SMTPD_STATE *state)
}
for (;;) {
if (state->error_count > var_smtpd_hard_erlim) {
if (state->error_count >= var_smtpd_hard_erlim) {
state->reason = "too many errors";
state->error_mask |= MAIL_ERROR_PROTOCOL;
smtpd_chat_reply(state, "421 Error: too many errors");
@ -1529,7 +1531,9 @@ static void smtpd_proto(SMTPD_STATE *state)
* things went wrong. Don't complain about clients that go away without
* sending QUIT.
*/
if (state->reason && state->where && strcmp(state->where, SMTPD_AFTER_DOT))
if (state->reason && state->where
&& (strcmp(state->where, SMTPD_AFTER_DOT)
|| strcmp(state->reason, "lost connection")))
msg_info("%s after %s from %s[%s]",
state->reason, state->where, state->name, state->addr);
@ -1611,7 +1615,8 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
*/
smtpd_noop_cmds = string_list_init(MATCH_FLAG_NONE, var_smtpd_noop_cmds);
verp_clients = namadr_list_init(MATCH_FLAG_NONE, var_verp_clients);
smtpd_check_init();
if (getuid() == 0 || getuid() == var_owner_uid)
smtpd_check_init();
debug_peer_init();
if (var_smtpd_sasl_enable)

View File

@ -315,6 +315,7 @@
#include <record.h>
#include <rec_type.h>
#include <mail_proto.h>
#include <mail_addr.h>
/* Application-specific. */
@ -355,7 +356,6 @@ static MAPS *virt_mailbox_maps;
static MAPS *relay_rcpt_maps;
#ifdef TEST
static MAPS *relocated_maps;
static STRING_LIST *virt_alias_doms;
static STRING_LIST *virt_mailbox_doms;
@ -654,9 +654,6 @@ void smtpd_check_init(void)
DICT_FLAG_LOCK);
#ifdef TEST
relocated_maps = maps_create(VAR_RELOCATED_MAPS, var_relocated_maps,
DICT_FLAG_LOCK);
virt_alias_doms = string_list_init(MATCH_FLAG_NONE, var_virt_alias_doms);
virt_mailbox_doms = string_list_init(MATCH_FLAG_NONE, var_virt_mailbox_doms);
#endif
@ -1677,7 +1674,11 @@ static int check_table_result(SMTPD_STATE *state, const char *table,
*/
if (STREQUAL(value, "FILTER", cmd_len)) {
if (*cmd_text == 0) {
msg_warn("access map %s entry %s has FILTER entry without value",
msg_warn("access map %s entry \"%s\" has FILTER entry without value",
table, datum);
return (SMTPD_CHECK_DUNNO);
} else if (strchr(cmd_text, ':') == 0) {
msg_warn("access map %s entry \"%s\" requires transport:destination",
table, datum);
return (SMTPD_CHECK_DUNNO);
} else {
@ -3193,8 +3194,19 @@ static int check_rcpt_maps(SMTPD_STATE *state, const char *recipient)
* local delivery, because the virtual delivery agent requires
* user@domain style addresses in its user database.
*/
#define MATCH_LEFT(l, r, n) (strncasecmp((l), (r), (n)) == 0 && (r)[n] == '@')
if ((reply->flags & RESOLVE_CLASS_LOCAL)
&& *var_local_rcpt_maps
/* Generated by bounce, absorbed by qmgr. */
&& !MATCH_LEFT(var_double_bounce_sender, CONST_STR(reply->recipient),
strlen(var_double_bounce_sender))
/* Absorbed by qmgr. */
&& !MATCH_LEFT(MAIL_ADDR_POSTMASTER, CONST_STR(reply->recipient),
strlen(MAIL_ADDR_POSTMASTER))
/* Generated by bounce. */
&& !MATCH_LEFT(MAIL_ADDR_MAIL_DAEMON, CONST_STR(reply->recipient),
strlen(MAIL_ADDR_MAIL_DAEMON))
&& NOMATCH(local_rcpt_maps, CONST_STR(reply->recipient)))
return (smtpd_check_reject(state, MAIL_ERROR_BOUNCE,
"%d <%s>: User unknown%s",
@ -3206,6 +3218,7 @@ static int check_rcpt_maps(SMTPD_STATE *state, const char *recipient)
* Reject mail to unknown addresses in virtual mailbox domains.
*/
if ((reply->flags & RESOLVE_CLASS_VIRTUAL)
&& *var_virt_mailbox_maps
&& NOMATCHV8(virt_mailbox_maps, CONST_STR(reply->recipient)))
return (smtpd_check_reject(state, MAIL_ERROR_BOUNCE,
"%d <%s>: User unknown%s",
@ -3371,7 +3384,6 @@ char *var_virt_alias_maps;
char *var_virt_alias_doms;
char *var_virt_mailbox_maps;
char *var_virt_mailbox_doms;
char *var_relocated_maps;
char *var_local_rcpt_maps;
char *var_perm_mx_networks;
char *var_par_dom_match;
@ -3409,7 +3421,6 @@ static STRING_TABLE string_table[] = {
VAR_VIRT_ALIAS_DOMS, DEF_VIRT_ALIAS_DOMS, &var_virt_alias_doms,
VAR_VIRT_MAILBOX_MAPS, DEF_VIRT_MAILBOX_MAPS, &var_virt_mailbox_maps,
VAR_VIRT_MAILBOX_DOMS, DEF_VIRT_MAILBOX_DOMS, &var_virt_mailbox_doms,
VAR_RELOCATED_MAPS, DEF_RELOCATED_MAPS, &var_relocated_maps,
VAR_LOCAL_RCPT_MAPS, DEF_LOCAL_RCPT_MAPS, &var_local_rcpt_maps,
VAR_PERM_MX_NETWORKS, DEF_PERM_MX_NETWORKS, &var_perm_mx_networks,
VAR_PAR_DOM_MATCH, DEF_PAR_DOM_MATCH, &var_par_dom_match,

View File

@ -624,6 +624,18 @@ dict_open.o: split_at.h
dict_open.o: htable.h
dict_pcre.o: dict_pcre.c
dict_pcre.o: sys_defs.h
dict_pcre.o: mymalloc.h
dict_pcre.o: msg.h
dict_pcre.o: safe.h
dict_pcre.o: vstream.h
dict_pcre.o: vbuf.h
dict_pcre.o: vstring.h
dict_pcre.o: stringops.h
dict_pcre.o: readlline.h
dict_pcre.o: dict.h
dict_pcre.o: argv.h
dict_pcre.o: dict_pcre.h
dict_pcre.o: mac_parse.h
dict_regexp.o: dict_regexp.c
dict_regexp.o: sys_defs.h
dict_regexp.o: mymalloc.h