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

postfix-2.0.10-20030521

This commit is contained in:
Wietse Venema
2003-05-21 00:00:00 -05:00
committed by Viktor Dukhovni
parent eb8dcde50b
commit a3ed90800c
17 changed files with 47 additions and 111 deletions

View File

@@ -8053,13 +8053,14 @@ Apologies for any names omitted.
a forbidden "next" sender state after the last recipient. a forbidden "next" sender state after the last recipient.
Fix by Vladimir Davydoff. File: lmtp/lmtp_proto.c. Fix by Vladimir Davydoff. File: lmtp/lmtp_proto.c.
Bugfix: proxymap server did not parse "," as space. Bugfix: "," was not recognized in proxy_read_maps settings.
Leandro Santi. File: proxymap/proxymap.c. Fix by Leandro Santi. File: proxymap/proxymap.c.
20030502 20030502
Bugfix: defer delivery after .forward etc. file read error. Bugfix: defer delivery after .forward etc. file read error.
File: local/token.c. File: local/token.c. Problem reported by Ben Rosengart,
Panix.
20030503 20030503
@@ -8073,16 +8074,20 @@ Apologies for any names omitted.
descriptor is writable while write() transfers zero bytes. descriptor is writable while write() transfers zero bytes.
File: util/vstream.c. File: util/vstream.c.
20030519 20030520
Feature: new require_{date,from,message_id,received}_header Cleanup: future time stamps in Received: headers and negative
restriction to reject SMTP mail when some message header delays in delivery agent logging after "postdrop -r",
is missing. Only the From: and Date: headers are actually because deferred queue files had future file modification
required by Internet mail standards; the Received: and times. File: src/postsuper/postsuper.c.
Message-ID: headers are optional, but these are often
missing from SPAM email. Files: global/cleanup_user.h, 20030521
global/cleanup_strerror.c, smtpd/smtpd_check.c,
cleanup/cleanup_message.c. Cleanup: nqmgr warnings about "recipient count mismatch"
after "postdrop -r", because the cleanup server did not
count the "already done" recipients. Problem reported by
Richard Stockton, Gramma Software. Files:
cleanup/cleanup_envelope.c, cleanup/cleanup_extracted.c.
Open problems: Open problems:

View File

