2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 21:55:20 +00:00

postfix-2.0.3-20030124

This commit is contained in:
Wietse Venema
2003-01-24 00:00:00 -05:00
committed by Viktor Dukhovni
parent c9c652d733
commit 0bf8270bb1
19 changed files with 211 additions and 139 deletions

View File

@@ -7745,7 +7745,7 @@ Apologies for any names omitted.
Bugfix: transport_errno was not reset upon successful Bugfix: transport_errno was not reset upon successful
transport map wildcard lookup after an earlier failure. transport map wildcard lookup after an earlier failure.
Reported by Victor Duchovny. File: trivial-rewrite/transport.c. Reported by Victor Duchovni. File: trivial-rewrite/transport.c.
Cleanup: unnecessary warnings from the proxymap client Cleanup: unnecessary warnings from the proxymap client
after proxymap server disconnect. File: global/dict_proxy.c. after proxymap server disconnect. File: global/dict_proxy.c.
@@ -7757,6 +7757,45 @@ Apologies for any names omitted.
Cleanup: the pcre-config command can produce null outputs. Cleanup: the pcre-config command can produce null outputs.
Matthias Andree. File: makedefs. Matthias Andree. File: makedefs.
Bugfix: the virtual(8) Makefile included $(AUXLIBS) in the
dependencies.
20030118
Typos: some hyperlinks referred to flushd, which is the
name that was used before the flush service was released.
Reported by Victor Duchovni.
Cleanup: smtpd no longer needed to open relocated_maps.
20030119
Cleanup: bounce messages used "X-Postfix" even when mail_name
was set to something other than the default "Postfix" name.
File: bounce/bounce-notify_util.c.
20030120
Bugfix: wrong FILTER_README instructions for disabling
virtual alias mapping in the cleanup server before the
content filter.
Bugfix: wrong FILTER_README instructions for destination-dependent
filtering, because relay_domains was specified incorrectly.
20030122
Bugfix: 20021207 (move relocated table lookup from queue
manager to trivial-rewrite server) broke relocated table
lookup results with mail not rejected at the SMTP port.
Files: *qmgr/qmgr_deliver.c, *qmgr/qmgr_message.c.
20030123
Bugfix: a widely used maildir filename algorithm was broken.
Postfix now uses TIME.DEVICE_INODE.HOST. Files: local/maildir.c,
virtual/maildir.c.
Open problems: Open problems:
Med: make qmgr recipient bounce/defer activity asynchronous Med: make qmgr recipient bounce/defer activity asynchronous

View File

