diff --git a/postfix/HISTORY b/postfix/HISTORY index f70477f9f..8d91a5f99 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -7089,6 +7089,9 @@ Apologies for any names omitted. 20020126 + Logging: SMTP UCE reject/warn/hold/discard logging now + includes queue ID. This will break some logfile analyzers. + Logging: SMTP UCE reject/warn/hold/discard logging now includes the protocol name and, if available, the hostname given in the SMTP HELO or EHLO command. @@ -7097,10 +7100,13 @@ Apologies for any names omitted. now includes the protocol name and, if available, the hostname given in the SMTP HELO or EHLO command. -Open problems: +20021028 - Low: smtpd should log queue ID with reject/warn/hold/discard - actions. + Bugfix: don't reset state after rejected EHLO. Reset state + after HELO. Reported by Karthikeyan Bhargavan, upenn.edu. + Files: smtpd/smtpd.c. + +Open problems: Low: revise other local delivery agent duplicate filters. diff --git a/postfix/README_FILES/SASL_README b/postfix/README_FILES/SASL_README index 19e5ae95d..67508d3fc 100644 --- a/postfix/README_FILES/SASL_README +++ b/postfix/README_FILES/SASL_README @@ -216,6 +216,7 @@ can use one of the following commands: % perl -MMIME::Base64 -e \ 'print encode_base64("username\0username\0password");' +mmencode is part of the metamail software. MIME::Base64 is available from www.cpan.org. Enabling SASL authentication in the Postfix SMTP client diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 1972e4cdc..624f52c8b 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -12,17 +12,18 @@ snapshot release). Patches change the patchlevel and the release date. Snapshots change only the release date, unless they include the same bugfixes as a patch release. -Incompatible changes with Postfix snapshot 1.1.11-20021026 +Incompatible changes with Postfix snapshot 1.1.11-20021028 ========================================================== -Logging formats have changed. This may affect logfile processing -software. +Logfile formats have changed. This may affect logfile processing +software. The queue file format is still compatible with Postfix +version 1.1 (stable release). -- The Postfix SMTP UCE reject etc. logging now includes the queue -ID, the mail protocol (SMTP or ESMTP), and the hostname that was -received with the HELO or EHLO command, if available. +- The Postfix SMTP server UCE reject etc. logging now includes the +queue ID, the mail protocol (SMTP or ESMTP), and the hostname that +was received with the HELO or EHLO command, if available. -- The Postfix header/body_checks logging now includes the the mail +- The Postfix header/body_checks logging now includes the mail protocol (SMTP, ESMTP, QMQP) and the hostname that was received with the SMTP HELO or EHLO command, if available. @@ -31,13 +32,15 @@ original recipient address (as received before any address rewriting or aliasing). The original recipient address is logged only when it differs from the final recipient address. -Major changes with Postfix snapshot 1.1.11-20021026 +Major changes with Postfix snapshot 1.1.11-20021028 =================================================== -The Postfix status=sent/bounced/deferred logging now shows the -original recipient address (as received before any address rewriting -or aliasing). The original recipient address is logged only when -it differs from the final recipient address. +Postfix logs more information, as described in the "incompatibilities" +section above. + +The local(8) and virtual(8) delivery agents now record the original +recipient address in the X-Original-To: message header. This header +can also be emitted by the pipe(8) delivery agent. Major changes with Postfix snapshot 1.1.11-20021024 =================================================== diff --git a/postfix/src/cleanup/cleanup_message.c b/postfix/src/cleanup/cleanup_message.c index 34ceea2c3..5fff20888 100644 --- a/postfix/src/cleanup/cleanup_message.c +++ b/postfix/src/cleanup/cleanup_message.c @@ -299,7 +299,6 @@ static int cleanup_act(CLEANUP_STATE *state, char *context, const char *buf, #define STREQUAL(x,y,l) (strncasecmp((x), (y), (l)) == 0 && (y)[l] == 0) #define CLEANUP_ACT_KEEP 1 #define CLEANUP_ACT_DROP 0 -#define STR(x) vstring_str(x) if (STREQUAL(value, "REJECT", command_len)) { if (state->reason == 0) diff --git a/postfix/src/cleanup/cleanup_out_recipient.c b/postfix/src/cleanup/cleanup_out_recipient.c index 4491532df..7ec014405 100644 --- a/postfix/src/cleanup/cleanup_out_recipient.c +++ b/postfix/src/cleanup/cleanup_out_recipient.c @@ -78,8 +78,7 @@ void cleanup_out_recipient(CLEANUP_STATE *state, const char *orcpt, return; if (cleanup_virtual_maps == 0) { - if (strcasecmp(orcpt, recip) != 0) - cleanup_out_string(state, REC_TYPE_ORCP, orcpt); + cleanup_out_string(state, REC_TYPE_ORCP, orcpt); cleanup_out_string(state, REC_TYPE_RCPT, recip); state->rcpt_count++; } else { diff --git a/postfix/src/global/bounce.c b/postfix/src/global/bounce.c index 11e68d280..8aa513966 100644 --- a/postfix/src/global/bounce.c +++ b/postfix/src/global/bounce.c @@ -34,7 +34,7 @@ /* const char *encoding; /* const char *sender; /* -/* int bounce_one(flags, queue, id, encoding, sender, +/* int bounce_one(flags, queue, id, encoding, sender, orig_rcpt, /* recipient, relay, entry, format, ...) /* int flags; /* const char *queue; diff --git a/postfix/src/global/deliver_pass.c b/postfix/src/global/deliver_pass.c index 91ecb467a..df4c8608f 100644 --- a/postfix/src/global/deliver_pass.c +++ b/postfix/src/global/deliver_pass.c @@ -108,7 +108,7 @@ static int deliver_pass_send_request(VSTREAM *stream, DELIVER_REQUEST *request, ATTR_TYPE_STR, MAIL_ATTR_RRCPT, request->return_receipt, ATTR_TYPE_LONG, MAIL_ATTR_TIME, request->arrival_time, ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, offs, - ATTR_TYPE_STR, MAIL_ATTR_ORCPT, orcpt ? orcpt : "", + ATTR_TYPE_STR, MAIL_ATTR_ORCPT, orcpt, ATTR_TYPE_STR, MAIL_ATTR_RECIP, addr, ATTR_TYPE_NUM, MAIL_ATTR_OFFSET, 0, ATTR_TYPE_END); diff --git a/postfix/src/global/deliver_request.c b/postfix/src/global/deliver_request.c index b855d13a2..08a95f326 100644 --- a/postfix/src/global/deliver_request.c +++ b/postfix/src/global/deliver_request.c @@ -246,7 +246,7 @@ static int deliver_request_get(VSTREAM *stream, DELIVER_REQUEST *request) return (-1); } recipient_list_add(&request->rcpt_list, offset, - *vstring_str(orig_addr) ? vstring_str(orig_addr) : 0, + vstring_str(orig_addr), vstring_str(address)); } diff --git a/postfix/src/global/mail_proto.h b/postfix/src/global/mail_proto.h index 0cd707aa3..9468016ee 100644 --- a/postfix/src/global/mail_proto.h +++ b/postfix/src/global/mail_proto.h @@ -23,6 +23,13 @@ #include #include + /* + * External protocols. + */ +#define MAIL_PROTO_SMTP "SMTP" +#define MAIL_PROTO_ESMTP "ESMTP" +#define MAIL_PROTO_QMQP "QMQP" + /* * Names of services: these are the names if INET ports, UNIX-domain sockets * or FIFOs that a service listens on. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 9969d2ad4..b704e9b34 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only, unless they include the same bugfix as a patch release. */ -#define MAIL_RELEASE_DATE "20021026" +#define MAIL_RELEASE_DATE "20021028" #define VAR_MAIL_VERSION "mail_version" #define DEF_MAIL_VERSION "1.1.11-" MAIL_RELEASE_DATE diff --git a/postfix/src/global/recipient_list.c b/postfix/src/global/recipient_list.c index 1153b7c6a..3228c09b9 100644 --- a/postfix/src/global/recipient_list.c +++ b/postfix/src/global/recipient_list.c @@ -100,7 +100,7 @@ void recipient_list_add(RECIPIENT_LIST *list, long offset, list->info = (RECIPIENT *) myrealloc((char *) list->info, list->avail * sizeof(RECIPIENT)); } - list->info[list->len].orig_addr = orig_rcpt ? mystrdup(orig_rcpt) : 0; + list->info[list->len].orig_addr = mystrdup(orig_rcpt); list->info[list->len].address = mystrdup(rcpt); list->info[list->len].offset = offset; list->len++; @@ -113,8 +113,7 @@ void recipient_list_free(RECIPIENT_LIST *list) RECIPIENT *rcpt; for (rcpt = list->info; rcpt < list->info + list->len; rcpt++) { - if (rcpt->orig_addr) - myfree(rcpt->orig_addr); + myfree(rcpt->orig_addr); myfree(rcpt->address); } myfree((char *) list->info); diff --git a/postfix/src/nqmgr/qmgr_deliver.c b/postfix/src/nqmgr/qmgr_deliver.c index 38be3d2b6..759ab9fef 100644 --- a/postfix/src/nqmgr/qmgr_deliver.c +++ b/postfix/src/nqmgr/qmgr_deliver.c @@ -177,8 +177,7 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream) for (recipient = list.info; recipient < list.info + list.len; recipient++) attr_print(stream, ATTR_FLAG_MORE, ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, recipient->offset, - ATTR_TYPE_STR, MAIL_ATTR_ORCPT, - recipient->orig_rcpt ? recipient->orig_rcpt : "", + ATTR_TYPE_STR, MAIL_ATTR_ORCPT, recipient->orig_rcpt, ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient->address, ATTR_TYPE_END); attr_print(stream, ATTR_FLAG_NONE, diff --git a/postfix/src/nqmgr/qmgr_message.c b/postfix/src/nqmgr/qmgr_message.c index fae69c51c..a2e529805 100644 --- a/postfix/src/nqmgr/qmgr_message.c +++ b/postfix/src/nqmgr/qmgr_message.c @@ -402,7 +402,7 @@ static int qmgr_message_read(QMGR_MESSAGE *message) if (message->rcpt_list.len < recipient_limit) { message->rcpt_unread--; qmgr_rcpt_list_add(&message->rcpt_list, curr_offset, - orig_rcpt, start); + orig_rcpt ? orig_rcpt : "unknown", start); if (orig_rcpt) { myfree(orig_rcpt); orig_rcpt = 0; diff --git a/postfix/src/nqmgr/qmgr_rcpt_list.c b/postfix/src/nqmgr/qmgr_rcpt_list.c index 94287fade..9868c9fca 100644 --- a/postfix/src/nqmgr/qmgr_rcpt_list.c +++ b/postfix/src/nqmgr/qmgr_rcpt_list.c @@ -80,7 +80,7 @@ void qmgr_rcpt_list_add(QMGR_RCPT_LIST *list, long offset, list->info = (QMGR_RCPT *) myrealloc((char *) list->info, list->avail * sizeof(QMGR_RCPT)); } - list->info[list->len].orig_rcpt = (orcpt ? mystrdup(orcpt) : 0); + list->info[list->len].orig_rcpt = mystrdup(orcpt); list->info[list->len].address = mystrdup(rcpt); list->info[list->len].offset = offset; list->info[list->len].queue = 0; @@ -94,8 +94,7 @@ void qmgr_rcpt_list_free(QMGR_RCPT_LIST *list) QMGR_RCPT *rcpt; for (rcpt = list->info; rcpt < list->info + list->len; rcpt++) { - if (rcpt->orig_rcpt) - myfree(rcpt->orig_rcpt); + myfree(rcpt->orig_rcpt); myfree(rcpt->address); } myfree((char *) list->info); diff --git a/postfix/src/qmgr/qmgr_deliver.c b/postfix/src/qmgr/qmgr_deliver.c index 136b3dcb7..1986a0748 100644 --- a/postfix/src/qmgr/qmgr_deliver.c +++ b/postfix/src/qmgr/qmgr_deliver.c @@ -172,8 +172,7 @@ static int qmgr_deliver_send_request(QMGR_ENTRY *entry, VSTREAM *stream) for (recipient = list.info; recipient < list.info + list.len; recipient++) attr_print(stream, ATTR_FLAG_MORE, ATTR_TYPE_LONG, MAIL_ATTR_OFFSET, recipient->offset, - ATTR_TYPE_STR, MAIL_ATTR_ORCPT, - recipient->orig_rcpt ? recipient->orig_rcpt : "", + ATTR_TYPE_STR, MAIL_ATTR_ORCPT, recipient->orig_rcpt, ATTR_TYPE_STR, MAIL_ATTR_RECIP, recipient->address, ATTR_TYPE_END); attr_print(stream, ATTR_FLAG_NONE, diff --git a/postfix/src/qmgr/qmgr_message.c b/postfix/src/qmgr/qmgr_message.c index 91f70482f..6952a93c7 100644 --- a/postfix/src/qmgr/qmgr_message.c +++ b/postfix/src/qmgr/qmgr_message.c @@ -278,7 +278,7 @@ static int qmgr_message_read(QMGR_MESSAGE *message) #define FUDGE(x) ((x) * (var_qmgr_fudge / 100.0)) if (message->rcpt_list.len < FUDGE(var_qmgr_rcpt_limit)) { qmgr_rcpt_list_add(&message->rcpt_list, curr_offset, - orig_rcpt, start); + orig_rcpt ? orig_rcpt : "unknown", start); if (orig_rcpt) { myfree(orig_rcpt); orig_rcpt = 0; diff --git a/postfix/src/qmgr/qmgr_rcpt_list.c b/postfix/src/qmgr/qmgr_rcpt_list.c index 94287fade..9868c9fca 100644 --- a/postfix/src/qmgr/qmgr_rcpt_list.c +++ b/postfix/src/qmgr/qmgr_rcpt_list.c @@ -80,7 +80,7 @@ void qmgr_rcpt_list_add(QMGR_RCPT_LIST *list, long offset, list->info = (QMGR_RCPT *) myrealloc((char *) list->info, list->avail * sizeof(QMGR_RCPT)); } - list->info[list->len].orig_rcpt = (orcpt ? mystrdup(orcpt) : 0); + list->info[list->len].orig_rcpt = mystrdup(orcpt); list->info[list->len].address = mystrdup(rcpt); list->info[list->len].offset = offset; list->info[list->len].queue = 0; @@ -94,8 +94,7 @@ void qmgr_rcpt_list_free(QMGR_RCPT_LIST *list) QMGR_RCPT *rcpt; for (rcpt = list->info; rcpt < list->info + list->len; rcpt++) { - if (rcpt->orig_rcpt) - myfree(rcpt->orig_rcpt); + myfree(rcpt->orig_rcpt); myfree(rcpt->address); } myfree((char *) list->info); diff --git a/postfix/src/qmqpd/Makefile.in b/postfix/src/qmqpd/Makefile.in index 6b76ae51c..b7b9b8e96 100644 --- a/postfix/src/qmqpd/Makefile.in +++ b/postfix/src/qmqpd/Makefile.in @@ -117,4 +117,7 @@ qmqpd_state.o: ../../include/vbuf.h qmqpd_state.o: ../../include/vstring.h qmqpd_state.o: ../../include/mail_stream.h qmqpd_state.o: ../../include/cleanup_user.h +qmqpd_state.o: ../../include/mail_proto.h +qmqpd_state.o: ../../include/iostuff.h +qmqpd_state.o: ../../include/attr.h qmqpd_state.o: qmqpd.h diff --git a/postfix/src/qmqpd/qmqpd.c b/postfix/src/qmqpd/qmqpd.c index 60f42c08a..96dda4d4f 100644 --- a/postfix/src/qmqpd/qmqpd.c +++ b/postfix/src/qmqpd/qmqpd.c @@ -191,8 +191,7 @@ static void qmqpd_open_file(QMQPD_STATE *state) MAIL_CLASS_PUBLIC, var_cleanup_service); state->cleanup = state->dest->stream; state->queue_id = mystrdup(state->dest->id); - msg_info("%s: client=%s proto=%s", state->queue_id, - state->namaddr, state->protocol); + msg_info("%s: client=%s", state->queue_id, state->namaddr); /* * Record the time of arrival. Optionally, enable content filtering (not diff --git a/postfix/src/qmqpd/qmqpd_state.c b/postfix/src/qmqpd/qmqpd_state.c index 8e5b46c9c..6f0240d9e 100644 --- a/postfix/src/qmqpd/qmqpd_state.c +++ b/postfix/src/qmqpd/qmqpd_state.c @@ -47,6 +47,7 @@ #include #include +#include /* Application-specific. */ @@ -72,7 +73,7 @@ QMQPD_STATE *qmqpd_state_alloc(VSTREAM *stream) state->reason = 0; state->sender = 0; state->recipient = 0; - state->protocol = "QMQP"; + state->protocol = MAIL_PROTO_QMQP; state->where = "initializing client connection"; state->why_rejected = vstring_alloc(10); return (state); diff --git a/postfix/src/smtpd/Makefile.in b/postfix/src/smtpd/Makefile.in index 168cb0e93..1b98eb081 100644 --- a/postfix/src/smtpd/Makefile.in +++ b/postfix/src/smtpd/Makefile.in @@ -278,6 +278,9 @@ smtpd_state.o: ../../include/msg.h smtpd_state.o: ../../include/cleanup_user.h smtpd_state.o: ../../include/mail_params.h smtpd_state.o: ../../include/mail_error.h +smtpd_state.o: ../../include/mail_proto.h +smtpd_state.o: ../../include/iostuff.h +smtpd_state.o: ../../include/attr.h smtpd_state.o: smtpd.h smtpd_state.o: ../../include/vstring.h smtpd_state.o: ../../include/argv.h diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index ebdbd93e1..f6aa6f6d0 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -453,8 +453,6 @@ static int helo_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) smtpd_chat_reply(state, "501 Syntax: HELO hostname"); return (-1); } - if (state->helo_name != 0) - helo_reset(state); if (argc > 2) collapse_args(argc - 1, argv + 1); if (SMTPD_STAND_ALONE(state) == 0 @@ -463,8 +461,14 @@ static int helo_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) smtpd_chat_reply(state, "%s", err); return (-1); } + if (state->helo_name != 0) + helo_reset(state); + chat_reset(state, var_smtpd_hist_thrsh); + mail_reset(state); + rcpt_reset(state); state->helo_name = mystrdup(printable(argv[1].strval, '?')); - state->protocol = "SMTP"; + if (strcmp(state->protocol, MAIL_PROTO_ESMTP) != 0) + state->protocol = MAIL_PROTO_SMTP; smtpd_chat_reply(state, "250 %s", var_myhostname); return (0); } @@ -485,13 +489,6 @@ static int ehlo_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) smtpd_chat_reply(state, "501 Syntax: EHLO hostname"); return (-1); } - if (state->helo_name != 0) - helo_reset(state); -#ifndef RFC821_SYNTAX - chat_reset(state, var_smtpd_hist_thrsh); - mail_reset(state); - rcpt_reset(state); -#endif if (argc > 2) collapse_args(argc - 1, argv + 1); if (SMTPD_STAND_ALONE(state) == 0 @@ -500,8 +497,13 @@ static int ehlo_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) smtpd_chat_reply(state, "%s", err); return (-1); } + if (state->helo_name != 0) + helo_reset(state); + chat_reset(state, var_smtpd_hist_thrsh); + mail_reset(state); + rcpt_reset(state); state->helo_name = mystrdup(printable(argv[1].strval, '?')); - state->protocol = "ESMTP"; + state->protocol = MAIL_PROTO_ESMTP; smtpd_chat_reply(state, "250-%s", var_myhostname); smtpd_chat_reply(state, "250-PIPELINING"); if (var_message_limit) diff --git a/postfix/src/smtpd/smtpd_state.c b/postfix/src/smtpd/smtpd_state.c index 2887544ac..d7c6cadce 100644 --- a/postfix/src/smtpd/smtpd_state.c +++ b/postfix/src/smtpd/smtpd_state.c @@ -52,6 +52,7 @@ #include #include #include +#include /* Application-specific. */ @@ -86,7 +87,7 @@ void smtpd_state_init(SMTPD_STATE *state, VSTREAM *stream) state->sender = 0; state->recipient = 0; state->etrn_name = 0; - state->protocol = "SMTP"; + state->protocol = MAIL_PROTO_SMTP; state->where = SMTPD_AFTER_CONNECT; state->recursion = 0; state->msg_size = 0;