From 2b4310b330e4ab7a2e05cd65bb138ea3907bd65c Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Tue, 4 Jul 2006 00:00:00 -0500 Subject: [PATCH] postfix-2.3-RC5 --- postfix/HISTORY | 5 +++ postfix/README_FILES/MILTER_README | 6 ++- postfix/html/MILTER_README.html | 5 ++- postfix/html/master.5.html | 44 +++++++++++----------- postfix/man/man5/master.5 | 12 +++--- postfix/proto/MILTER_README.html | 5 ++- postfix/proto/master | 12 +++--- postfix/src/cleanup/cleanup_milter.c | 56 ++++++++++++++++------------ postfix/src/global/mail_version.h | 4 +- postfix/src/milter/Makefile.in | 2 +- postfix/src/milter/milter8.c | 6 +++ postfix/src/milter/test-milter.c | 4 +- 12 files changed, 96 insertions(+), 65 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index 334946156..3e27f5426 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -12445,6 +12445,11 @@ Apologies for any names omitted. Compatibility: with OpenBSD 2.7 and later, the alias file is now in /etc/mail/aliases. +20060704 + + Bugfix: the Milter client skipped zero-length body lines. + File: milter/milter8.c. + Wish list: In the SMTPD policy client (encode or strip) non-printable diff --git a/postfix/README_FILES/MILTER_README b/postfix/README_FILES/MILTER_README index 1d2bc52c7..82ef3bac7 100644 --- a/postfix/README_FILES/MILTER_README +++ b/postfix/README_FILES/MILTER_README @@ -125,7 +125,11 @@ RRuunnnniinngg MMiilltteerr aapppplliiccaattiioonnss To run a Milter application, see the documentation of the filter for options. A typical command looks like this: - $ //ssoommee//wwhheerree//ddkk--ffiilltteerr --pp iinneett::ppoorrttnnuummbbeerr@@llooccaallhhoosstt ......ootthheerr ooppttiioonnss...... + # //ssoommee//wwhheerree//ddkk--ffiilltteerr --uu uusseerriidd --pp iinneett::ppoorrttnnuummbbeerr@@llooccaallhhoosstt ......ootthheerr + ooppttiioonnss...... + +Please specify a userid value that isn't used for other applications (not +"postfix", not "www", etc.). CCoonnffiigguurriinngg PPoossttffiixx diff --git a/postfix/html/MILTER_README.html b/postfix/html/MILTER_README.html index c300ef742..acfe5fae3 100644 --- a/postfix/html/MILTER_README.html +++ b/postfix/html/MILTER_README.html @@ -257,10 +257,13 @@ for options. A typical command looks like this:

-$ /some/where/dk-filter -p inet:portnumber@localhost ...other options...
+# /some/where/dk-filter -u userid -p inet:portnumber@localhost ...other options...
 
+

Please specify a userid value that isn't used for other +applications (not "postfix", not "www", etc.).

+

Configuring Postfix