@@ -298,6 +298,9 @@ As the example below shows, things quickly become very complex,
because a lot of main.cf like information gets listed in the because a lot of main.cf like information gets listed in the
master.cf file. This makes the system hard to understand. master.cf file. This makes the system hard to understand.
Even worse, details change as Postfix evolves and different
configuration parameters are implemented by different programs.
If you need to squeeze out more performance, it is probably simpler If you need to squeeze out more performance, it is probably simpler
to run multiple Postfix instances, one before and one after the to run multiple Postfix instances, one before and one after the
content filter. That way, each instance can have simple main.cf content filter. That way, each instance can have simple main.cf
@@ -308,24 +311,24 @@ As before, we will set up a content filtering program that receives
SMTP mail via localhost port 10025, and that submits SMTP mail back SMTP mail via localhost port 10025, and that submits SMTP mail back
into Postfix via localhost port 10026. into Postfix via localhost port 10026.
................................... .......................................
: Postfix : : Postfix :
----->smtpd \ : ----->smtpd \ :
: -cleanup-\ /local----> : -pre-cleanup-\ /local---->
---->pickup / -queue- : ---->pickup / -queue- :
: cleanup2/ | \smtp-----> : -cleanup-/ | \smtp----->
: ^ v : : bounces/ ^ v :
: | v : : and locally | v :
: smtpd scan : : forwarded smtpd scan :
: 10026 | : : messages 10026 | :
.......................|........... ...........................|...........
^ | ^ |
| v | v
....|............. ....|.............
: | 10025 : : | 10025 :
: filter : : filter :
: : : :
.................. ..................
To enable content filtering in this manner, specify in main.cf a To enable content filtering in this manner, specify in main.cf a
new parameter: new parameter:
@@ -335,32 +338,34 @@ new parameter:
/etc/postfix/master.cf: /etc/postfix/master.cf:
# #
# This is the usual input "smtpd" already present in master.cf # These are the usual input "smtpd" and local "pickup" servers already
# present in master.cf. We add an option to select a non-default
# cleanup service (defined further below).
# #
smtp inet n - n - - smtpd smtp inet n - n - - smtpd
-o cleanup_service=pre-cleanup
pickup fifo n - n 60 1 pickup
-o cleanup_service=pre-cleanup
# #
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# #
# This is the cleanup daemon that handles messages in front of # This is the cleanup daemon that handles messages in front of
# the content filter. It does header_checks and body_checks (if # the content filter. It does header_checks and body_checks (if
# any), but does no virtual alias or canonical address mapping. # any), but does no virtual alias or canonical address mapping,
# so that mail passes through your content filter with the original
# recipient addresses mostly intact.
# #
# Virtual alias or canonical address mapping happens in the second # Virtual alias or canonical address mapping happens in the second
# cleanup phase after the content filter. This gives the content_filter # cleanup phase after the content filter. This gives the content_filter
# access to *largely* unmodified addresses for maximum flexibility. # access to *largely* unmodified addresses for maximum flexibility.
# #
# Turning off append_myorigin/append_dot_mydomain address rewriting # Some sites may specifically want to perform canonical or virtual
# before the content filter would require two instances of the # address mapping in front of the content_filter. In that case you
# trivial-rewrite daemon. If you want to go to this trouble then # still have to enable address rewriting in the after-filter cleanup
# you're clearly better off with two complete Postfix instances: one # instance, in order to correctly process forwarded mail or bounced
# in front of and one behind the content filter. # mail.
# #
# Note that some sites may specifically want to do the opposite: pre-cleanup unix n - n - 0 cleanup
# perform rewrites in front of the content_filter which would
# then see only cleaned up addresses. In that case the "-o" parameter
# settings below should be moved to the second "cleanup" instance.
#
cleanup unix n - n - 0 cleanup
-o canonical_maps= -o canonical_maps=
-o sender_canonical_maps= -o sender_canonical_maps=
-o recipient_canonical_maps= -o recipient_canonical_maps=
@@ -386,9 +391,8 @@ scan unix - - n - 10 smtp
# parameter to avoid loops, and use a different hostname to avoid # parameter to avoid loops, and use a different hostname to avoid
# triggering the Postfix SMTP loop detection code. # triggering the Postfix SMTP loop detection code.
# #
# This "smtpd" uses a separate cleanup that does no header or # This "smtpd" uses the normal cleanup service which is also used
# body checks, but does do the various address rewrites disabled # for bounces and for internally forwarded mail.
# in the first cleanup.
# #
# The parameters from mynetworks onward disable all access # The parameters from mynetworks onward disable all access
# control other than insisting on connections from one of the IP # control other than insisting on connections from one of the IP
@@ -401,7 +405,6 @@ localhost:10026 inet n - n - - smtpd
-o myhostname=localhost.domain.tld -o myhostname=localhost.domain.tld
-o local_recipient_maps= -o local_recipient_maps=
-o relay_recipient_maps= -o relay_recipient_maps=
-o cleanup_service_name=cleanup2
-o mynetworks=127.0.0.0/8 -o mynetworks=127.0.0.0/8
-o mynetworks_style=host -o mynetworks_style=host
-o smtpd_restriction_classes= -o smtpd_restriction_classes=
@@ -416,18 +419,17 @@ localhost:10026 inet n - n - - smtpd
# #
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# #
# This is the second cleanup daemon. No header or body checks, # This is the normal cleanup daemon for use after content filtering.
# because those have already been taken care of by the cleanup instance # No header or body checks, because those have already been taken
# before the content filter. The second cleanup instance does all the # care of by the pre-cleanup service before the content filter.
# virtual alias and canonical address mapping that was disabled in #
# the first cleanup instance. # The normal cleanup instance does all the virtual alias and canonical
# address mapping that was disabled in the pre-cleanup instance before
# the content filter. This rewriting must be done even when you didn't
# disable address rewriting in the pre-cleanup instance, in order to
# correctly process bounces and locally forwarded mail.
# #
# If it is preferable to do the virtual alias and canonical address cleanup unix n - n - 0 cleanup
# mapping before the content filter, delete the "-o" lines that
# disable canonical and virtual mappings in the above cleanup daemon
# instance and insert them here.
#
cleanup2 unix n - n - 0 cleanup
-o header_checks= -o header_checks=
-o mime_header_checks= -o mime_header_checks=
-o nested_header_checks= -o nested_header_checks=
@@ -478,32 +480,6 @@ SMTP server addresses in master.cf:
1.2.3.5:smtp inet n - n - - smtpd 1.2.3.5:smtp inet n - n - - smtpd
-o content_filter=foo:bar -o content_filter=foo:bar
Different content filters for different MX domains
==================================================
This is a variant on the previous example. You configure ONE
Postfix instance with multiple SMTP server addresses. Each
SMTP server invokes a different content filter.
/etc/postfix.master.cf:
# MX server for destinations that use the foo:bar content filter.
1.2.3.5:smtp inet n - n - - smtpd
-o content_filter=foo:bar
-o relay_domains=/etc/postfix/foo-bar-domains
-o smtpd_recipient_restrictions=reject_unauth_destination
# MX server for destinations that use the bar:baz content filter.
1.2.3.6:smtp inet n - n - - smtpd
-o content_filter=bar:baz
-o relay_domains=/etc/postfix/bar-baz-domains
-o smtpd_recipient_restrictions=reject_unauth_destination
# SMTP servers for internal users only.
1.2.3.4:smtp inet n - n - - smtpd
-o smtpd_recipient_restrictions=permit_mynetworks,reject
127.0.0.1:smtp inet n - n - - smtpd
-o smtpd_recipient_restrictions=permit_mynetworks,reject
Getting really nasty Getting really nasty
==================== ====================