@@ -121,7 +121,7 @@ this also breaks majordomo approval requests when the included
request contains valid 8-bit MIME mail, and it breaks bounces from request contains valid 8-bit MIME mail, and it breaks bounces from
mailers that do not properly encapsulate 8-bit content (for example, mailers that do not properly encapsulate 8-bit content (for example,
bounces from qmail or from old versions of Postfix). bounces from qmail or from old versions of Postfix).
.IP \fBstrict_mime_encoding_domain\fR .IP \fBstrict_mime_domain_encoding\fR
Reject mail with invalid \fBContent-Transfer-Encoding:\fR Reject mail with invalid \fBContent-Transfer-Encoding:\fR
information for message/* or multipart/*. This blocks mail information for message/* or multipart/*. This blocks mail
from poorly written software. from poorly written software.

View File

@@ -183,6 +183,8 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type,
cleanup_addr_recipient(state, buf); cleanup_addr_recipient(state, buf);
myfree(state->orig_rcpt); myfree(state->orig_rcpt);
state->orig_rcpt = 0; state->orig_rcpt = 0;
} else if (type == REC_TYPE_DONE) {
/* void */ ;
} else if (type == REC_TYPE_WARN) { } else if (type == REC_TYPE_WARN) {
if ((state->warn_time = atol(buf)) < 0) { if ((state->warn_time = atol(buf)) < 0) {
state->errs |= CLEANUP_STAT_BAD; state->errs |= CLEANUP_STAT_BAD;

View File

@@ -153,8 +153,11 @@ static void cleanup_extracted_process(CLEANUP_STATE *state, int type,
myfree(state->orig_rcpt); myfree(state->orig_rcpt);
state->orig_rcpt = 0; state->orig_rcpt = 0;
return; return;
} else if (type == REC_TYPE_DONE) {
return;
} else if (type == REC_TYPE_ORCP) { } else if (type == REC_TYPE_ORCP) {
state->orig_rcpt = mystrdup(buf); state->orig_rcpt = mystrdup(buf);
return;
} }
if (type != REC_TYPE_END) { if (type != REC_TYPE_END) {
cleanup_out(state, type, buf, len); cleanup_out(state, type, buf, len);

View File

@@ -493,29 +493,6 @@ static void cleanup_header_callback(void *context, int header_class,
} }
} }
/* cleanup_missing - handle missing message header */
static void cleanup_missing(CLEANUP_STATE *state, const char *resent,
const char *header)
{
const char *attr;
if ((attr = nvtable_find(state->attr, MAIL_ATTR_ORIGIN)) == 0)
attr = "unknown";
vstring_sprintf(state->temp1, "%s: reject: missing %s%s header from %s;",
state->queue_id, resent, header, attr);
if (state->sender)
vstring_sprintf_append(state->temp1, " from=<%s>", state->sender);
if (state->recip)
vstring_sprintf_append(state->temp1, " to=<%s>", state->recip);
if ((attr = nvtable_find(state->attr, MAIL_ATTR_PROTO_NAME)) != 0)
vstring_sprintf_append(state->temp1, " proto=%s", attr);
if ((attr = nvtable_find(state->attr, MAIL_ATTR_HELO_NAME)) != 0)
vstring_sprintf_append(state->temp1, " helo=<%s>", attr);
msg_info("%s", vstring_str(state->temp1));
state->errs |= CLEANUP_STAT_MISS_HDR;
}
/* cleanup_header_done_callback - insert missing message headers */ /* cleanup_header_done_callback - insert missing message headers */
static void cleanup_header_done_callback(void *context) static void cleanup_header_done_callback(void *context)
@@ -525,15 +502,6 @@ static void cleanup_header_done_callback(void *context)
struct tm *tp; struct tm *tp;
TOK822 *token; TOK822 *token;
/*
* Postfix prepends a Received: message header, so we should see two when
* one is required.
*/
if ((state->flags & CLEANUP_FLAG_NEED_RCVD) && state->hop_count < 2) {
cleanup_missing(state, "", "Received");
return;
}
/* /*
* Add a missing (Resent-)Message-Id: header. The message ID gives the * Add a missing (Resent-)Message-Id: header. The message ID gives the
* time in GMT units, plus the local queue ID. * time in GMT units, plus the local queue ID.
@@ -545,10 +513,6 @@ static void cleanup_header_done_callback(void *context)
*/ */
if ((state->headers_seen & (1 << (state->resent[0] ? if ((state->headers_seen & (1 << (state->resent[0] ?
HDR_RESENT_MESSAGE_ID : HDR_MESSAGE_ID))) == 0) { HDR_RESENT_MESSAGE_ID : HDR_MESSAGE_ID))) == 0) {
if (state->flags & CLEANUP_FLAG_NEED_MSGID) {
cleanup_missing(state, state->resent, "Message-Id");
return;
}
tp = gmtime(&state->time); tp = gmtime(&state->time);
strftime(time_stamp, sizeof(time_stamp), "%Y%m%d%H%M%S", tp); strftime(time_stamp, sizeof(time_stamp), "%Y%m%d%H%M%S", tp);
cleanup_out_format(state, REC_TYPE_NORM, "%sMessage-Id: <%s.%s@%s>", cleanup_out_format(state, REC_TYPE_NORM, "%sMessage-Id: <%s.%s@%s>",
@@ -564,10 +528,6 @@ static void cleanup_header_done_callback(void *context)
*/ */
if ((state->headers_seen & (1 << (state->resent[0] ? if ((state->headers_seen & (1 << (state->resent[0] ?
HDR_RESENT_DATE : HDR_DATE))) == 0) { HDR_RESENT_DATE : HDR_DATE))) == 0) {
if (state->flags & CLEANUP_FLAG_NEED_DATE) {
cleanup_missing(state, state->resent, "Date");
return;
}
cleanup_out_format(state, REC_TYPE_NORM, "%sDate: %s", cleanup_out_format(state, REC_TYPE_NORM, "%sDate: %s",
state->resent, mail_date(state->time)); state->resent, mail_date(state->time));
} }
@@ -577,10 +537,6 @@ static void cleanup_header_done_callback(void *context)
*/ */
if ((state->headers_seen & (1 << (state->resent[0] ? if ((state->headers_seen & (1 << (state->resent[0] ?
HDR_RESENT_FROM : HDR_FROM))) == 0) { HDR_RESENT_FROM : HDR_FROM))) == 0) {
if (state->flags & CLEANUP_FLAG_NEED_FROM) {
cleanup_missing(state, state->resent, "From");
return;
}
quote_822_local(state->temp1, *state->sender ? quote_822_local(state->temp1, *state->sender ?
state->sender : MAIL_ADDR_MAIL_DAEMON); state->sender : MAIL_ADDR_MAIL_DAEMON);
vstring_sprintf(state->temp2, "%sFrom: %s", vstring_sprintf(state->temp2, "%sFrom: %s",

View File

@@ -51,7 +51,6 @@ static struct cleanup_stat_map cleanup_stat_map[] = {
CLEANUP_STAT_BAD, "Internal protocol error", CLEANUP_STAT_BAD, "Internal protocol error",
CLEANUP_STAT_RCPT, "No recipients specified", CLEANUP_STAT_RCPT, "No recipients specified",
CLEANUP_STAT_HOPS, "Too many hops", CLEANUP_STAT_HOPS, "Too many hops",
CLEANUP_STAT_MISS_HDR, "Missing message header",
CLEANUP_STAT_SIZE, "Message file too big", CLEANUP_STAT_SIZE, "Message file too big",
CLEANUP_STAT_CONT, "Message content rejected", CLEANUP_STAT_CONT, "Message content rejected",
CLEANUP_STAT_WRITE, "Error writing message file", CLEANUP_STAT_WRITE, "Error writing message file",

View File

@@ -20,19 +20,13 @@
#define CLEANUP_FLAG_HOLD (1<<2) /* Place message on hold */ #define CLEANUP_FLAG_HOLD (1<<2) /* Place message on hold */
#define CLEANUP_FLAG_DISCARD (1<<3) /* Discard message silently */ #define CLEANUP_FLAG_DISCARD (1<<3) /* Discard message silently */
#define CLEANUP_FLAG_BCC_OK (1<<4) /* Ok to add auto-BCC addresses */ #define CLEANUP_FLAG_BCC_OK (1<<4) /* Ok to add auto-BCC addresses */
#define CLEANUP_FLAG_NEED_DATE (1<<5) /* Require (Resent:-)Date: */
#define CLEANUP_FLAG_NEED_FROM (1<<6) /* Require (Resent:-)From: */
#define CLEANUP_FLAG_NEED_MSGID (1<<7) /* Require (Resent:-)Message-Id: */
#define CLEANUP_FLAG_NEED_RCVD (1<<8) /* Require two Received: headers */
/* /*
* These are set on the fly while processing SMTP envelopes or message * These are set on the fly while processing SMTP envelopes or message
* content. * content.
*/ */
#define CLEANUP_FLAG_MASK_EXTRA \ #define CLEANUP_FLAG_MASK_EXTRA \
(CLEANUP_FLAG_HOLD | CLEANUP_FLAG_DISCARD | CLEANUP_FLAG_NEED_DATE | \ (CLEANUP_FLAG_HOLD | CLEANUP_FLAG_DISCARD)
CLEANUP_FLAG_NEED_FROM | CLEANUP_FLAG_NEED_MSGID | \
CLEANUP_FLAG_NEED_RCVD)
/* /*
* Diagnostics. * Diagnostics.
@@ -45,7 +39,6 @@
#define CLEANUP_STAT_SIZE (1<<2) /* Message file too big */ #define CLEANUP_STAT_SIZE (1<<2) /* Message file too big */
#define CLEANUP_STAT_CONT (1<<3) /* Message content rejected */ #define CLEANUP_STAT_CONT (1<<3) /* Message content rejected */
#define CLEANUP_STAT_HOPS (1<<4) /* Too many hops */ #define CLEANUP_STAT_HOPS (1<<4) /* Too many hops */
#define CLEANUP_STAT_MISS_HDR (1<<5) /* Some missing header */
#define CLEANUP_STAT_RCPT (1<<6) /* No recipients found */ #define CLEANUP_STAT_RCPT (1<<6) /* No recipients found */
/* /*

View File

@@ -607,6 +607,17 @@ void mail_params_init()
if (strcasecmp(var_myhostname, var_relayhost) == 0) if (strcasecmp(var_myhostname, var_relayhost) == 0)
msg_fatal("myhostname == relayhost"); msg_fatal("myhostname == relayhost");
/*
* XXX These should be caught by a proper parameter parsing algorithm.
*/
if (var_myorigin[strcspn(var_myorigin, ", \t\r\n")])
msg_fatal("myorigin parameter setting contains multiple values: %s",
var_myorigin);
if (var_relayhost[strcspn(var_relayhost, ", \t\r\n")])
msg_fatal("relayhost parameter setting contains multiple values: %s",
var_relayhost);
/* /*
* One more sanity check. * One more sanity check.
*/ */

View File

@@ -1337,11 +1337,6 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`\
abcdefghijklmnopqrstuvwxyz{|}~" abcdefghijklmnopqrstuvwxyz{|}~"
extern char *var_smtpd_exp_filter; extern char *var_smtpd_exp_filter;
#define REQUIRE_DATE_HDR "require_date_header"
#define REQUIRE_FROM_HDR "require_from_header"
#define REQUIRE_MSGID_HDR "require_message_id_header"
#define REQUIRE_RCVD_HDR "require_received_header"
/* /*
* Heuristic to reject unknown local recipients at the SMTP port. * Heuristic to reject unknown local recipients at the SMTP port.
*/ */

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 "20030519" #define MAIL_RELEASE_DATE "20030521"
#define VAR_MAIL_VERSION "mail_version" #define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "2.0.9-" MAIL_RELEASE_DATE #define DEF_MAIL_VERSION "2.0.10-" MAIL_RELEASE_DATE
extern char *var_mail_version; extern char *var_mail_version;
/* /*

View File

@@ -175,6 +175,8 @@ static int copy_segment(VSTREAM *qfile, VSTREAM *cleanup, PICKUP_INFO *info,
if ((type = rec_get(qfile, buf, var_line_limit)) < 0 if ((type = rec_get(qfile, buf, var_line_limit)) < 0
|| strchr(expected, type) == 0) || strchr(expected, type) == 0)
return (file_read_error(info, type)); return (file_read_error(info, type));
if (msg_verbose)
msg_info("%s: read %c %s", info->id, type, vstring_str(buf));
if (type == *expected) if (type == *expected)
break; break;
if (type == REC_TYPE_FROM) if (type == REC_TYPE_FROM)
@@ -191,6 +193,8 @@ static int copy_segment(VSTREAM *qfile, VSTREAM *cleanup, PICKUP_INFO *info,
info->rcpt = mystrdup(vstring_str(buf)); info->rcpt = mystrdup(vstring_str(buf));
if (type == REC_TYPE_TIME) if (type == REC_TYPE_TIME)
continue; continue;
if (type == REC_TYPE_SIZE)
continue;
if (type == REC_TYPE_ATTR) { if (type == REC_TYPE_ATTR) {
if ((error_text = split_nameval(vstring_str(buf), &attr_name, if ((error_text = split_nameval(vstring_str(buf), &attr_name,
&attr_value)) != 0) { &attr_value)) != 0) {

View File

@@ -315,9 +315,6 @@ int main(int argc, char **argv)
} }
if (rec_type == REC_TYPE_ERROR) if (rec_type == REC_TYPE_ERROR)
msg_fatal("uid=%ld: malformed input", (long) uid); msg_fatal("uid=%ld: malformed input", (long) uid);
if (rec_type == REC_TYPE_TIME)
rec_fprintf(dst->stream, REC_TYPE_TIME, "%ld",
(long) time((time_t *) 0));
if (strchr(*expected, rec_type) == 0) if (strchr(*expected, rec_type) == 0)
msg_fatal("uid=%ld: unexpected record type: %d", (long) uid, rec_type); msg_fatal("uid=%ld: unexpected record type: %d", (long) uid, rec_type);
if (rec_type == **expected) if (rec_type == **expected)

View File

@@ -5,7 +5,7 @@
/* Postfix superintendent /* Postfix superintendent
/* SYNOPSIS /* SYNOPSIS
/* .fi /* .fi
/* \fBpostsuper\fR [\fB-psv\fR] /* \fBpostsuper\fR [\fB-psv\fR]
/* [\fB-c \fIconfig_dir\fR] [\fB-d \fIqueue_id\fR] /* [\fB-c \fIconfig_dir\fR] [\fB-d \fIqueue_id\fR]
/* [\fB-h \fIqueue_id\fR] [\fB-H \fIqueue_id\fR] /* [\fB-h \fIqueue_id\fR] [\fB-H \fIqueue_id\fR]
/* [\fB-r \fIqueue_id\fR] [\fIdirectory ...\fR] /* [\fB-r \fIqueue_id\fR] [\fIdirectory ...\fR]
@@ -191,6 +191,7 @@
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> /* remove() */ #include <stdio.h> /* remove() */
#include <utime.h>
/* Utility library. */ /* Utility library. */
@@ -433,6 +434,7 @@ static int requeue_one(const char **queue_names, const char *queue_id)
VSTRING *new_path_buf; VSTRING *new_path_buf;
int found; int found;
int tries; int tries;
struct utimbuf tbuf;
/* /*
* Sanity check. No early returns beyond this point. * Sanity check. No early returns beyond this point.
@@ -459,6 +461,9 @@ static int requeue_one(const char **queue_names, const char *queue_id)
continue; continue;
(void) mail_queue_path(new_path_buf, MAIL_QUEUE_MAILDROP, queue_id); (void) mail_queue_path(new_path_buf, MAIL_QUEUE_MAILDROP, queue_id);
if (postrename(old_path, STR(new_path_buf)) == 0) { if (postrename(old_path, STR(new_path_buf)) == 0) {
tbuf.actime = tbuf.modtime = time((time_t *) 0);
if (utime(STR(new_path_buf), &tbuf) < 0)
msg_warn("%s: reset time stamps: %m", STR(new_path_buf));
msg_info("%s: requeued", queue_id); msg_info("%s: requeued", queue_id);
found = 1; found = 1;
break; break;

View File

@@ -482,9 +482,6 @@ static void qmqpd_send_status(QMQPD_STATE *state)
} else if ((state->err & CLEANUP_STAT_RCPT) != 0) { } else if ((state->err & CLEANUP_STAT_RCPT) != 0) {
qmqpd_reply(state, DO_LOG, QMQPD_STAT_HARD, qmqpd_reply(state, DO_LOG, QMQPD_STAT_HARD,
"Error: no recipients specified"); "Error: no recipients specified");
} else if ((state->err & CLEANUP_STAT_MISS_HDR) != 0) {
qmqpd_reply(state, DO_LOG, QMQPD_STAT_HARD,
"Error: missing message header");
} else { } else {
qmqpd_reply(state, DO_LOG, QMQPD_STAT_RETRY, qmqpd_reply(state, DO_LOG, QMQPD_STAT_RETRY,
"Error: internal error %d", state->err); "Error: internal error %d", state->err);

View File

@@ -523,7 +523,6 @@ static void enqueue(const int flags, const char *encoding, const char *sender,
* *
* XXX Should limit the size of envelope records. * XXX Should limit the size of envelope records.
*/ */
rec_fprintf(dst, REC_TYPE_TIME, "%ld", (long) time((time_t *) 0));
if (full_name || (full_name = fullname()) != 0) if (full_name || (full_name = fullname()) != 0)
rec_fputs(dst, REC_TYPE_FULL, full_name); rec_fputs(dst, REC_TYPE_FULL, full_name);
rec_fputs(dst, REC_TYPE_FROM, saved_sender); rec_fputs(dst, REC_TYPE_FROM, saved_sender);

View File

@@ -1141,9 +1141,6 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
} else if ((state->err & CLEANUP_STAT_WRITE) != 0) { } else if ((state->err & CLEANUP_STAT_WRITE) != 0) {
state->error_mask |= MAIL_ERROR_RESOURCE; state->error_mask |= MAIL_ERROR_RESOURCE;
smtpd_chat_reply(state, "451 Error: queue file write error"); smtpd_chat_reply(state, "451 Error: queue file write error");
} else if ((state->err & CLEANUP_STAT_MISS_HDR) != 0) {
state->error_mask |= MAIL_ERROR_POLICY;
smtpd_chat_reply(state, "550 Error: missing message header");
} else { } else {
state->error_mask |= MAIL_ERROR_SOFTWARE; state->error_mask |= MAIL_ERROR_SOFTWARE;
smtpd_chat_reply(state, "451 Error: internal error %d", state->err); smtpd_chat_reply(state, "451 Error: internal error %d", state->err);

View File

@@ -57,13 +57,6 @@
/* Reject, defer or permit the request unconditionally. This is to be used /* Reject, defer or permit the request unconditionally. This is to be used
/* at the end of a restriction list in order to make the default /* at the end of a restriction list in order to make the default
/* action explicit. /* action explicit.
/* .IP require_date_header
/* .IP require_from_header
/* .IP require_message_id_header
/* .IP require_received_header
/* Reject the message when it does not contain a Date: etc.
/* message header. Only the Date: header is required by mail
/* standards. The other headers are usually added by MTAs.
/* .IP reject_unknown_client /* .IP reject_unknown_client
/* Reject the request when the client hostname could not be found. /* Reject the request when the client hostname could not be found.
/* The \fIunknown_client_reject_code\fR configuration parameter /* The \fIunknown_client_reject_code\fR configuration parameter
@@ -2757,26 +2750,6 @@ static int generic_checks(SMTPD_STATE *state, ARGV *restrictions,
DEFER_IF_REJECT2(state, MAIL_ERROR_POLICY, DEFER_IF_REJECT2(state, MAIL_ERROR_POLICY,
"450 <%s>: %s rejected: defer_if_reject requested", "450 <%s>: %s rejected: defer_if_reject requested",
reply_name, reply_class); reply_name, reply_class);
} else if (strcasecmp(name, REQUIRE_DATE_HDR) == 0) {
#ifndef TEST
rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d",
CLEANUP_FLAG_NEED_DATE);
#endif
} else if (strcasecmp(name, REQUIRE_FROM_HDR) == 0) {
#ifndef TEST
rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d",
CLEANUP_FLAG_NEED_FROM);
#endif
} else if (strcasecmp(name, REQUIRE_MSGID_HDR) == 0) {
#ifndef TEST
rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d",
CLEANUP_FLAG_NEED_MSGID);
#endif
} else if (strcasecmp(name, REQUIRE_RCVD_HDR) == 0) {
#ifndef TEST
rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d",
CLEANUP_FLAG_NEED_RCVD);
#endif
} }
/* /*