Like Sendmail, Postfix has a lot of configuration options that diff --git a/postfix/html/master.5.html b/postfix/html/master.5.html index 376ad3d1a..412a62657 100644 --- a/postfix/html/master.5.html +++ b/postfix/html/master.5.html @@ -16,7 +16,7 @@ MASTER(5) MASTER(5) Postfix services are implemented by daemon processes. These run in the background under control of the master(8) - process. The master.cf configuration file defines how a + process. The master.cf configuration file defines how a client program connects to a service, and what daemon pro- gram runs when a service is requested. Most daemon pro- cesses are short-lived and terminate after serving max_use @@ -28,17 +28,17 @@ MASTER(5) MASTER(5) local(8), pipe(8) or spawn(8) services, or run the server under control by inetd(8) or equivalent. - After changing master.cf you must execute "postfix reload" + After changing master.cf you must execute "postfix reload" to reload the configuration. SYNTAX - The general format of the master.cf file is as follows: + The general format of the master.cf file is as follows: o Each logical line defines a single Postfix service. Each service is identified by its name and type as described below. When multiple lines specify the same service name and type, only the last one is - remembered. Otherwise, the order of master.cf ser- + remembered. Otherwise, the order of master.cf ser- vice definitions does not matter. o Empty lines and whitespace-only lines are ignored, @@ -51,7 +51,7 @@ MASTER(5) MASTER(5) Each logical line consists of eight fields separated by whitespace. These are described below in the order as - they appear in the master.cf file. + they appear in the master.cf file. Where applicable a field of "-" requests that the built-in default value be used. For boolean fields specify "y" or @@ -86,9 +86,9 @@ MASTER(5) MASTER(5) Note: with Postfix version 2.2 and later specify "inet_interfaces = loopback-only" in - main.cf, instead of hard-coding loopback IP - address information in master.cf or in - main.cf. + main.cf, instead of hard-coding loopback IP + address information in master.cf or in + main.cf. unix The service listens on a UNIX-domain socket and is accessible for local clients only. @@ -96,7 +96,7 @@ MASTER(5) MASTER(5) The service name is a pathname relative to the Postfix queue directory (pathname con- trolled with the queue_directory configura- - tion parameter in main.cf). + tion parameter in main.cf). On Solaris systems the unix type is imple- mented with streams sockets. @@ -107,7 +107,7 @@ MASTER(5) MASTER(5) The service name is a pathname relative to the Postfix queue directory (pathname con- trolled with the queue_directory configura- - tion parameter in main.cf). + tion parameter in main.cf). Private (default: y) Whether or not access is restricted to the mail @@ -118,7 +118,7 @@ MASTER(5) MASTER(5) Whether the service runs with root privileges or as the owner of the Postfix system (the owner name is controlled by the mail_owner configuration variable - in the main.cf file). + in the main.cf file). The local(8), pipe(8), spawn(8), and virtual(8) daemons require privileges. @@ -127,7 +127,7 @@ MASTER(5) MASTER(5) Whether or not the service runs chrooted to the mail queue directory (pathname is controlled by the queue_directory configuration variable in the - main.cf file). + main.cf file). Chroot should not be used with the local(8), pipe(8), spawn(8), and virtual(8) daemons. @@ -136,9 +136,9 @@ MASTER(5) MASTER(5) service in the first place. The files in the examples/chroot-setup subdirectory - of the Postfix source archive describe how to set - up a Postfix chroot environment for your type of - machine, and BASIC_CONFIGURATION_README discusses + of the Postfix source archive can be used to set up + a Postfix chroot environment on a variety of sys- + tems. See also BASIC_CONFIGURATION_README for issues related to running daemons chrooted. Wake up time (default: 0) @@ -146,9 +146,9 @@ MASTER(5) MASTER(5) specified number of seconds. The wake up is imple- mented by connecting to the service and sending a wake up request. A ? at the end of the wake-up - time field requests that wake up events be sent - only to services that are actually being used. - Specify 0 for no automatic wake up. + time field requests that no wake up events be sent + before the service is used. Specify 0 for no auto- + matic wake up. The pickup(8), qmgr(8) and flush(8) daemons require a wake up timer. @@ -182,21 +182,21 @@ MASTER(5) MASTER(5) -D Run the daemon under control by the command specified with the debugger_command variable - in the main.cf configuration file. See + in the main.cf configuration file. See DEBUG_README for hints and tips. -o name=value - Override the named main.cf configuration + Override the named main.cf configuration parameter. The parameter value can refer to other parameters as $name etc., just like in - main.cf. See postconf(5) for syntax. + main.cf. See postconf(5) for syntax. NOTE 1: do not specify whitespace around the "=". In parameter values, either avoid whitespace altogether, use commas instead of spaces, or consider overrides like "-o name=$override_parameter" with $over- - ride_parameter set in main.cf. + ride_parameter set in main.cf. NOTE 2: Over-zealous use of parameter over- rides makes the Postfix configuration hard diff --git a/postfix/man/man5/master.5 b/postfix/man/man5/master.5 index dddb6d43a..13cfcb1b7 100644 --- a/postfix/man/man5/master.5 +++ b/postfix/man/man5/master.5 @@ -126,16 +126,16 @@ most of the purpose of having that service in the first place. .sp The files in the examples/chroot-setup subdirectory of the -Postfix source archive describe how to set up a Postfix -chroot environment for your type of machine, and -BASIC_CONFIGURATION_README discusses issues related to -running daemons chrooted. +Postfix source archive can be used to set up a Postfix +chroot environment on a variety of systems. See also +BASIC_CONFIGURATION_README for issues related to running +daemons chrooted. .IP "\fBWake up time (default: 0)\fR" Automatically wake up the named service after the specified number of seconds. The wake up is implemented by connecting to the service and sending a wake up request. A ? at the -end of the wake-up time field requests that wake up events -be sent only to services that are actually being used. +end of the wake-up time field requests that no wake up +events be sent before the service is used. Specify 0 for no automatic wake up. .sp The \fBpickup\fR(8), \fBqmgr\fR(8) and \fBflush\fR(8) diff --git a/postfix/proto/MILTER_README.html b/postfix/proto/MILTER_README.html index 0b2e53dcb..b82d770ab 100644 --- a/postfix/proto/MILTER_README.html +++ b/postfix/proto/MILTER_README.html @@ -257,10 +257,13 @@ for options. A typical command looks like this:

-$ /some/where/dk-filter -p inet:portnumber@localhost ...other options...
+# /some/where/dk-filter -u userid -p inet:portnumber@localhost ...other options...
 
+

Please specify a userid value that isn't used for other +applications (not "postfix", not "www", etc.).

+

Configuring Postfix

Like Sendmail, Postfix has a lot of configuration options that diff --git a/postfix/proto/master b/postfix/proto/master index 751026072..21ae98b9a 100644 --- a/postfix/proto/master +++ b/postfix/proto/master @@ -120,16 +120,16 @@ # place. # .sp # The files in the examples/chroot-setup subdirectory of the -# Postfix source archive describe how to set up a Postfix -# chroot environment for your type of machine, and -# BASIC_CONFIGURATION_README discusses issues related to -# running daemons chrooted. +# Postfix source archive can be used to set up a Postfix +# chroot environment on a variety of systems. See also +# BASIC_CONFIGURATION_README for issues related to running +# daemons chrooted. # .IP "\fBWake up time (default: 0)\fR" # Automatically wake up the named service after the specified # number of seconds. The wake up is implemented by connecting # to the service and sending a wake up request. A ? at the -# end of the wake-up time field requests that wake up events -# be sent only to services that are actually being used. +# end of the wake-up time field requests that no wake up +# events be sent before the service is used. # Specify 0 for no automatic wake up. # .sp # The \fBpickup\fR(8), \fBqmgr\fR(8) and \fBflush\fR(8) diff --git a/postfix/src/cleanup/cleanup_milter.c b/postfix/src/cleanup/cleanup_milter.c index 4c08799b4..6c865f52b 100644 --- a/postfix/src/cleanup/cleanup_milter.c +++ b/postfix/src/cleanup/cleanup_milter.c @@ -37,35 +37,32 @@ /* local call-back functions for macro expansion and for queue /* file modification. /* -/* cleanup_milter_inspect() subjects a message to inspection -/* by mail filters. Each filter can accept or reject the message -/* and can request changes to the recipient list, to message -/* headers, and to replace the message body. +/* cleanup_milter_inspect() sends the current message headers +/* and body to the mail filters that were received with +/* cleanup_milter_receive(), or that are specified with the +/* cleanup_milters configuration parameter. /* /* cleanup_milter_emul_mail() emulates connect, helo and mail /* events for mail that does not arrive via the smtpd(8) server. -/* This pretends that mail arrives from localhost/127.0.0.1 -/* via ESMTP. This code reports a server configuration error -/* condition when the milter rejects the emulated commands. +/* The emulation pretends that mail arrives from localhost/127.0.0.1 +/* via ESMTP. Milters can reject emulated connect, helo, mail +/* or data events, but not emulated rcpt events as described +/* next. /* -/* cleanup_milter_emul_rcpt() emulates an rcpt() event for -/* non-SMTP mail. See cleanup_milter_emul_mail() for the -/* handling of reject replies. +/* cleanup_milter_emul_rcpt() emulates an rcpt event for mail +/* that does not arrive via the smtpd(8) server. This reports +/* a server configuration error condition when the milter +/* rejects an emulated rcpt event. /* -/* cleanup_milter_emul_data() emulates a data event for non-SMTP -/* mail. See cleanup_milter_emul_mail() for the handling of -/* reject replies. +/* cleanup_milter_emul_data() emulates a data event for mail +/* that does not arrive via the smtpd(8) server. It's OK for +/* milters to reject emulated data events. /* SEE ALSO /* milter(3) generic mail filter interface -/* BUGS -/* Postfix prepends its own Received: header when it receives -/* mail from outside, or when it forwards mail internally. -/* This header is seen by mail filters, and is present when -/* mail filters edit the queue file. /* DIAGNOSTICS /* Fatal errors: memory allocation problem. /* Panic: interface violation. -/* state->errs is updated in case of I/O errors. +/* Warnings: I/O errors (state->errs is updated accordingly). /* LICENSE /* .ad /* .fi @@ -226,14 +223,24 @@ static void cleanup_milter_set_error(CLEANUP_STATE *state, int err) static const char *cleanup_milter_error(CLEANUP_STATE *state, int err) { + const char *myname = "cleanup_milter_error"; /* - * This error text will be ignored by cleanup_milter_apply(). It exists - * only to maintain a consistent error reporting interface to the milter - * infrastructure. + * For consistency with error reporting within the milter infrastructure, + * content manipulation routines return a null pointer on success, and an + * SMTP-like response on error. + * + * However, when cleanup_milter_apply() receives this error response from + * the milter infrastructure, it ignores the text since the appropriate + * cleanup error flags were already set by cleanup_milter_set_error(). + * + * Specify a null error number when the "errno to error flag" mapping was + * already done elsewhere, possibly outside this module. */ if (err) cleanup_milter_set_error(state, err); + else if (CLEANUP_OUT_OK(state)) + msg_panic("%s: missing errno to error flag mapping", myname); return ("451 4.3.0 Server internal error"); } @@ -404,7 +411,7 @@ static off_t cleanup_find_header(CLEANUP_STATE *state, ssize_t index, if ((rec_type = rec_get_raw(state->dst, buf, 0, REC_FLAG_NONE)) < 0) { \ msg_warn("%s: read file %s: %m", myname, cleanup_path); \ cleanup_milter_set_error(state, errno); \ - quit; \ + do { quit; } while (0); \ } \ if (msg_verbose > 1) \ msg_info("%s: read: %ld: %.*s", myname, (long) curr_offset, \ @@ -1055,7 +1062,8 @@ static const char *cleanup_del_rcpt(void *context, char *rcpt) * but to match against the expanded and rewritten recipient address. * * XXX Remove the (dsn_orcpt, dsn_notify, orcpt, recip) tuple from the - * duplicate recipient filter. + * duplicate recipient filter. This requires that we maintain reference + * counts. */ if (vstream_fseek(state->dst, 0L, SEEK_SET) < 0) { msg_warn("%s: seek file %s: %m", myname, cleanup_path); diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 889481b48..94189cc2e 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20060703" -#define MAIL_VERSION_NUMBER "2.3-RC4" +#define MAIL_RELEASE_DATE "20060704" +#define MAIL_VERSION_NUMBER "2.3-RC5" #define VAR_MAIL_VERSION "mail_version" #define DEF_MAIL_VERSION MAIL_VERSION_NUMBER diff --git a/postfix/src/milter/Makefile.in b/postfix/src/milter/Makefile.in index 755ecf5c9..fb507c9cf 100644 --- a/postfix/src/milter/Makefile.in +++ b/postfix/src/milter/Makefile.in @@ -67,7 +67,7 @@ milter: milter.c $(LIB) $(LIBS) mv junk $@.o test-milter: test-milter.c - cc -o $@ $? -lmilter -lpthread + cc -g -o $@ $? -lmilter -lpthread depend: $(MAKES) (sed '1,/^# do not edit/!d' Makefile.in; \ diff --git a/postfix/src/milter/milter8.c b/postfix/src/milter/milter8.c index 45f67f459..ccb833fd6 100644 --- a/postfix/src/milter/milter8.c +++ b/postfix/src/milter/milter8.c @@ -1997,6 +1997,12 @@ static void milter8_body(void *ptr, int rec_type, */ if (msg_verbose > 1) msg_info("%s: body milter %s: %.100s", myname, milter->m.name, buf); + /* To append \r\n, simply redirect input to another buffer. */ + if (rec_type == REC_TYPE_NORM && todo == 0) { + bp = "\r\n"; + todo = 2; + rec_type = REC_TYPE_EOF; + } while (todo > 0) { /* Append one REC_TYPE_NORM or REC_TYPE_CONT to body chunk buffer. */ space = MILTER_CHUNK_SIZE - LEN(milter->body); diff --git a/postfix/src/milter/test-milter.c b/postfix/src/milter/test-milter.c index a954024fc..65c79ede0 100644 --- a/postfix/src/milter/test-milter.c +++ b/postfix/src/milter/test-milter.c @@ -106,6 +106,8 @@ static char *chg_val; static int test_reply(SMFICTX *ctx, int code) { + (void) fflush(stdout); /* In case output redirected. */ + if (code == SMFIR_REPLYCODE) { if (smfi_setreply(ctx, reply_code, reply_dsn, reply_message) != MI_SUCCESS) fprintf(stderr, "smfi_setreply failed\n"); @@ -205,7 +207,7 @@ static sfsistat test_body(SMFICTX *ctx, unsigned char *data, size_t data_len) if (verbose == 0) printf("test_body %ld bytes\n", (long) data_len); else - printf("%*s", data_len, data); + printf("%.*s", data_len, data); return (test_reply(ctx, test_body_reply)); }