View File

@@ -41,7 +41,7 @@ delivery agent for local delivery, where recipients are either UNIX
accounts or local aliases: accounts or local aliases:
/etc/postfix/main.cf: /etc/postfix/main.cf:
local_recipient_maps = unix:passwd.byname $alias_maps local_recipient_maps = proxymap:unix:passwd.byname $alias_maps
You need to update the local_recipient_maps setting if one of the You need to update the local_recipient_maps setting if one of the
following is true: following is true:

View File

@@ -182,6 +182,8 @@ mail_owner = postfix
# - You use the "luser_relay", "mailbox_transport", or "fallback_transport" # - You use the "luser_relay", "mailbox_transport", or "fallback_transport"
# feature of the Postfix local delivery agent (see sample-local.cf). # 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 # Beware: if the Postfix SMTP server runs chrooted, you probably have
# to access the passwd file via the proxymap service, in order to # to access the passwd file via the proxymap service, in order to
# overcome chroot restrictions. The alternative, having a copy of # overcome chroot restrictions. The alternative, having a copy of

View File

@@ -66,30 +66,30 @@
# DO NOT SHARE THE POSTFIX QUEUE BETWEEN MULTIPLE POSTFIX INSTANCES. # DO NOT SHARE THE POSTFIX QUEUE BETWEEN MULTIPLE POSTFIX INSTANCES.
# #
# ========================================================================== # ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args # service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100) # (yes) (yes) (yes) (never) (100)
# ========================================================================== # ==========================================================================
smtp inet n - n - - smtpd smtp inet n - n - - smtpd
#628 inet n - n - - qmqpd #628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 nqmgr #qmgr fifo n - n 300 1 nqmgr
rewrite unix - - n - - trivial-rewrite rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce defer unix - - n - 0 bounce
trace unix - - n - 0 bounce trace unix - - n - 0 bounce
verify unix - - n - 1 verify verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap proxymap unix - - n - - proxymap
smtp unix - - n - - smtp smtp unix - - n - - smtp
relay unix - - n - - smtp relay unix - - n - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq showq unix n - n - - showq
error unix - - n - - error error unix - - n - - error
local unix - n n - - local local unix - n n - - local
virtual unix - n n - - virtual virtual unix - n n - - virtual
lmtp unix - - n - - lmtp lmtp unix - - n - - lmtp
# #
# Interfaces to non-Postfix software. Be sure to examine the manual # Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants. # pages of the non-Postfix software to find out what options it wants.
@@ -101,12 +101,12 @@ maildrop unix - n n - - pipe
# #
# The Cyrus deliver program has changed incompatibly, multiple times. # 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} flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux) # 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} 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) flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail unix - n n - - pipe ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)

View File

@@ -54,11 +54,11 @@ POSTQUEUE(1) POSTQUEUE(1)
<b>-s</b> <i>site</i> <b>-s</b> <i>site</i>
Schedule immediate delivery of all mail that is Schedule immediate delivery of all mail that is
queued for the named <i>site</i>. The site must be eligi- queued for the named <i>site</i>. The site must be eligi-
ble for the "fast flush" service. See <a href="flushd.8.html"><b>flush</b>(8)</a> for ble for the "fast flush" service. See <a href="flush.8.html"><b>flush</b>(8)</a> for
more information about the "fast flush" service. more information about the "fast flush" service.
This option implements the traditional <b>sendmail</b> This option implements the traditional <b>sendmail</b>
<b>-qR</b><i>site</i> command, by contacting the Postfix <a href="flushd.8.html"><b>flush</b>(8)</a> <b>-qR</b><i>site</i> command, by contacting the Postfix <a href="flush.8.html"><b>flush</b>(8)</a>
daemon. daemon.
<b>-v</b> Enable verbose logging for debugging purposes. Mul- <b>-v</b> Enable verbose logging for debugging purposes. Mul-
@@ -115,7 +115,7 @@ POSTQUEUE(1) POSTQUEUE(1)
<a href="postsuper.1.html">postsuper(1)</a> privileged queue operations <a href="postsuper.1.html">postsuper(1)</a> privileged queue operations
<a href="qmgr.8.html">qmgr(8)</a> queue manager <a href="qmgr.8.html">qmgr(8)</a> queue manager
<a href="showq.8.html">showq(8)</a> list mail queue <a href="showq.8.html">showq(8)</a> list mail queue
<a href="flushd.8.html">flush(8)</a> fast flush service <a href="flush.8.html">flush(8)</a> fast flush service
<b>LICENSE</b> <b>LICENSE</b>
The Secure Mailer license must be distributed with this The Secure Mailer license must be distributed with this

View File

@@ -202,7 +202,7 @@ SENDMAIL(1) SENDMAIL(1)
queued for the named <i>site</i>. This option accepts only queued for the named <i>site</i>. This option accepts only
<i>site</i> names that are eligible for the "fast flush" <i>site</i> names that are eligible for the "fast flush"
service, and is implemented by executing the service, and is implemented by executing the
<a href="postqueue.1.html"><b>postqueue</b>(1)</a> command. See <a href="flushd.8.html"><b>flush</b>(8)</a> for more infor- <a href="postqueue.1.html"><b>postqueue</b>(1)</a> command. See <a href="flush.8.html"><b>flush</b>(8)</a> for more infor-
mation about the "fast flush" service. mation about the "fast flush" service.
<b>-qS</b><i>site</i> <b>-qS</b><i>site</i>
@@ -332,7 +332,7 @@ SENDMAIL(1) SENDMAIL(1)
<a href="postqueue.1.html">postqueue(1)</a> mail queue control <a href="postqueue.1.html">postqueue(1)</a> mail queue control
<a href="qmgr.8.html">qmgr(8)</a> queue manager <a href="qmgr.8.html">qmgr(8)</a> queue manager
<a href="smtpd.8.html">smtpd(8)</a> SMTP server <a href="smtpd.8.html">smtpd(8)</a> SMTP server
<a href="flushd.8.html">flush(8)</a> fast flush service <a href="flush.8.html">flush(8)</a> fast flush service
syslogd(8) system logging syslogd(8) system logging
<b>LICENSE</b> <b>LICENSE</b>

View File

@@ -204,9 +204,13 @@ case "$SYSTEM.$RELEASE" in
SYSLIBS="-ldb" SYSLIBS="-ldb"
for name in nsl resolv $GDBM_LIBS for name in nsl resolv $GDBM_LIBS
do do
test -e /usr/lib/lib$name.a -o -e /usr/lib/lib$name.so \ for lib in /usr/lib64 /lib64 /usr/lib /lib
-o -e /lib/lib$name.a -o -e /lib/lib$name.so \ do
&& SYSLIBS="$SYSLIBS -l$name" test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
SYSLIBS="$SYSLIBS -l$name"
break
}
done
done done
;; ;;
IRIX*.5.*) SYSTYPE=IRIX5 IRIX*.5.*) SYSTYPE=IRIX5

View File

@@ -13,7 +13,7 @@ exec sed '
s/[<bB>]*cleanup[</bB>]*(8)/<a href="cleanup.8.html">&<\/a>/ s/[<bB>]*cleanup[</bB>]*(8)/<a href="cleanup.8.html">&<\/a>/
s/[<bB>]*defer[</bB>]*(8)/<a href="defer.8.html">&<\/a>/ s/[<bB>]*defer[</bB>]*(8)/<a href="defer.8.html">&<\/a>/
s/[<bB>]*error[</bB>]*(8)/<a href="error.8.html">&<\/a>/ s/[<bB>]*error[</bB>]*(8)/<a href="error.8.html">&<\/a>/
s/[<bB>]*flush[</bB>]*(8)/<a href="flushd.8.html">&<\/a>/ s/[<bB>]*flush[</bB>]*(8)/<a href="flush.8.html">&<\/a>/
s/[<bB>]*local[</bB>]*(8)/<a href="local.8.html">&<\/a>/ s/[<bB>]*local[</bB>]*(8)/<a href="local.8.html">&<\/a>/
s/[<bB>]*mas[-</bB>]*\n*[ <bB>]*ter[</bB>]*(8)/<a href="master.8.html">&<\/a>/ s/[<bB>]*mas[-</bB>]*\n*[ <bB>]*ter[</bB>]*(8)/<a href="master.8.html">&<\/a>/
s/[<bB>]*pickup[</bB>]*(8)/<a href="pickup.8.html">&<\/a>/ s/[<bB>]*pickup[</bB>]*(8)/<a href="pickup.8.html">&<\/a>/

View File

@@ -22,7 +22,7 @@
/* /*
/* BOUNCE_INFO *bounce_mail_one_init(queue_name, queue_id, /* BOUNCE_INFO *bounce_mail_one_init(queue_name, queue_id,
/* encoding, orig_recipient, /* encoding, orig_recipient,
/* recipient, dsn_status, /* recipient, dsn_status,
/* dsn_action, why) /* dsn_action, why)
/* const char *queue_name; /* const char *queue_name;
/* const char *queue_id; /* const char *queue_id;
@@ -552,6 +552,8 @@ int bounce_header_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info)
int bounce_recipient_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info) int bounce_recipient_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info)
{ {
char *fixed_mail_name;
post_mail_fputs(bounce, ""); post_mail_fputs(bounce, "");
post_mail_fprintf(bounce, "Final-Recipient: rfc822; %s", post_mail_fprintf(bounce, "Final-Recipient: rfc822; %s",
bounce_info->log_handle->recipient); bounce_info->log_handle->recipient);
@@ -563,8 +565,12 @@ int bounce_recipient_dsn(VSTREAM *bounce, BOUNCE_INFO *bounce_info)
"failed" : bounce_info->log_handle->dsn_action); "failed" : bounce_info->log_handle->dsn_action);
post_mail_fprintf(bounce, "Status: %s", post_mail_fprintf(bounce, "Status: %s",
bounce_info->log_handle->dsn_status); bounce_info->log_handle->dsn_status);
bounce_print_wrap(bounce, bounce_info, "Diagnostic-Code: X-Postfix; %s", /* RFC 1894: diagnostic-type is an RFC 822 atom. */
bounce_info->log_handle->text); fixed_mail_name = mystrdup(var_mail_name);
translit(fixed_mail_name, " \t\r\n()<>@,;:\\\".[]", "-----------------");
bounce_print_wrap(bounce, bounce_info, "Diagnostic-Code: X-%s; %s",
fixed_mail_name, bounce_info->log_handle->text);
myfree(fixed_mail_name);
#if 0 #if 0
post_mail_fprintf(bounce, "Last-Attempt-Date: %s", post_mail_fprintf(bounce, "Last-Attempt-Date: %s",
bounce_info->log_handle->log_time); bounce_info->log_handle->log_time);

View File

@@ -20,10 +20,10 @@
* 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 "20030115" #define MAIL_RELEASE_DATE "20030124"
#define VAR_MAIL_VERSION "mail_version" #define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "2.0.2-" MAIL_RELEASE_DATE #define DEF_MAIL_VERSION "2.0.3-" MAIL_RELEASE_DATE
extern char *var_mail_version; extern char *var_mail_version;
/* /*

View File

@@ -40,7 +40,9 @@
/* System library. */ /* System library. */
#include "sys_defs.h" #include "sys_defs.h"
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#include <errno.h> #include <errno.h>
/* Utility library. */ /* Utility library. */
@@ -83,7 +85,8 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr, char *path)
int mail_copy_status; int mail_copy_status;
int deliver_status; int deliver_status;
int copy_flags; int copy_flags;
static int count; struct stat st;
time_t starttime = time((time_t *) 0);
/* /*
* Make verbose logging easier to understand. * Make verbose logging easier to understand.
@@ -131,20 +134,33 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr, char *path)
* use starttime.pid_count.host, where starttime is the time that your * use starttime.pid_count.host, where starttime is the time that your
* process started, and count is the number of messages you've * process started, and count is the number of messages you've
* delivered." * delivered."
*
* Well, that stopped working on fast machines, and on operating systems
* that randomize process ID values. When creating a file in tmp/ we use
* the process ID because it still is an exclusive resource. When moving
* the file to new/ we use the device number and inode number. I do not
* care if this breaks on a remote AFS file system, because people should
* know better.
*/ */
#define STR vstring_str #define STR vstring_str
set_eugid(usr_attr.uid, usr_attr.gid); set_eugid(usr_attr.uid, usr_attr.gid);
vstring_sprintf(buf, "%ld.%d_%d.%s", (long) var_starttime, vstring_sprintf(buf, "%lu.%d.%s",
var_pid, count++, get_hostname()); (unsigned long) starttime, var_pid, get_hostname());
tmpfile = concatenate(tmpdir, STR(buf), (char *) 0); tmpfile = concatenate(tmpdir, STR(buf), (char *) 0);
newfile = concatenate(newdir, STR(buf), (char *) 0); newfile = 0;
if ((dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0 if ((dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0
&& (errno != ENOENT && (errno != ENOENT
|| make_dirs(tmpdir, 0700) < 0 || make_dirs(tmpdir, 0700) < 0
|| (dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0)) { || (dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0)) {
vstring_sprintf(why, "create %s: %m", tmpfile); vstring_sprintf(why, "create %s: %m", tmpfile);
} else if (fstat(vstream_fileno(dst), &st) < 0) {
vstring_sprintf(why, "create %s: %m", tmpfile);
} else { } else {
vstring_sprintf(buf, "%lu.%lu_%lu.%s",
(unsigned long) starttime, (unsigned long) st.st_dev,
(unsigned long) st.st_ino, get_hostname());
newfile = concatenate(newdir, STR(buf), (char *) 0);
if ((mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr), if ((mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr),
dst, copy_flags, "\n", why)) == 0) { dst, copy_flags, "\n", why)) == 0) {
if (sane_link(tmpfile, newfile) < 0 if (sane_link(tmpfile, newfile) < 0
@@ -181,6 +197,7 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr, char *path)
myfree(tmpdir); myfree(tmpdir);
myfree(curdir); myfree(curdir);
myfree(tmpfile); myfree(tmpfile);
myfree(newfile); if (newfile)
myfree(newfile);
return (deliver_status); return (deliver_status);
} }

View File

@@ -154,10 +154,15 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream)
* queue name is user@nexthop, so that we can implement per-recipient * queue name is user@nexthop, so that we can implement per-recipient
* concurrency limits. However, the delivery agent protocol expects * concurrency limits. However, the delivery agent protocol expects
* nexthop only, so we must strip off the recipient local part. * nexthop only, so we must strip off the recipient local part.
*
* XXX Should have separate fields for queue name and for 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_message.c.
*/ */
flags = message->tflags flags = message->tflags
| (message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT); | (message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT);
nexthop = (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ? nexthop = strcmp(entry->queue->transport->name, MAIL_SERVICE_ERROR) != 0
&& (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_FLAGS, flags,

View File

@@ -726,9 +726,12 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
* on the recipient delimiter if one is defined, but doing a proper * on the recipient delimiter if one is defined, but doing a proper
* job requires knowledge of local aliases. Yuck! I don't want to * job requires knowledge of local aliases. Yuck! I don't want to
* duplicate delivery-agent specific knowledge in the queue manager. * duplicate delivery-agent specific knowledge in the queue manager.
*
* XXX The nexthop field is overloaded to serve as destination and as * XXX The nexthop field is overloaded to serve as destination and as
* queue name. Should have separate fields for queue name and for * 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), '@'); at = strrchr(STR(reply.recipient), '@');
len = (at ? (at - STR(reply.recipient)) : strlen(STR(reply.recipient))); len = (at ? (at - STR(reply.recipient)) : strlen(STR(reply.recipient)));
@@ -743,7 +746,8 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
transport = qmgr_transport_create(STR(reply.transport)); transport = qmgr_transport_create(STR(reply.transport));
queue = 0; 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); VSTRING_SPACE(reply.nexthop, len + 2);
memmove(STR(reply.nexthop) + len + 1, STR(reply.nexthop), memmove(STR(reply.nexthop) + len + 1, STR(reply.nexthop),
LEN(reply.nexthop) + 1); LEN(reply.nexthop) + 1);

View File

@@ -149,10 +149,15 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream)
* queue name is user@nexthop, so that we can implement per-recipient * queue name is user@nexthop, so that we can implement per-recipient
* concurrency limits. However, the delivery agent protocol expects * concurrency limits. However, the delivery agent protocol expects
* nexthop only, so we must strip off the recipient local part. * nexthop only, so we must strip off the recipient local part.
*
* XXX Should have separate fields for queue name and for 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_message.c.
*/ */
flags = message->tflags flags = message->tflags
| (message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT); | (message->inspect_xport ? DEL_REQ_FLAG_BOUNCE : DEL_REQ_FLAG_DEFLT);
nexthop = (cp = strrchr(entry->queue->name, '@')) != 0 && cp[1] ? nexthop = strcmp(entry->queue->transport->name, MAIL_SERVICE_ERROR) != 0
&& (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_FLAGS, flags,

View File

@@ -606,9 +606,12 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
* on the recipient delimiter if one is defined, but doing a proper * on the recipient delimiter if one is defined, but doing a proper
* job requires knowledge of local aliases. Yuck! I don't want to * job requires knowledge of local aliases. Yuck! I don't want to
* duplicate delivery-agent specific knowledge in the queue manager. * duplicate delivery-agent specific knowledge in the queue manager.
*
* XXX The nexthop field is overloaded to serve as destination and as * XXX The nexthop field is overloaded to serve as destination and as
* queue name. Should have separate fields for queue name and for * 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), '@'); at = strrchr(STR(reply.recipient), '@');
len = (at ? (at - STR(reply.recipient)) : strlen(STR(reply.recipient))); len = (at ? (at - STR(reply.recipient)) : strlen(STR(reply.recipient)));
@@ -623,7 +626,8 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message)
transport = qmgr_transport_create(STR(reply.transport)); transport = qmgr_transport_create(STR(reply.transport));
queue = 0; 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); VSTRING_SPACE(reply.nexthop, len + 2);
memmove(STR(reply.nexthop) + len + 1, STR(reply.nexthop), memmove(STR(reply.nexthop) + len + 1, STR(reply.nexthop),
LEN(reply.nexthop) + 1); 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 * 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 * to the optional fall-back relays.
* by itself, with domain, host, [], numerical address, and port.
*/ */
sites = argv_alloc(1); sites = argv_alloc(1);
argv_add(sites, destination, (char *) 0); argv_add(sites, destination, (char *) 0);

View File

@@ -367,7 +367,6 @@ static MAPS *virt_mailbox_maps;
static MAPS *relay_rcpt_maps; static MAPS *relay_rcpt_maps;
#ifdef TEST #ifdef TEST
static MAPS *relocated_maps;
static STRING_LIST *virt_alias_doms; static STRING_LIST *virt_alias_doms;
static STRING_LIST *virt_mailbox_doms; static STRING_LIST *virt_mailbox_doms;
@@ -672,9 +671,6 @@ void smtpd_check_init(void)
DICT_FLAG_LOCK); DICT_FLAG_LOCK);
#ifdef TEST #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_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); virt_mailbox_doms = string_list_init(MATCH_FLAG_NONE, var_virt_mailbox_doms);
#endif #endif
@@ -3499,7 +3495,6 @@ char *var_virt_alias_maps;
char *var_virt_alias_doms; char *var_virt_alias_doms;
char *var_virt_mailbox_maps; char *var_virt_mailbox_maps;
char *var_virt_mailbox_doms; char *var_virt_mailbox_doms;
char *var_relocated_maps;
char *var_local_rcpt_maps; char *var_local_rcpt_maps;
char *var_perm_mx_networks; char *var_perm_mx_networks;
char *var_par_dom_match; char *var_par_dom_match;
@@ -3538,7 +3533,6 @@ static STRING_TABLE string_table[] = {
VAR_VIRT_ALIAS_DOMS, DEF_VIRT_ALIAS_DOMS, &var_virt_alias_doms, 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_MAPS, DEF_VIRT_MAILBOX_MAPS, &var_virt_mailbox_maps,
VAR_VIRT_MAILBOX_DOMS, DEF_VIRT_MAILBOX_DOMS, &var_virt_mailbox_doms, 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_LOCAL_RCPT_MAPS, DEF_LOCAL_RCPT_MAPS, &var_local_rcpt_maps,
VAR_PERM_MX_NETWORKS, DEF_PERM_MX_NETWORKS, &var_perm_mx_networks, VAR_PERM_MX_NETWORKS, DEF_PERM_MX_NETWORKS, &var_perm_mx_networks,
VAR_PAR_DOM_MATCH, DEF_PAR_DOM_MATCH, &var_par_dom_match, VAR_PAR_DOM_MATCH, DEF_PAR_DOM_MATCH, &var_par_dom_match,

View File

@@ -35,6 +35,8 @@
/* System library. */ /* System library. */
#include "sys_defs.h" #include "sys_defs.h"
#include <sys/stat.h>
#include <time.h>
#include <errno.h> #include <errno.h>
#ifndef EDQUOT #ifndef EDQUOT
@@ -81,7 +83,8 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr)
int mail_copy_status; int mail_copy_status;
int deliver_status; int deliver_status;
int copy_flags; int copy_flags;
static int count; struct stat st;
time_t starttime = time((time_t *) 0);
/* /*
* Make verbose logging easier to understand. * Make verbose logging easier to understand.
@@ -128,20 +131,33 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr)
* use starttime.pid_count.host, where starttime is the time that your * use starttime.pid_count.host, where starttime is the time that your
* process started, and count is the number of messages you've * process started, and count is the number of messages you've
* delivered." * delivered."
*
* Well, that stopped working on fast machines, and on operating systems
* that randomize process ID values. When creating a file in tmp/ we use
* the process ID because it still is an exclusive resource. When moving
* the file to new/ we use the device number and inode number. I do not
* care if this breaks on a remote AFS file system, because people should
* know better.
*/ */
#define STR vstring_str #define STR vstring_str
set_eugid(usr_attr.uid, usr_attr.gid); set_eugid(usr_attr.uid, usr_attr.gid);
vstring_sprintf(buf, "%ld.%d_%d.%s", (long) var_starttime, vstring_sprintf(buf, "%lu.%d.%s",
var_pid, count++, get_hostname()); (unsigned long) starttime, var_pid, get_hostname());
tmpfile = concatenate(tmpdir, STR(buf), (char *) 0); tmpfile = concatenate(tmpdir, STR(buf), (char *) 0);
newfile = concatenate(newdir, STR(buf), (char *) 0); newfile = 0;
if ((dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0 if ((dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0
&& (errno != ENOENT && (errno != ENOENT
|| make_dirs(tmpdir, 0700) < 0 || make_dirs(tmpdir, 0700) < 0
|| (dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0)) { || (dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0)) {
vstring_sprintf(why, "create %s: %m", tmpfile); vstring_sprintf(why, "create %s: %m", tmpfile);
} else if (fstat(vstream_fileno(dst), &st) < 0) {
vstring_sprintf(why, "create %s: %m", tmpfile);
} else { } else {
vstring_sprintf(buf, "%lu.%lu_%lu.%s",
(unsigned long) starttime, (unsigned long) st.st_dev,
(unsigned long) st.st_ino, get_hostname());
newfile = concatenate(newdir, STR(buf), (char *) 0);
if ((mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr), if ((mail_copy_status = mail_copy(COPY_ATTR(state.msg_attr),
dst, copy_flags, "\n", why)) == 0) { dst, copy_flags, "\n", why)) == 0) {
if (sane_link(tmpfile, newfile) < 0 if (sane_link(tmpfile, newfile) < 0
@@ -181,6 +197,7 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr)
myfree(tmpdir); myfree(tmpdir);
myfree(curdir); myfree(curdir);
myfree(tmpfile); myfree(tmpfile);
myfree(newfile); if (newfile)
myfree(newfile);
return (deliver_status); return (deliver_status);
} }