From c1e35cbf9238ba4e4aed38407f9a4e0334206c99 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Mon, 28 Mar 2005 00:00:00 -0500 Subject: [PATCH] postfix-2.3-20050328 --- postfix/ENHANCED_STATUS_README | 80 ++++----- postfix/HISTORY | 29 +-- postfix/RELEASE_NOTES | 58 +++--- postfix/html/discard.8.html | 2 +- postfix/html/error.8.html | 2 +- postfix/html/lmtp.8.html | 3 +- postfix/html/local.8.html | 242 +++++++++++++------------- postfix/html/pipe.8.html | 62 ++++--- postfix/html/postconf.5.html | 5 +- postfix/html/smtp.8.html | 3 +- postfix/html/smtpd.8.html | 3 +- postfix/man/man5/postconf.5 | 5 +- postfix/man/man8/discard.8 | 2 +- postfix/man/man8/error.8 | 2 +- postfix/man/man8/lmtp.8 | 3 +- postfix/man/man8/local.8 | 8 + postfix/man/man8/pipe.8 | 11 ++ postfix/man/man8/smtp.8 | 3 +- postfix/man/man8/smtpd.8 | 3 +- postfix/proto/postconf.proto | 5 +- postfix/src/discard/discard.c | 2 +- postfix/src/error/error.c | 2 +- postfix/src/global/Makefile.in | 49 ++++++ postfix/src/global/bounce.c | 2 +- postfix/src/global/cleanup_strerror.c | 2 +- postfix/src/global/cleanup_user.h | 2 +- postfix/src/global/defer.c | 2 +- postfix/src/global/deliver_request.c | 2 +- postfix/src/global/dsn_util.c | 24 +-- postfix/src/global/dsn_util.h | 4 +- postfix/src/global/log_adhoc.c | 2 +- postfix/src/global/mail_copy.c | 3 +- postfix/src/global/mail_params.h | 2 +- postfix/src/global/mail_version.h | 2 +- postfix/src/global/mbox_open.c | 40 +++-- postfix/src/global/mbox_open.h | 7 +- postfix/src/global/pipe_command.c | 2 +- postfix/src/global/sent.c | 2 +- postfix/src/global/sys_exits.c | 2 +- postfix/src/global/trace.c | 2 +- postfix/src/global/verify.c | 2 +- postfix/src/lmtp/lmtp.c | 3 +- postfix/src/local/Makefile.in | 2 + postfix/src/local/file.c | 3 +- postfix/src/local/local.c | 8 + postfix/src/local/mailbox.c | 2 +- postfix/src/local/maildir.c | 9 +- postfix/src/oqmgr/qmgr_bounce.c | 2 +- postfix/src/oqmgr/qmgr_defer.c | 2 +- postfix/src/pipe/pipe.c | 9 + postfix/src/postlock/postlock.c | 2 +- postfix/src/qmgr/qmgr_bounce.c | 2 +- postfix/src/qmgr/qmgr_defer.c | 2 +- postfix/src/smtp/smtp.c | 3 +- postfix/src/smtp/smtp_proto.c | 2 +- postfix/src/smtpd/smtpd.c | 11 +- postfix/src/smtpd/smtpd_check.c | 4 +- postfix/src/virtual/Makefile.in | 2 + postfix/src/virtual/mailbox.c | 2 +- postfix/src/virtual/maildir.c | 15 +- 60 files changed, 469 insertions(+), 304 deletions(-) diff --git a/postfix/ENHANCED_STATUS_README b/postfix/ENHANCED_STATUS_README index 73451f377..684591e48 100644 --- a/postfix/ENHANCED_STATUS_README +++ b/postfix/ENHANCED_STATUS_README @@ -1,46 +1,31 @@ Postfix enhanced status code implementation notes ================================================= -Enhanced status code support is implemented in stages. In the first -stage, the goal is to minimize code changes (it's several hundred -pages of context diffs already). For this reason, the pre-existing -status variables (success, defer, etc.) are not updated atomically -with the enhanced status code; instead, enhanced status codes are -updated separately. This means one has to be careful when making -updates to the code, so that things won't go out of sync. +RFC 3463 Enhanced status code support is implemented in stages. In +the first stage, the goal is to minimize code changes (it's several +hundred pages of context diffs already). For this reason, the +pre-existing status variables (success, defer, etc.) are still +updated separately from the diagnostic text and the RFC 3463 enhanced +status code. All this means that one has to be careful when updating +the code, to keep things in sync. Specific issues that one should be aware of: -- In the SMTP client, either update the enhanced status code and -text whenever smtp_errno or resp->code are updated, or place an -explicit comment that no update is needed. +- In the SMTP client, update the enhanced status code and text +whenever smtp_errno or resp->code are updated, or place an explicit +comment that says no update is needed. -- In the SMTP client, don't worry about the first enhanced status +- In the SMTP client, don't worry about the initial enhanced status digit when reporting failure to look up or connect to a host. For convenience, the SMTP client top-level code automatically changes -it into '4' or '5' as appropriate. +the initial digit into '4' or '5' as appropriate. -- The above two points also apply to the LMTP client; this delivery -agent is on life support until its functionality is merged with the -SMTP client. +- The above two points also apply to the LMTP client. -- In the SMTP server, don't worry about the first enhanced status -digit when a restriction rejects access. For convenience, the -smtpd_check_reject() routine automatically changes it into '4' or -'5' as appropriate. - -- The pipe, local and virtual delivery agents never update the -diagnostic text without also updating the enhanced status code. The -main chore here is to choose appropriate enhanced status codes. - -- Don't rely on the system errno value after calling a routine that -updates the enhanced status code upon failure. Use the enhanced -status code (and diagnostic text) instead. Currently there are two -exceptions to this rule: mail_copy() for historical reasons may or -may not return explicit error reports (fixing this requires that -pipe_command() be restructured); and the maildir delivery routines -log a helpful warning when delivery fails with EACCES. This just -happens to work because maildir needs no file locking. +- In the SMTP server, don't worry about the initial enhanced status +code digit when an smtpd_mumble_restriction rejects access. For +convenience, the smtpd_check_reject() routine automatically changes +the initial digit into '4' or '5' as appropriate. - Some low-level support routines update the diagnostic text but not the enhanced status code. To identify these, search for functions @@ -48,14 +33,29 @@ that are called with why->vstring as output parameter, and make sure that the caller updates the enhanced status code in all appropriate cases. +- By design, the pipe, local and virtual delivery agent code never +update the diagnostic text separately from the enhanced status code. + +- Don't rely on the system errno value after calling a routine that +performs or prepares for mail delivery. Instead, have that routine +update the enhanced status code (and text) when the error happens. +This was an issue with mailbox, maildir and file delivery. Currently +there remain two exceptions to this rule: mail_copy() for historical +reasons may or may not return explicit error reports (fixing this +requires that pipe_command() be restructured); and the maildir +delivery routines log a helpful warning when delivery fails with +EACCES. The latter happens to work because mbox_open() does not +need to unlock the output file, so it won't clobber the errno value. + - Avoid passing around strings that combine enhanced status code and diagnostic text, because the compiler can't help to enforce -consistency. Currently there are two exceptions to this rule: the -cleanup server status reply, and the delivery agent status reply. -Once these protocols are updated we can remove the dns_prepend() -routine. +that everything has a status code. Currently there are two exceptions +to this rule: the cleanup server status reply, and the delivery +agent status reply. Once these protocols are updated we can remove +the dns_prepend() routine. The third exception, enhanced status +codes in external command output, is a feature. -- The bounce/defer/sent modules will catch the cases where an -enhanced status code does not match the reject/defer/success status. -These discrepancies are logged as a warning, and the enhanced status -code is replaced by a generic one. +- The bounce/defer/sent library modules will catch the cases where +an enhanced status code does not match the reject/defer/success +status. They log a warning message, and replace the incorrect +enhanced status code by a generic one. diff --git a/postfix/HISTORY b/postfix/HISTORY index 7cc78da8e..22219e598 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -10487,7 +10487,7 @@ Apologies for any names omitted. 20050321-27 - Support for RFC 1893 enhanced status codes. See also the + Support for RFC 3463 enhanced status codes. See also the ENHANCED_STATUS_README file for background. New module to pass around (status code + text) instead of @@ -10497,13 +10497,14 @@ Apologies for any names omitted. enhanced status codes. Files: global/sys_exits.c, global/cleanup_strerror.c. - Incompatible change: centralized mapping of errno values - to delivery status codes after failed delivery to mailbox, - maildir, or file. Error codes EACCES, EAGAIN, ESTALE are - 4.2.0 temporary errors, ENOSPC is a 4.3.0 temporary error, - EDQUOT and EFBIG are 5.2.2 hard errors, and everything else - is a 5.2.0 hard error. This means that local(8) will bounce - less mail, while virtual(8) will defer less mail. File: + Cleanup: centralized mapping of errno values to delivery + status codes after failed delivery to mailbox, maildir, or + file. Error codes EAGAIN, and ESTALE are 4.2.0 temporary + errors; ENOSPC is a 4.3.0 temporary error; and EDQUOT and + EFBIG are 5.2.2 hard errors. For backwards compatibility, + the result of other errors depends on the delivery agent: + with local(8) everything else is a 5.2.0 hard error, and + with virtual(8) everything else is soft 4.2.0 error. File: global/mbox_open.c. 20050324 @@ -10534,13 +10535,19 @@ Apologies for any names omitted. 20050327 - Bugfix: the SMTP client did not ask the queue manager to - reduce destination concurrency after a "lost connection" - or "connection timed out" errror. File: smtp/smtp_trouble.c. + Bugfix: the SMTP and LMTP clients did not ask the queue + manager to reduce destination concurrency when "lost + connection" or "connection timed out" happened AFTER Postfix + received the server greeting. Files: smtp/smtp_trouble.c, + lmtp/lmtp-trouble.c. Workaround: FreeBSD has incompatibly changed the output format from "od", breaking regression test portability. + The TLS client session cache ID is now derived from the + server IP address, TCP Port, and server HELO hostname + if available. File: smtp/smtp_proto.c. + Open problems: Med: disable header address rewriting after XCLIENT? diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 63b26e4a5..5f1fcb08d 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -11,38 +11,48 @@ instead, a new snapshot is released. The mail_release_date configuration parameter (format: yyyymmdd) specifies the release date of a stable release or snapshot release. -See RELEASE_NOTES-2.2 for changes introduced during the development -of Postfix version 2.2. +Incompatibility with Postfix 2.1 and earlier +============================================ -Incompatible changes with snapshot 20050327 -=========================================== +If you upgrade from Postfix 2.1 or earlier, read RELEASE_NOTES-2.2 +before proceeding. -local(8) and virtual(8) now handle the same errors in the same way. -This means that local(8) will defer some mail that it older versions -would bounce, and that virtual(8) will bounce some mail that older -versions would defer. +Incompatibility with snapshot 20050328 +====================================== -Specifically, error codes EACCES, EAGAIN, ESTALE are soft (4.2.0) -errors, ENOSPC is a soft (4.3.0) error, EDQUOT and EFBIG are hard -(5.2.2) errors, and everything else is a hard (5.2.0) error. +After you upgrade from Postfix 2.2 or 2.3 you need to execute +"postfix reload", otherwise you will keep running the old Postfix +queue manager, which gives no special treatment to the enhanced +status codes that it receives from Postfix delivery agents. -Major changes with snapshot 20050327 +Major changes with snapshot 20050328 ==================================== -This release introduces support for RFC 1893 enhanced status codes. -For example, status code "5.1.1" means "recipient unknown". Postfix -recognizes enhanced status codes in remote server replies, and -generates enhanced status codes when it responds to mail delivery -requests. This improves the communication with mail clients that -hide error messages from users. +This release introduces support for RFC 3463 enhanced status codes. +For example, status code 5.1.1 means "recipient unknown". Postfix +recognizes enhanced status codes in remote server replies, generates +enhanced status codes while handling email, and reports enhanced +status codes in non-delivery notifications. This improves the user +interaction with mail clients that hide the text of error messages +from users. -You can, but don't have to, specify RFC 1893 enhanced status codes -in Postfix access maps or header/body_checks. Example: +You can, but don't have to, specify RFC 3463 enhanced status codes +in the output from commands that receive mail from a pipe. If a +command terminates with non-zero exit status, and an enhanced status +code is present at the beginning of the command output, then that +status code takes precedence over the non-zero exit status. + +You can, but don't have to, specify RFC 3463 enhanced status codes +in Postfix access maps, header/body_checks REJECT actions, or in +RBL replies. For example: REJECT 5.7.1 You can't go here from there -(5.7.1 means "no authorization, message refused"). Enhanced status -code support is also available in RBL reply templates. +The status 5.7.1 means "no authorization, message refused", and is +the default for access maps, header/body_checks REJECT actions, and +for RBL replies. -If you do specify an enhanced status code, Postfix will automatically -change the first digit into a '4' or '5' as appropriate. +If you specify your own enhanced status code, the Postfix SMTP +server will automatically change a leading '5' digit (hard error) +into '4' where appropriate. This is needed, for example, with +soft_bounce=yes. diff --git a/postfix/html/discard.8.html b/postfix/html/discard.8.html index 29a314943..1106eba20 100644 --- a/postfix/html/discard.8.html +++ b/postfix/html/discard.8.html @@ -18,7 +18,7 @@ DISCARD(8) DISCARD(8) queue file, a sender address, a domain or host name that is treated as the reason for discarding the mail, and recipient information. The reason may be prefixed with an - RFC 1893-compatible detail code. This program expects to + RFC 3463-compatible detail code. This program expects to be run from the master(8) process manager. The discard(8) delivery agent pretends to deliver all diff --git a/postfix/html/error.8.html b/postfix/html/error.8.html index cc17b3488..ab31a7d5a 100644 --- a/postfix/html/error.8.html +++ b/postfix/html/error.8.html @@ -18,7 +18,7 @@ ERROR(8) ERROR(8) queue file, a sender address, a domain or host name that is treated as the reason for non-delivery, and recipient information. The reason may be prefixed with an RFC - 1893-compatible detail code. This program expects to be + 3463-compatible detail code. This program expects to be run from the master(8) process manager. The error(8) delivery agent bounces all recipients in the diff --git a/postfix/html/lmtp.8.html b/postfix/html/lmtp.8.html index 2a36548b9..df7235987 100644 --- a/postfix/html/lmtp.8.html +++ b/postfix/html/lmtp.8.html @@ -63,10 +63,11 @@ LMTP(8) LMTP(8) RFC 1652 (8bit-MIME transport) RFC 1870 (Message Size Declaration) RFC 2033 (LMTP protocol) - RFC 2034 (Enhanced Error Codes) + RFC 2034 (Enhanced Status codes) RFC 2554 (AUTH command) RFC 2821 (SMTP protocol) RFC 2920 (SMTP Pipelining) + RFC 3463 (Enhanced Status codes) DIAGNOSTICS Problems and transactions are logged to syslogd(8). Cor- diff --git a/postfix/html/local.8.html b/postfix/html/local.8.html index c7c0f03c7..35990ec06 100644 --- a/postfix/html/local.8.html +++ b/postfix/html/local.8.html @@ -172,10 +172,17 @@ LOCAL(8) LOCAL(8) ery status reports. A command is forcibly terminated if it does not complete within command_time_limit seconds. Command exit status codes are expected to follow the con- - ventions defined in <sysexits.h>. + ventions defined in <sysexits.h>. Exit status 0 means + normal successful completion. - A limited amount of message context is exported via envi- - ronment variables. Characters that may have special mean- + Postfix version 2.3 and later support RFC 3463-style + enhanced status codes. If a command terminates with a + non-zero exit status, and the command output begins with + an enhanced status code, this status code takes precedence + over the non-zero exit status. + + A limited amount of message context is exported via envi- + ronment variables. Characters that may have special mean- ing to the shell are replaced by underscores. The list of acceptable characters is specified with the command_expan- sion_filter configuration parameter. @@ -206,97 +213,97 @@ LOCAL(8) LOCAL(8) the following environment variables: CLIENT_ADDRESS - Remote client network address. Available as of + Remote client network address. Available as of Postfix 2.2. CLIENT_HELO - Remote client EHLO command parameter. Available as + Remote client EHLO command parameter. Available as of Postfix 2.2. CLIENT_HOSTNAME - Remote client hostname. Available as of Postfix + Remote client hostname. Available as of Postfix 2.2. CLIENT_PROTOCOL - Remote client protocol. Available as of Postfix + Remote client protocol. Available as of Postfix 2.2. SASL_METHOD - SASL authentication method specified in the remote + SASL authentication method specified in the remote client AUTH command. Available as of Postfix 2.2. SASL_SENDER - SASL sender address specified in the remote client + SASL sender address specified in the remote client MAIL FROM command. Available as of Postfix 2.2. SASL_USERNAME - SASL username specified in the remote client AUTH + SASL username specified in the remote client AUTH command. Available as of Postfix 2.2. The PATH environment variable is always reset to a system- - dependent default path, and environment variables whose - names are blessed by the export_environment configuration + dependent default path, and environment variables whose + names are blessed by the export_environment configuration parameter are exported unchanged. The current working directory is the mail queue directory. - The local(8) daemon prepends a "From sender time_stamp" - envelope header to each message, prepends an X-Original- + The local(8) daemon prepends a "From sender time_stamp" + envelope header to each message, prepends an X-Original- To: header with the recipient address as given to Postfix, - prepends an optional Delivered-To: header with the final + prepends an optional Delivered-To: header with the final recipient envelope address, prepends a Return-Path: header - with the sender envelope address, and appends no empty + with the sender envelope address, and appends no empty line. EXTERNAL FILE DELIVERY - The delivery format depends on the destination filename - syntax. The default is to use UNIX-style mailbox format. - Specify a name ending in / for qmail-compatible maildir + The delivery format depends on the destination filename + syntax. The default is to use UNIX-style mailbox format. + Specify a name ending in / for qmail-compatible maildir delivery. - The allow_mail_to_files configuration parameter restricts - delivery to external files. The default setting (alias, + The allow_mail_to_files configuration parameter restricts + delivery to external files. The default setting (alias, forward) forbids file destinations in :include: files. - In the case of UNIX-style mailbox delivery, the local(8) + In the case of UNIX-style mailbox delivery, the local(8) daemon prepends a "From sender time_stamp" envelope header - to each message, prepends an X-Original-To: header with - the recipient address as given to Postfix, prepends an - optional Delivered-To: header with the final recipient - envelope address, prepends a > character to lines begin- - ning with "From ", and appends an empty line. The enve- - lope sender address is available in the Return-Path: - header. When the destination is a regular file, it is + to each message, prepends an X-Original-To: header with + the recipient address as given to Postfix, prepends an + optional Delivered-To: header with the final recipient + envelope address, prepends a > character to lines begin- + ning with "From ", and appends an empty line. The enve- + lope sender address is available in the Return-Path: + header. When the destination is a regular file, it is locked for exclusive access while delivery is in progress. In case of problems, an attempt is made to truncate a reg- ular file to its original length. In the case of maildir delivery, the local daemon prepends - an optional Delivered-To: header with the final envelope - recipient address, and prepends an X-Original-To: header + an optional Delivered-To: header with the final envelope + recipient address, and prepends an X-Original-To: header with the recipient address as given to Postfix. The enve- - lope sender address is available in the Return-Path: + lope sender address is available in the Return-Path: header. ADDRESS EXTENSION - The optional recipient_delimiter configuration parameter - specifies how to separate address extensions from local + The optional recipient_delimiter configuration parameter + specifies how to separate address extensions from local recipient names. - For example, with "recipient_delimiter = +", mail for - name+foo is delivered to the alias name+foo or to the - alias name, to the destinations listed in ~name/.for- + For example, with "recipient_delimiter = +", mail for + name+foo is delivered to the alias name+foo or to the + alias name, to the destinations listed in ~name/.for- ward+foo or in ~name/.forward, to the mailbox owned by the user name, or it is sent back as undeliverable. - In all cases the local(8) daemon prepends an optional - `Delivered-To: header line with the final recipient + In all cases the local(8) daemon prepends an optional + `Delivered-To: header line with the final recipient address. DELIVERY RIGHTS - Deliveries to external files and external commands are + Deliveries to external files and external commands are made with the rights of the receiving user on whose behalf - the delivery is made. In the absence of a user context, + the delivery is made. In the absence of a user context, the local(8) daemon uses the owner rights of the :include: file or alias database. When those files are owned by the superuser, delivery is made with the rights specified with @@ -304,50 +311,51 @@ LOCAL(8) LOCAL(8) STANDARDS RFC 822 (ARPA Internet Text Messages) + RFC 3463 (Enhanced status codes) DIAGNOSTICS - Problems and transactions are logged to syslogd(8). Cor- - rupted message files are marked so that the queue manager + Problems and transactions are logged to syslogd(8). Cor- + rupted message files are marked so that the queue manager can move them to the corrupt queue afterwards. - Depending on the setting of the notify_classes parameter, - the postmaster is notified of bounces and of other trou- + Depending on the setting of the notify_classes parameter, + the postmaster is notified of bounces and of other trou- ble. SECURITY The local(8) delivery agent needs a dual personality 1) to access the private Postfix queue and IPC mechanisms, 2) to - impersonate the recipient and deliver to recipient-speci- - fied files or commands. It is therefore security sensi- + impersonate the recipient and deliver to recipient-speci- + fied files or commands. It is therefore security sensi- tive. - The local(8) delivery agent disallows regular expression - substitution of $1 etc. in alias_maps, because that would + The local(8) delivery agent disallows regular expression + substitution of $1 etc. in alias_maps, because that would open a security hole. - The local(8) delivery agent will silently ignore requests - to use the proxymap(8) server within alias_maps. Instead - it will open the table directly. Before Postfix version - 2.2, the local(8) delivery agent will terminate with a + The local(8) delivery agent will silently ignore requests + to use the proxymap(8) server within alias_maps. Instead + it will open the table directly. Before Postfix version + 2.2, the local(8) delivery agent will terminate with a fatal error. BUGS - For security reasons, the message delivery status of - external commands or of external files is never check- + For security reasons, the message delivery status of + external commands or of external files is never check- pointed to file. As a result, the program may occasionally deliver more than once to a command or external file. Bet- ter safe than sorry. - Mutually-recursive aliases or ~/.forward files are not - detected early. The resulting mail forwarding loop is + Mutually-recursive aliases or ~/.forward files are not + detected early. The resulting mail forwarding loop is broken by the use of the Delivered-To: message header. CONFIGURATION PARAMETERS - Changes to main.cf are picked up automatically, as - local(8) processes run for only a limited amount of time. + Changes to main.cf are picked up automatically, as + local(8) processes run for only a limited amount of time. Use the command "postfix reload" to speed up a change. - The text below provides only a parameter summary. See + The text below provides only a parameter summary. See postconf(5) for more details including examples. COMPATIBILITY CONTROLS @@ -357,59 +365,59 @@ LOCAL(8) LOCAL(8) expand_owner_alias (no) When delivering to an alias "aliasname" that has an "owner-aliasname" companion alias, set the envelope - sender address to the expansion of the "owner- + sender address to the expansion of the "owner- aliasname" alias. owner_request_special (yes) - Give special treatment to owner-listname and list- - name-request address localparts: don't split such - addresses when the recipient_delimiter is set to + Give special treatment to owner-listname and list- + name-request address localparts: don't split such + addresses when the recipient_delimiter is set to "-". sun_mailtool_compatibility (no) Obsolete SUN mailtool compatibility feature. DELIVERY METHOD CONTROLS - The precedence of local(8) delivery methods from high to - low is: aliases, .forward files, mailbox_transport, mail- + The precedence of local(8) delivery methods from high to + low is: aliases, .forward files, mailbox_transport, mail- box_command_maps, mailbox_command, home_mailbox, - mail_spool_directory, fallback_transport and luser_relay. + mail_spool_directory, fallback_transport and luser_relay. alias_maps (see 'postconf -d' output) - The alias databases that are used for local(8) + The alias databases that are used for local(8) delivery. forward_path (see 'postconf -d' output) The local(8) delivery agent search list for finding - a .forward file with user-specified delivery meth- + a .forward file with user-specified delivery meth- ods. mailbox_transport (empty) - Optional message delivery transport that the - local(8) delivery agent should use for mailbox - delivery to all local recipients, whether or not + Optional message delivery transport that the + local(8) delivery agent should use for mailbox + delivery to all local recipients, whether or not they are found in the UNIX passwd database. mailbox_command_maps (empty) - Optional lookup tables with per-recipient external + Optional lookup tables with per-recipient external commands to use for local(8) mailbox delivery. mailbox_command (empty) - Optional external command that the local(8) deliv- + Optional external command that the local(8) deliv- ery agent should use for mailbox delivery. home_mailbox (empty) - Optional pathname of a mailbox file relative to a + Optional pathname of a mailbox file relative to a local(8) user's home directory. mail_spool_directory (see 'postconf -d' output) - The directory where local(8) UNIX-style mailboxes + The directory where local(8) UNIX-style mailboxes are kept. fallback_transport (empty) - Optional message delivery transport that the - local(8) delivery agent should use for names that - are not found in the aliases(5) database or in the + Optional message delivery transport that the + local(8) delivery agent should use for names that + are not found in the aliases(5) database or in the UNIX passwd database. luser_relay (empty) @@ -419,7 +427,7 @@ LOCAL(8) LOCAL(8) Available in Postfix version 2.2 and later: command_execution_directory (empty) - The local(8) delivery agent working directory for + The local(8) delivery agent working directory for delivery to external command. MAILBOX LOCKING CONTROLS @@ -428,15 +436,15 @@ LOCAL(8) LOCAL(8) sive lock on a mailbox file or bounce(8) logfile. deliver_lock_delay (1s) - The time between attempts to acquire an exclusive + The time between attempts to acquire an exclusive lock on a mailbox file or bounce(8) logfile. stale_lock_time (500s) - The time after which a stale exclusive mailbox + The time after which a stale exclusive mailbox lockfile is removed. mailbox_delivery_lock (see 'postconf -d' output) - How to lock a UNIX-style local(8) mailbox before + How to lock a UNIX-style local(8) mailbox before attempting delivery. RESOURCE AND RATE CONTROLS @@ -444,17 +452,17 @@ LOCAL(8) LOCAL(8) Time limit for delivery to external commands. duplicate_filter_limit (1000) - The maximal number of addresses remembered by the - address duplicate filter for aliases(5) or vir- + The maximal number of addresses remembered by the + address duplicate filter for aliases(5) or vir- tual(5) alias expansion, or for showq(8) queue dis- plays. local_destination_concurrency_limit (2) - The maximal number of parallel deliveries via the + The maximal number of parallel deliveries via the local mail delivery transport to the same recipient - (when "local_destination_recipient_limit = 1") or - the maximal number of parallel deliveries to the - same local domain (when "local_destination_recipi- + (when "local_destination_recipient_limit = 1") or + the maximal number of parallel deliveries to the + same local domain (when "local_destination_recipi- ent_limit > 1"). local_destination_recipient_limit (1) @@ -467,45 +475,45 @@ LOCAL(8) LOCAL(8) SECURITY CONTROLS allow_mail_to_commands (alias, forward) - Restrict local(8) mail delivery to external com- + Restrict local(8) mail delivery to external com- mands. allow_mail_to_files (alias, forward) - Restrict local(8) mail delivery to external files. + Restrict local(8) mail delivery to external files. command_expansion_filter (see 'postconf -d' output) - Restrict the characters that the local(8) delivery - agent allows in $name expansions of $mailbox_com- + Restrict the characters that the local(8) delivery + agent allows in $name expansions of $mailbox_com- mand. default_privs (nobody) - The default rights used by the local(8) delivery + The default rights used by the local(8) delivery agent for delivery to external file or command. forward_expansion_filter (see 'postconf -d' output) - Restrict the characters that the local(8) delivery - agent allows in $name expansions of $forward_path. + Restrict the characters that the local(8) delivery + agent allows in $name expansions of $forward_path. Available in Postfix version 2.2 and later: execution_directory_expansion_filter (see 'postconf -d' output) - Restrict the characters that the local(8) delivery + Restrict the characters that the local(8) delivery agent allows in $name expansions of $command_execu- tion_directory. MISCELLANEOUS CONTROLS config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and + The default location of the Postfix main.cf and master.cf configuration files. daemon_timeout (18000s) - How much time a Postfix daemon process may take to - handle a request before it is terminated by a + How much time a Postfix daemon process may take to + handle a request before it is terminated by a built-in watchdog timer. export_environment (see 'postconf -d' output) - The list of environment variables that a Postfix + The list of environment variables that a Postfix process will export to non-Postfix processes. ipc_timeout (3600s) @@ -513,37 +521,37 @@ LOCAL(8) LOCAL(8) over an internal communication channel. local_command_shell (empty) - Optional shell program for local(8) delivery to + Optional shell program for local(8) delivery to non-Postfix command. max_idle (100s) - The maximum amount of time that an idle Postfix - daemon process waits for the next service request + The maximum amount of time that an idle Postfix + daemon process waits for the next service request before exiting. max_use (100) - The maximal number of connection requests before a + The maximal number of connection requests before a Postfix daemon process terminates. prepend_delivered_header (command, file, forward) - The message delivery contexts where the Postfix - local(8) delivery agent prepends a Delivered-To: + The message delivery contexts where the Postfix + local(8) delivery agent prepends a Delivered-To: message header. process_id (read-only) - The process ID of a Postfix command or daemon + The process ID of a Postfix command or daemon process. process_name (read-only) - The process name of a Postfix command or daemon + The process name of a Postfix command or daemon process. propagate_unmatched_extensions (canonical, virtual) - What address lookup tables copy an address exten- + What address lookup tables copy an address exten- sion from the lookup key to the lookup result. queue_directory (see 'postconf -d' output) - The location of the Postfix top-level queue direc- + The location of the Postfix top-level queue direc- tory. recipient_delimiter (empty) @@ -551,15 +559,15 @@ LOCAL(8) LOCAL(8) sions (user+foo). require_home_directory (no) - Whether or not a local(8) recipient's home direc- - tory must exist before mail delivery is attempted. + Whether or not a local(8) recipient's home direc- + tory must exist before mail delivery is attempted. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (postfix) - The mail system name that is prepended to the - process name in syslog records, so that "smtpd" + The mail system name that is prepended to the + process name in syslog records, so that "smtpd" becomes, for example, "postfix/smtpd". FILES @@ -579,14 +587,14 @@ LOCAL(8) LOCAL(8) syslogd(8), system logging LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. HISTORY The Delivered-To: message header appears in the qmail sys- tem by Daniel Bernstein. - The maildir structure appears in the qmail system by + The maildir structure appears in the qmail system by Daniel Bernstein. AUTHOR(S) diff --git a/postfix/html/pipe.8.html b/postfix/html/pipe.8.html index ae506d962..80d3d65a8 100644 --- a/postfix/html/pipe.8.html +++ b/postfix/html/pipe.8.html @@ -272,61 +272,71 @@ PIPE(8) PIPE(8) This information is modified by the u flag for case folding. +STANDARDS + RFC 3463 (Enhanced status codes) + DIAGNOSTICS Command exit status codes are expected to follow the con- - ventions defined in <sysexits.h>. + ventions defined in <sysexits.h>. Exit status 0 means + normal successful completion. - Problems and transactions are logged to syslogd(8). Cor- - rupted message files are marked so that the queue manager + Postfix version 2.3 and later support RFC 3463-style + enhanced status codes. If a command terminates with a + non-zero exit status, and the command output begins with + an enhanced status code, this status code takes precedence + over the non-zero exit status. + + Problems and transactions are logged to syslogd(8). Cor- + rupted message files are marked so that the queue manager can move them to the corrupt queue for further inspection. SECURITY - This program needs a dual personality 1) to access the - private Postfix queue and IPC mechanisms, and 2) to exe- + This program needs a dual personality 1) to access the + private Postfix queue and IPC mechanisms, and 2) to exe- cute external commands as the specified user. It is there- fore security sensitive. CONFIGURATION PARAMETERS - Changes to main.cf are picked up automatically as pipe(8) - processes run for only a limited amount of time. Use the + Changes to main.cf are picked up automatically as pipe(8) + processes run for only a limited amount of time. Use the command "postfix reload" to speed up a change. - The text below provides only a parameter summary. See + The text below provides only a parameter summary. See postconf(5) for more details including examples. RESOURCE AND RATE CONTROLS - In the text below, transport is the first field in a mas- + In the text below, transport is the first field in a mas- ter.cf entry. transport_destination_concurrency_limit ($default_destina- tion_concurrency_limit) Limit the number of parallel deliveries to the same - destination, for delivery via the named transport. + destination, for delivery via the named transport. The limit is enforced by the Postfix queue manager. transport_destination_recipient_limit ($default_destina- tion_recipient_limit) - Limit the number of recipients per message deliv- - ery, for delivery via the named transport. The + Limit the number of recipients per message deliv- + ery, for delivery via the named transport. The limit is enforced by the Postfix queue manager. transport_time_limit ($command_time_limit) - Limit the time for delivery to external command, + Limit the time for delivery to external command, for delivery via the named transport. The limit is enforced by the pipe delivery agent. MISCELLANEOUS CONTROLS config_directory (see 'postconf -d' output) - The default location of the Postfix main.cf and + The default location of the Postfix main.cf and master.cf configuration files. daemon_timeout (18000s) - How much time a Postfix daemon process may take to - handle a request before it is terminated by a + How much time a Postfix daemon process may take to + handle a request before it is terminated by a built-in watchdog timer. export_environment (see 'postconf -d' output) - The list of environment variables that a Postfix + The list of environment variables that a Postfix process will export to non-Postfix processes. ipc_timeout (3600s) @@ -338,24 +348,24 @@ PIPE(8) PIPE(8) and most Postfix daemon processes. max_idle (100s) - The maximum amount of time that an idle Postfix - daemon process waits for the next service request + The maximum amount of time that an idle Postfix + daemon process waits for the next service request before exiting. max_use (100) - The maximal number of connection requests before a + The maximal number of connection requests before a Postfix daemon process terminates. process_id (read-only) - The process ID of a Postfix command or daemon + The process ID of a Postfix command or daemon process. process_name (read-only) - The process name of a Postfix command or daemon + The process name of a Postfix command or daemon process. queue_directory (see 'postconf -d' output) - The location of the Postfix top-level queue direc- + The location of the Postfix top-level queue direc- tory. recipient_delimiter (empty) @@ -366,8 +376,8 @@ PIPE(8) PIPE(8) The syslog facility of Postfix logging. syslog_name (postfix) - The mail system name that is prepended to the - process name in syslog records, so that "smtpd" + The mail system name that is prepended to the + process name in syslog records, so that "smtpd" becomes, for example, "postfix/smtpd". SEE ALSO @@ -379,7 +389,7 @@ PIPE(8) PIPE(8) syslogd(8), system logging LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 71800a22c..e3803a1d9 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -1710,7 +1710,10 @@ address, or Recipient address.
$rbl_code
The numerical SMTP response code, as specified with the -maps_rbl_reject_code configuration parameter.
+maps_rbl_reject_code configuration parameter. Note: The numerical +SMTP response code is required, and must appear at the start of the +reply. With Postfix 2.3 and later this information may be followed +by an RFC 3463 enhanced status code.
$rbl_domain
diff --git a/postfix/html/smtp.8.html b/postfix/html/smtp.8.html index 6d2f13dc8..3c3e391bc 100644 --- a/postfix/html/smtp.8.html +++ b/postfix/html/smtp.8.html @@ -56,12 +56,13 @@ SMTP(8) SMTP(8) RFC 1652 (8bit-MIME transport) RFC 1870 (Message Size Declaration) RFC 2045 (MIME: Format of Internet Message Bodies) - RFC 2034 (Enhanced Error Codes) + RFC 2034 (Enhanced Status Codes) RFC 2046 (MIME: Media Types) RFC 2554 (AUTH command) RFC 2821 (SMTP protocol) RFC 2920 (SMTP Pipelining) RFC 3207 (STARTTLS command) + RFC 3463 (Enhanced Status Codes) DIAGNOSTICS Problems and transactions are logged to syslogd(8). Cor- diff --git a/postfix/html/smtpd.8.html b/postfix/html/smtpd.8.html index 7eedc495c..358c99562 100644 --- a/postfix/html/smtpd.8.html +++ b/postfix/html/smtpd.8.html @@ -43,11 +43,12 @@ SMTPD(8) SMTPD(8) RFC 1869 (SMTP service extensions) RFC 1870 (Message Size Declaration) RFC 1985 (ETRN command) - RFC 2034 (Enhanced Error Codes) + RFC 2034 (Enhanced Status Codes) RFC 2554 (AUTH command) RFC 2821 (SMTP protocol) RFC 2920 (SMTP Pipelining) RFC 3207 (STARTTLS command) + RFC 3463 (Enhanced Status Codes) DIAGNOSTICS Problems and transactions are logged to syslogd(8). diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 4e3570cd5..73a89278e 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -929,7 +929,10 @@ The blacklisted entity type: Client host, Helo command, Sender address, or Recipient address. .IP "\fB$rbl_code\fR" The numerical SMTP response code, as specified with the -maps_rbl_reject_code configuration parameter. +maps_rbl_reject_code configuration parameter. Note: The numerical +SMTP response code is required, and must appear at the start of the +reply. With Postfix 2.3 and later this information may be followed +by an RFC 3463 enhanced status code. .IP "\fB$rbl_domain\fR" The RBL domain where $rbl_what is blacklisted. .IP "\fB$rbl_reason\fR" diff --git a/postfix/man/man8/discard.8 b/postfix/man/man8/discard.8 index 215ee975d..1ede41979 100644 --- a/postfix/man/man8/discard.8 +++ b/postfix/man/man8/discard.8 @@ -17,7 +17,7 @@ delivery requests from the queue manager. Each request specifies a queue file, a sender address, a domain or host name that is treated as the reason for discarding the mail, and recipient information. -The reason may be prefixed with an RFC 1893-compatible detail code. +The reason may be prefixed with an RFC 3463-compatible detail code. This program expects to be run from the \fBmaster\fR(8) process manager. diff --git a/postfix/man/man8/error.8 b/postfix/man/man8/error.8 index a0f0b996f..6f10a5007 100644 --- a/postfix/man/man8/error.8 +++ b/postfix/man/man8/error.8 @@ -17,7 +17,7 @@ requests from the queue manager. Each request specifies a queue file, a sender address, a domain or host name that is treated as the reason for non-delivery, and recipient information. -The reason may be prefixed with an RFC 1893-compatible detail code. +The reason may be prefixed with an RFC 3463-compatible detail code. This program expects to be run from the \fBmaster\fR(8) process manager. diff --git a/postfix/man/man8/lmtp.8 b/postfix/man/man8/lmtp.8 index 13077bd88..3874e254c 100644 --- a/postfix/man/man8/lmtp.8 +++ b/postfix/man/man8/lmtp.8 @@ -60,10 +60,11 @@ RFC 1651 (SMTP service extensions) RFC 1652 (8bit-MIME transport) RFC 1870 (Message Size Declaration) RFC 2033 (LMTP protocol) -RFC 2034 (Enhanced Error Codes) +RFC 2034 (Enhanced Status codes) RFC 2554 (AUTH command) RFC 2821 (SMTP protocol) RFC 2920 (SMTP Pipelining) +RFC 3463 (Enhanced Status codes) .SH DIAGNOSTICS .ad .fi diff --git a/postfix/man/man8/local.8 b/postfix/man/man8/local.8 index 7165dddf3..3ff4dfc94 100644 --- a/postfix/man/man8/local.8 +++ b/postfix/man/man8/local.8 @@ -185,6 +185,13 @@ error) is captured for inclusion with non-delivery status reports. A command is forcibly terminated if it does not complete within \fBcommand_time_limit\fR seconds. Command exit status codes are expected to follow the conventions defined in <\fBsysexits.h\fR>. +Exit status 0 means normal successful completion. + +Postfix version 2.3 and later support RFC 3463-style enhanced +status codes. If a command terminates with a non-zero exit +status, and the command output begins with an enhanced +status code, this status code takes precedence over the +non-zero exit status. A limited amount of message context is exported via environment variables. Characters that may have special meaning to the shell @@ -317,6 +324,7 @@ parameter. .na .nf RFC 822 (ARPA Internet Text Messages) +RFC 3463 (Enhanced status codes) .SH DIAGNOSTICS .ad .fi diff --git a/postfix/man/man8/pipe.8 b/postfix/man/man8/pipe.8 index ae9043a25..5aefe102f 100644 --- a/postfix/man/man8/pipe.8 +++ b/postfix/man/man8/pipe.8 @@ -221,11 +221,22 @@ into as many command-line arguments as there are recipients. .sp This information is modified by the \fBu\fR flag for case folding. .RE +.SH "STANDARDS" +.na +.nf +RFC 3463 (Enhanced status codes) .SH DIAGNOSTICS .ad .fi Command exit status codes are expected to follow the conventions defined in <\fBsysexits.h\fR>. +Exit status 0 means normal successful completion. + +Postfix version 2.3 and later support RFC 3463-style enhanced +status codes. If a command terminates with a non-zero exit +status, and the command output begins with an enhanced +status code, this status code takes precedence over the +non-zero exit status. Problems and transactions are logged to \fBsyslogd\fR(8). Corrupted message files are marked so that the queue manager diff --git a/postfix/man/man8/smtp.8 b/postfix/man/man8/smtp.8 index 8cbc7ca51..686b7cfa8 100644 --- a/postfix/man/man8/smtp.8 +++ b/postfix/man/man8/smtp.8 @@ -57,12 +57,13 @@ RFC 1651 (SMTP service extensions) RFC 1652 (8bit-MIME transport) RFC 1870 (Message Size Declaration) RFC 2045 (MIME: Format of Internet Message Bodies) -RFC 2034 (Enhanced Error Codes) +RFC 2034 (Enhanced Status Codes) RFC 2046 (MIME: Media Types) RFC 2554 (AUTH command) RFC 2821 (SMTP protocol) RFC 2920 (SMTP Pipelining) RFC 3207 (STARTTLS command) +RFC 3463 (Enhanced Status Codes) .SH DIAGNOSTICS .ad .fi diff --git a/postfix/man/man8/smtpd.8 b/postfix/man/man8/smtpd.8 index f6fb56d4e..335f81622 100644 --- a/postfix/man/man8/smtpd.8 +++ b/postfix/man/man8/smtpd.8 @@ -46,11 +46,12 @@ RFC 1652 (8bit-MIME transport) RFC 1869 (SMTP service extensions) RFC 1870 (Message Size Declaration) RFC 1985 (ETRN command) -RFC 2034 (Enhanced Error Codes) +RFC 2034 (Enhanced Status Codes) RFC 2554 (AUTH command) RFC 2821 (SMTP protocol) RFC 2920 (SMTP Pipelining) RFC 3207 (STARTTLS command) +RFC 3463 (Enhanced Status Codes) .SH DIAGNOSTICS .ad .fi diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 83eedcdda..a715bea4b 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -992,7 +992,10 @@ address, or Recipient address.
$rbl_code
The numerical SMTP response code, as specified with the -maps_rbl_reject_code configuration parameter.
+maps_rbl_reject_code configuration parameter. Note: The numerical +SMTP response code is required, and must appear at the start of the +reply. With Postfix 2.3 and later this information may be followed +by an RFC 3463 enhanced status code.
$rbl_domain
diff --git a/postfix/src/discard/discard.c b/postfix/src/discard/discard.c index d4f166d61..6f7fd1869 100644 --- a/postfix/src/discard/discard.c +++ b/postfix/src/discard/discard.c @@ -11,7 +11,7 @@ /* the queue manager. Each request specifies a queue file, a sender /* address, a domain or host name that is treated as the reason for /* discarding the mail, and recipient information. -/* The reason may be prefixed with an RFC 1893-compatible detail code. +/* The reason may be prefixed with an RFC 3463-compatible detail code. /* This program expects to be run from the \fBmaster\fR(8) process /* manager. /* diff --git a/postfix/src/error/error.c b/postfix/src/error/error.c index 6fedb1748..348772af0 100644 --- a/postfix/src/error/error.c +++ b/postfix/src/error/error.c @@ -11,7 +11,7 @@ /* the queue manager. Each request specifies a queue file, a sender /* address, a domain or host name that is treated as the reason for /* non-delivery, and recipient information. -/* The reason may be prefixed with an RFC 1893-compatible detail code. +/* The reason may be prefixed with an RFC 3463-compatible detail code. /* This program expects to be run from the \fBmaster\fR(8) process /* manager. /* diff --git a/postfix/src/global/Makefile.in b/postfix/src/global/Makefile.in index e91b98f11..ec70f10a9 100644 --- a/postfix/src/global/Makefile.in +++ b/postfix/src/global/Makefile.in @@ -620,12 +620,61 @@ deliver_request.o: mail_open_ok.h deliver_request.o: mail_proto.h deliver_request.o: mail_queue.h deliver_request.o: recipient_list.h +dict_ldap.o: ../../include/argv.h +dict_ldap.o: ../../include/binhash.h +dict_ldap.o: ../../include/dict.h +dict_ldap.o: ../../include/match_list.h +dict_ldap.o: ../../include/match_ops.h +dict_ldap.o: ../../include/msg.h +dict_ldap.o: ../../include/mymalloc.h +dict_ldap.o: ../../include/stringops.h dict_ldap.o: ../../include/sys_defs.h +dict_ldap.o: ../../include/vbuf.h +dict_ldap.o: ../../include/vstream.h +dict_ldap.o: ../../include/vstring.h +dict_ldap.o: cfg_parser.h +dict_ldap.o: db_common.h dict_ldap.o: dict_ldap.c +dict_ldap.o: dict_ldap.h +dict_ldap.o: string_list.h +dict_mysql.o: ../../include/argv.h +dict_mysql.o: ../../include/dict.h +dict_mysql.o: ../../include/events.h +dict_mysql.o: ../../include/find_inet.h +dict_mysql.o: ../../include/match_list.h +dict_mysql.o: ../../include/match_ops.h +dict_mysql.o: ../../include/msg.h +dict_mysql.o: ../../include/mymalloc.h +dict_mysql.o: ../../include/myrand.h +dict_mysql.o: ../../include/split_at.h dict_mysql.o: ../../include/sys_defs.h +dict_mysql.o: ../../include/vbuf.h +dict_mysql.o: ../../include/vstream.h +dict_mysql.o: ../../include/vstring.h +dict_mysql.o: cfg_parser.h +dict_mysql.o: db_common.h dict_mysql.o: dict_mysql.c +dict_mysql.o: dict_mysql.h +dict_mysql.o: string_list.h +dict_pgsql.o: ../../include/argv.h +dict_pgsql.o: ../../include/dict.h +dict_pgsql.o: ../../include/events.h +dict_pgsql.o: ../../include/find_inet.h +dict_pgsql.o: ../../include/match_list.h +dict_pgsql.o: ../../include/match_ops.h +dict_pgsql.o: ../../include/msg.h +dict_pgsql.o: ../../include/mymalloc.h +dict_pgsql.o: ../../include/myrand.h +dict_pgsql.o: ../../include/split_at.h dict_pgsql.o: ../../include/sys_defs.h +dict_pgsql.o: ../../include/vbuf.h +dict_pgsql.o: ../../include/vstream.h +dict_pgsql.o: ../../include/vstring.h +dict_pgsql.o: cfg_parser.h +dict_pgsql.o: db_common.h dict_pgsql.o: dict_pgsql.c +dict_pgsql.o: dict_pgsql.h +dict_pgsql.o: string_list.h dict_proxy.o: ../../include/argv.h dict_proxy.o: ../../include/attr.h dict_proxy.o: ../../include/dict.h diff --git a/postfix/src/global/bounce.c b/postfix/src/global/bounce.c index e1a1c5411..b7b50df75 100644 --- a/postfix/src/global/bounce.c +++ b/postfix/src/global/bounce.c @@ -127,7 +127,7 @@ /* Name of the host that the message could not be delivered to. /* This information is used for syslogging only. /* .IP dsn -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP entry /* Message arrival time. /* .IP orig_rcpt diff --git a/postfix/src/global/cleanup_strerror.c b/postfix/src/global/cleanup_strerror.c index 0910102b0..11ba36061 100644 --- a/postfix/src/global/cleanup_strerror.c +++ b/postfix/src/global/cleanup_strerror.c @@ -10,7 +10,7 @@ /* .in +4 /* const unsigned status; /* cleanup status */ /* const int smtp; /* RFC 821 */ -/* const char *dsn; /* RFC 1893 */ +/* const char *dsn; /* RFC 3463 */ /* const char *text; /* free text */ /* .in -4 /* } CLEANUP_STAT_DETAIL; diff --git a/postfix/src/global/cleanup_user.h b/postfix/src/global/cleanup_user.h index d45efcc09..238ae0c07 100644 --- a/postfix/src/global/cleanup_user.h +++ b/postfix/src/global/cleanup_user.h @@ -71,7 +71,7 @@ typedef struct { const unsigned status; /* CLEANUP_STAT_MUMBLE */ const int smtp; /* RFC 821 */ - const char *dsn; /* RFC 1893 */ + const char *dsn; /* RFC 3463 */ const char *text; /* free text */ } CLEANUP_STAT_DETAIL; diff --git a/postfix/src/global/defer.c b/postfix/src/global/defer.c index d4f42cb73..17ba21167 100644 --- a/postfix/src/global/defer.c +++ b/postfix/src/global/defer.c @@ -107,7 +107,7 @@ /* .IP entry /* Message arrival time. /* .IP dsn -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP format /* The reason for non-delivery. /* .IP ap diff --git a/postfix/src/global/deliver_request.c b/postfix/src/global/deliver_request.c index 26c18ecf2..26580a574 100644 --- a/postfix/src/global/deliver_request.c +++ b/postfix/src/global/deliver_request.c @@ -65,7 +65,7 @@ /* by the caller when all delivery to the destination in /* \fInexthop\fR should be deferred. The value of the /* \fIhop_status\fR member is the reason, with optional -/* RFC 1893-style detail at the beginning; it is passed +/* RFC 3463-style detail at the beginning; it is passed /* to myfree(). /* /* deliver_request_done() reports the delivery status back to the diff --git a/postfix/src/global/dsn_util.c b/postfix/src/global/dsn_util.c index 35bec1d61..677dabdae 100644 --- a/postfix/src/global/dsn_util.c +++ b/postfix/src/global/dsn_util.c @@ -8,7 +8,7 @@ /* /* typedef struct { /* .in +4 -/* char dsn[...]; /* RFC 1893 */ +/* char dsn[...]; /* RFC 3463 */ /* const char *text; /* Free text */ /* .in -4 /* } DSN_SPLIT; @@ -24,7 +24,7 @@ /* /* typedef struct { /* .in +4 -/* char dsn[...]; /* RFC 1893 */ +/* char dsn[...]; /* RFC 3463 */ /* VSTRING *text; /* Free text */ /* .in -4 /* } DSN_VSTRING; @@ -43,19 +43,19 @@ /* size_t dsn_valid(text) /* const char *text; /* DESCRIPTION -/* The functions in this module manipulate pairs of RFC 1893 +/* The functions in this module manipulate pairs of RFC 3463 /* X.X.X detail codes and descriptive free text. /* -/* dsn_split() splits text into an RFC 1893 detail code and +/* dsn_split() splits text into an RFC 3463 detail code and /* descriptive free text. When the text does not start with /* a detail code, the specified default detail code is used /* instead. Whitespace before the optional detail code or /* text is skipped. dsn_split() returns a copy of the RFC -/* 1893 detail code, and returns a pointer to (not copy of) +/* 3463 detail code, and returns a pointer to (not copy of) /* the remainder of the text. The result value is the first /* argument. /* -/* dsn_prepend() prepends the specified default RFC 1893 detail +/* dsn_prepend() prepends the specified default RFC 3463 detail /* code to the specified text if no detail code is present in /* the text. This function produces the same result as calling /* concatenate() with the results from dsn_split(). The result @@ -63,7 +63,7 @@ /* detail code or text is skipped. /* /* dsn_vstring_alloc() creates initialized storage for an RFC -/* 1893 detail code and descriptive free text. +/* 3463 detail code and descriptive free text. /* /* dsn_vstring_update() updates the detail code, the descriptive /* free text, or both. Specify a null pointer (or zero-length @@ -72,19 +72,19 @@ /* dsn_vstring_free() recycles the storage that was allocated /* by dsn_vstring_alloc() and dsn_vstring_update(). /* -/* dsn_valid() returns the length of the RFC 1893 detail code +/* dsn_valid() returns the length of the RFC 3463 detail code /* at the beginning of text, or zero. It does not skip initial /* whitespace. /* /* Arguments: /* .IP def_dsn -/* Null-terminated default RFC 1893 detail code that will be +/* Null-terminated default RFC 3463 detail code that will be /* used when the free text does not start with one. /* .IP dp /* Pointer to storage for copy of DSN detail code, and for /* pointer to free text. /* .IP dsn -/* Null-terminated RFC 1893 detail code. +/* Null-terminated RFC 3463 detail code. /* .IP text /* Null-terminated free text. /* .IP vp @@ -123,7 +123,7 @@ #include -/* dsn_valid - check RFC 1893 enhanced status code, return length or zero */ +/* dsn_valid - check RFC 3463 enhanced status code, return length or zero */ size_t dsn_valid(const char *text) { @@ -157,7 +157,7 @@ DSN_SPLIT *dsn_split(DSN_SPLIT *dp, const char *def_dsn, const char *text) size_t len; /* - * Look for an optional RFC 1893 enhanced status code. + * Look for an optional RFC 3463 enhanced status code. * * XXX If we want to enforce that the first digit of the status code in the * text matches the default status code, then pipe_command() needs to be diff --git a/postfix/src/global/dsn_util.h b/postfix/src/global/dsn_util.h index a9323533e..fcd3622c4 100644 --- a/postfix/src/global/dsn_util.h +++ b/postfix/src/global/dsn_util.h @@ -29,7 +29,7 @@ * Split flat text into detail code and free text. */ typedef struct { - char dsn[DSN_BUFSIZE]; /* RFC 1893 X.XXX.XXX detail */ + char dsn[DSN_BUFSIZE]; /* RFC 3463 X.XXX.XXX detail */ const char *text; /* free text */ } DSN_SPLIT; @@ -50,7 +50,7 @@ extern char *dsn_prepend(const char *, const char *); * Easy to update pair of detail code and free text. */ typedef struct { - char dsn[DSN_LEN + 1]; /* RFC 1893 X.XXX.XXX detail */ + char dsn[DSN_LEN + 1]; /* RFC 3463 X.XXX.XXX detail */ VSTRING *vstring; /* free text */ } DSN_VSTRING; diff --git a/postfix/src/global/log_adhoc.c b/postfix/src/global/log_adhoc.c index 3f05d474e..f422b128a 100644 --- a/postfix/src/global/log_adhoc.c +++ b/postfix/src/global/log_adhoc.c @@ -53,7 +53,7 @@ /* .IP status /* bounced, deferred, sent, and so on. /* .IP detail -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP entry /* Message arrival time. /* .IP format diff --git a/postfix/src/global/mail_copy.c b/postfix/src/global/mail_copy.c index 90423eca3..3aba2b140 100644 --- a/postfix/src/global/mail_copy.c +++ b/postfix/src/global/mail_copy.c @@ -269,7 +269,8 @@ int mail_copy(const char *sender, dsn_vstring_update(why, TRY_AGAIN_ERROR(errno) ? "4.3.0" : "5.3.0", "error reading message: %m"); if (why && write_error) - dsn_vstring_update(why, mbox_dsn(errno), "error writing message: %m"); + dsn_vstring_update(why, mbox_dsn(errno, "5.3.0"), + "error writing message: %m"); /* * Use flag+errno description when the optional verbose description is diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 6a5255cdb..ebce57eaa 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -1689,7 +1689,7 @@ extern int var_access_map_code; extern char *var_rbl_reply_maps; #define VAR_DEF_RBL_REPLY "default_rbl_reply" -#define DEF_DEF_RBL_REPLY "$rbl_code 5.7.1 Service unavailable; $rbl_class [$rbl_what] blocked using $rbl_domain${rbl_reason?; $rbl_reason}" +#define DEF_DEF_RBL_REPLY "$rbl_code Service unavailable; $rbl_class [$rbl_what] blocked using $rbl_domain${rbl_reason?; $rbl_reason}" extern char *var_def_rbl_reply; #define REJECT_MAPS_RBL "reject_maps_rbl" /* backwards compat */ diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index f7fd1ccf2..8a74d56bf 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. */ -#define MAIL_RELEASE_DATE "20050327" +#define MAIL_RELEASE_DATE "20050328" #define MAIL_VERSION_NUMBER "2.3" #define VAR_MAIL_VERSION "mail_version" diff --git a/postfix/src/global/mbox_open.c b/postfix/src/global/mbox_open.c index 991f49ce9..181ac17c7 100644 --- a/postfix/src/global/mbox_open.c +++ b/postfix/src/global/mbox_open.c @@ -13,7 +13,8 @@ /* .in -4 /* } MBOX; /* -/* MBOX *mbox_open(path, flags, mode, st, user, group, lock_style, why) +/* MBOX *mbox_open(path, flags, mode, st, user, group, lock_style, +/* def_dsn, why) /* const char *path; /* int flags; /* int mode; @@ -21,13 +22,15 @@ /* uid_t user; /* gid_t group; /* int lock_style; +/* const char *def_dsn; /* DSN_VSTRING *why; /* /* void mbox_release(mbox) /* MBOX *mbox; /* -/* const char *mbox_dsn(err) +/* const char *mbox_dsn(err, def_dsn) /* int err; +/* const char *def_dsn; /* DESCRIPTION /* This module manages access to UNIX mailbox-style files. /* @@ -39,12 +42,22 @@ /* The \fBlock_style\fR argument specifies a lock style from /* mbox_lock_mask(). Locks are applied to regular files only. /* The result is a handle that must be destroyed by mbox_release(). +/* The \fBdef_dsn\fR argument is given to mbox_dsn(). /* /* mbox_release() releases the named mailbox. It is up to the /* application to close the stream. /* /* mbox_dsn() translates an errno value to a mailbox related -/* DSN detail code. +/* enhanced status code. +/* .IP "EAGAIN, ESTALE" +/* These result in a 4.2.0 soft error (mailbox problem). +/* .IP ENOSPC +/* This results in a 4.3.0 soft error (mail system full). +/* .IP "EDQUOT, EFBIG" +/* These result in a 5.2.2 hard error (mailbox full). +/* .PP +/* All other errors are assigned the specified default error +/* code. Typically, one would specify 4.2.0 or 5.2.0. /* DIAGNOSTICS /* mbox_open() returns a null pointer in case of problems, and /* sets errno to EAGAIN if someone else has exclusive access. @@ -90,7 +103,8 @@ MBOX *mbox_open(const char *path, int flags, int mode, struct stat * st, uid_t chown_uid, gid_t chown_gid, - int lock_style, DSN_VSTRING *why) + int lock_style, const char *def_dsn, + DSN_VSTRING *why) { struct stat local_statbuf; MBOX *mp; @@ -113,7 +127,7 @@ MBOX *mbox_open(const char *path, int flags, int mode, struct stat * st, st = &local_statbuf; if ((fp = safe_open(path, flags | O_NONBLOCK, mode, st, chown_uid, chown_gid, why->vstring)) == 0) { - dsn_vstring_update(why, mbox_dsn(errno), ""); + dsn_vstring_update(why, mbox_dsn(errno, def_dsn), ""); return (0); } close_on_exec(vstream_fileno(fp), CLOSE_ON_EXEC); @@ -137,13 +151,13 @@ MBOX *mbox_open(const char *path, int flags, int mode, struct stat * st, if (dot_lockfile(path, why->vstring) == 0) { locked |= MBOX_DOT_LOCK; } else if (errno == EEXIST) { - dsn_vstring_update(why, mbox_dsn(EAGAIN), ""); + dsn_vstring_update(why, mbox_dsn(EAGAIN, def_dsn), ""); vstream_fclose(fp); return (0); } else if (lock_style & MBOX_DOT_LOCK_MAY_FAIL) { msg_warn("%s", vstring_str(why->vstring)); } else { - dsn_vstring_update(why, mbox_dsn(errno), ""); + dsn_vstring_update(why, mbox_dsn(errno, def_dsn), ""); vstream_fclose(fp); return (0); } @@ -163,7 +177,7 @@ MBOX *mbox_open(const char *path, int flags, int mode, struct stat * st, && HUNKY_DORY(MBOX_FCNTL_LOCK, MYFLOCK_STYLE_FCNTL)) { locked |= lock_style; } else { - dsn_vstring_update(why, mbox_dsn(errno), ""); + dsn_vstring_update(why, mbox_dsn(errno, def_dsn), ""); if (locked & MBOX_DOT_LOCK) dot_unlockfile(path); vstream_fclose(fp); @@ -187,8 +201,8 @@ void mbox_release(MBOX *mp) * (AFS), the only way to find out if a file was written successfully is * to close it, and therefore the close() operation is in the mail_copy() * routine. If we really insist on owning the vstream member, then we - * should export appropriate methods that mail_copy() can use in order - * to manipulate a message stream. + * should export appropriate methods that mail_copy() can use in order to + * manipulate a message stream. */ if (mp->locked & MBOX_DOT_LOCK) dot_unlockfile(mp->path); @@ -198,10 +212,10 @@ void mbox_release(MBOX *mp) /* mbox_dsn - map errno value to mailbox-related DSN detail */ -const char *mbox_dsn(int err) +const char *mbox_dsn(int err, const char *def_dsn) { #define TRY_AGAIN_ERROR(e) \ - (e == EACCES || e == EAGAIN || e == ESTALE) + (e == EAGAIN || e == ESTALE) #define SYSTEM_FULL_ERROR(e) \ (e == ENOSPC) #define MBOX_FULL_ERROR(e) \ @@ -210,5 +224,5 @@ const char *mbox_dsn(int err) return (TRY_AGAIN_ERROR(err) ? "4.2.0" : SYSTEM_FULL_ERROR(err) ? "4.3.0" : MBOX_FULL_ERROR(err) ? "5.2.2" : - "5.2.0"); + def_dsn); } diff --git a/postfix/src/global/mbox_open.h b/postfix/src/global/mbox_open.h index e904cd8c6..511fe4cdc 100644 --- a/postfix/src/global/mbox_open.h +++ b/postfix/src/global/mbox_open.h @@ -27,13 +27,14 @@ * External interface. */ typedef struct { - char *path; /* saved path, for dot_unlock */ + char *path; /* saved path, for dot_unlock */ VSTREAM *fp; /* open stream or null */ int locked; /* what locks were set */ } MBOX; -extern MBOX *mbox_open(const char *, int, int, struct stat *, uid_t, gid_t, int, DSN_VSTRING *); +extern MBOX *mbox_open(const char *, int, int, struct stat *, uid_t, gid_t, + int, const char *, DSN_VSTRING *); extern void mbox_release(MBOX *); -extern const char *mbox_dsn(int); +extern const char *mbox_dsn(int, const char *); /* LICENSE /* .ad diff --git a/postfix/src/global/pipe_command.c b/postfix/src/global/pipe_command.c index 1e2ee88c0..fca7632fa 100644 --- a/postfix/src/global/pipe_command.c +++ b/postfix/src/global/pipe_command.c @@ -16,7 +16,7 @@ /* output is captured for diagnostics purposes. /* /* If the command invokes exit() with a non-zero status, -/* the delivery status is taken from an RFC 1893-style code +/* the delivery status is taken from an RFC 3463-style code /* at the beginning of command output. If that information is /* unavailable, the delivery status is taken from the command /* exit status as per . diff --git a/postfix/src/global/sent.c b/postfix/src/global/sent.c index e3410dda9..aa99eea9d 100644 --- a/postfix/src/global/sent.c +++ b/postfix/src/global/sent.c @@ -66,7 +66,7 @@ /* .IP relay /* Name of the host we're talking to. /* .IP dsn -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP entry /* Message arrival time. /* .IP format diff --git a/postfix/src/global/sys_exits.c b/postfix/src/global/sys_exits.c index cbb989ea7..5aefca796 100644 --- a/postfix/src/global/sys_exits.c +++ b/postfix/src/global/sys_exits.c @@ -9,7 +9,7 @@ /* typedef struct { /* .in +4 /* int status; /* exit status */ -/* const char *dsn; /* RFC 1893 */ +/* const char *dsn; /* RFC 3463 */ /* const char *text; /* free text */ /* .in -4 /* } SYS_EXITS_DETAIL; diff --git a/postfix/src/global/trace.c b/postfix/src/global/trace.c index 9f2e0df18..558f8ae6c 100644 --- a/postfix/src/global/trace.c +++ b/postfix/src/global/trace.c @@ -70,7 +70,7 @@ /* .IP entry /* Message arrival time. /* .IP dsn -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP action /* "deliverable", "undeliverable", and so on. /* .IP format diff --git a/postfix/src/global/verify.c b/postfix/src/global/verify.c index a6ceed1bf..c495bae95 100644 --- a/postfix/src/global/verify.c +++ b/postfix/src/global/verify.c @@ -54,7 +54,7 @@ /* .IP relay /* Name of the host we're talking to. /* .IP dsn -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP entry /* Message arrival time. /* .IP status diff --git a/postfix/src/lmtp/lmtp.c b/postfix/src/lmtp/lmtp.c index 6b9206de6..79b7ee3c5 100644 --- a/postfix/src/lmtp/lmtp.c +++ b/postfix/src/lmtp/lmtp.c @@ -50,10 +50,11 @@ /* RFC 1652 (8bit-MIME transport) /* RFC 1870 (Message Size Declaration) /* RFC 2033 (LMTP protocol) -/* RFC 2034 (Enhanced Error Codes) +/* RFC 2034 (Enhanced Status codes) /* RFC 2554 (AUTH command) /* RFC 2821 (SMTP protocol) /* RFC 2920 (SMTP Pipelining) +/* RFC 3463 (Enhanced Status codes) /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* Corrupted message files are marked so that the queue manager can diff --git a/postfix/src/local/Makefile.in b/postfix/src/local/Makefile.in index b5a0c702a..ad00531bc 100644 --- a/postfix/src/local/Makefile.in +++ b/postfix/src/local/Makefile.in @@ -387,10 +387,12 @@ maildir.o: ../../include/mail_params.h maildir.o: ../../include/make_dirs.h maildir.o: ../../include/maps.h maildir.o: ../../include/mbox_conf.h +maildir.o: ../../include/mbox_open.h maildir.o: ../../include/msg.h maildir.o: ../../include/mymalloc.h maildir.o: ../../include/recipient_list.h maildir.o: ../../include/resolve_clnt.h +maildir.o: ../../include/safe_open.h maildir.o: ../../include/sane_fsops.h maildir.o: ../../include/sent.h maildir.o: ../../include/set_eugid.h diff --git a/postfix/src/local/file.c b/postfix/src/local/file.c index 09c675aba..55e72e94e 100644 --- a/postfix/src/local/file.c +++ b/postfix/src/local/file.c @@ -161,7 +161,8 @@ int deliver_file(LOCAL_STATE state, USER_ATTR usr_attr, char *path) set_eugid(usr_attr.uid, usr_attr.gid); mp = mbox_open(path, O_APPEND | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR, &st, -1, -1, - local_mbox_lock_mask | MBOX_DOT_LOCK_MAY_FAIL, why); + local_mbox_lock_mask | MBOX_DOT_LOCK_MAY_FAIL, + "5.2.0", why); if (mp != 0) { if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { vstream_fclose(mp->fp); diff --git a/postfix/src/local/local.c b/postfix/src/local/local.c index 7dfc6770e..83b11abd2 100644 --- a/postfix/src/local/local.c +++ b/postfix/src/local/local.c @@ -171,6 +171,13 @@ /* A command is forcibly terminated if it does not complete within /* \fBcommand_time_limit\fR seconds. Command exit status codes are /* expected to follow the conventions defined in <\fBsysexits.h\fR>. +/* Exit status 0 means normal successful completion. +/* +/* Postfix version 2.3 and later support RFC 3463-style enhanced +/* status codes. If a command terminates with a non-zero exit +/* status, and the command output begins with an enhanced +/* status code, this status code takes precedence over the +/* non-zero exit status. /* /* A limited amount of message context is exported via environment /* variables. Characters that may have special meaning to the shell @@ -295,6 +302,7 @@ /* parameter. /* STANDARDS /* RFC 822 (ARPA Internet Text Messages) +/* RFC 3463 (Enhanced status codes) /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* Corrupted message files are marked so that the queue diff --git a/postfix/src/local/mailbox.c b/postfix/src/local/mailbox.c index 98fc13c43..a3f2723e2 100644 --- a/postfix/src/local/mailbox.c +++ b/postfix/src/local/mailbox.c @@ -186,7 +186,7 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) set_eugid(spool_uid, spool_gid); mp = mbox_open(mailbox, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR, &st, chown_uid, chown_gid, - local_mbox_lock_mask, why); + local_mbox_lock_mask, "5.2.0", why); if (mp != 0) { if (spool_uid != usr_attr.uid || spool_gid != usr_attr.gid) set_eugid(usr_attr.uid, usr_attr.gid); diff --git a/postfix/src/local/maildir.c b/postfix/src/local/maildir.c index 9540a2c06..6d6611e92 100644 --- a/postfix/src/local/maildir.c +++ b/postfix/src/local/maildir.c @@ -66,6 +66,7 @@ #include #include #include +#include /* Application-specific. */ @@ -189,9 +190,11 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr, char *path) && (errno != ENOENT || make_dirs(tmpdir, 0700) < 0 || (dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0)) { - dsn_vstring_update(why, "5.2.0", "create maildir file %s: %m", tmpfile); + dsn_vstring_update(why, mbox_dsn(errno, "5.2.0"), + "create maildir file %s: %m", tmpfile); } else if (fstat(vstream_fileno(dst), &st) < 0) { - dsn_vstring_update(why, "5.2.0", "create maildir file %s: %m", tmpfile); + dsn_vstring_update(why, mbox_dsn(errno, "5.2.0"), + "create maildir file %s: %m", tmpfile); } else { vstring_sprintf(buf, "%lu.V%lxI%lxM%lu.%s", (unsigned long) starttime.tv_sec, @@ -206,7 +209,7 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr, char *path) && (errno != ENOENT || (make_dirs(curdir, 0700), make_dirs(newdir, 0700)) < 0 || sane_link(tmpfile, newfile) < 0)) { - dsn_vstring_update(why, "5.2.0", + dsn_vstring_update(why, mbox_dsn(errno, "5.2.0"), "create maildir file %s: %m", newfile); mail_copy_status = MAIL_COPY_STAT_WRITE; } diff --git a/postfix/src/oqmgr/qmgr_bounce.c b/postfix/src/oqmgr/qmgr_bounce.c index ef870c610..dc0cd669b 100644 --- a/postfix/src/oqmgr/qmgr_bounce.c +++ b/postfix/src/oqmgr/qmgr_bounce.c @@ -25,7 +25,7 @@ /* .IP recipient /* The recipient that will not be delivered. /* .IP dsn -/* RFC 1893 detail code. +/* RFC 3463 detail code. /* .IP format /* Free-format text that describes why delivery will not happen. /* DIAGNOSTICS diff --git a/postfix/src/oqmgr/qmgr_defer.c b/postfix/src/oqmgr/qmgr_defer.c index 8e1675b7e..573192b9d 100644 --- a/postfix/src/oqmgr/qmgr_defer.c +++ b/postfix/src/oqmgr/qmgr_defer.c @@ -47,7 +47,7 @@ /* .IP transport /* Specifies a message delivery transport. /* .IP dsn -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP reason /* Free-format text that describes why delivery is deferred; this /* used for logging purposes, and for updating the message-specific diff --git a/postfix/src/pipe/pipe.c b/postfix/src/pipe/pipe.c index 380641119..d4f6107d4 100644 --- a/postfix/src/pipe/pipe.c +++ b/postfix/src/pipe/pipe.c @@ -211,9 +211,18 @@ /* .sp /* This information is modified by the \fBu\fR flag for case folding. /* .RE +/* STANDARDS +/* RFC 3463 (Enhanced status codes) /* DIAGNOSTICS /* Command exit status codes are expected to /* follow the conventions defined in <\fBsysexits.h\fR>. +/* Exit status 0 means normal successful completion. +/* +/* Postfix version 2.3 and later support RFC 3463-style enhanced +/* status codes. If a command terminates with a non-zero exit +/* status, and the command output begins with an enhanced +/* status code, this status code takes precedence over the +/* non-zero exit status. /* /* Problems and transactions are logged to \fBsyslogd\fR(8). /* Corrupted message files are marked so that the queue manager diff --git a/postfix/src/postlock/postlock.c b/postfix/src/postlock/postlock.c index b49596008..60220c5b8 100644 --- a/postfix/src/postlock/postlock.c +++ b/postfix/src/postlock/postlock.c @@ -222,7 +222,7 @@ int main(int argc, char **argv) why = dsn_vstring_alloc(1); if ((mp = mbox_open(folder, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR, (struct stat *) 0, - -1, -1, lock_mask, why)) == 0) + -1, -1, lock_mask, "5.2.0", why)) == 0) msg_fatal("open file %s: %s", folder, vstring_str(why->vstring)); /* diff --git a/postfix/src/qmgr/qmgr_bounce.c b/postfix/src/qmgr/qmgr_bounce.c index 8daffb2d2..452664985 100644 --- a/postfix/src/qmgr/qmgr_bounce.c +++ b/postfix/src/qmgr/qmgr_bounce.c @@ -25,7 +25,7 @@ /* .IP recipient /* The recipient that will not be delivered. /* .IP dsn -/* RFC 1893 detail code. +/* RFC 3463 detail code. /* .IP format /* Free-format text that describes why delivery will not happen. /* DIAGNOSTICS diff --git a/postfix/src/qmgr/qmgr_defer.c b/postfix/src/qmgr/qmgr_defer.c index 59f1892e0..08eede93a 100644 --- a/postfix/src/qmgr/qmgr_defer.c +++ b/postfix/src/qmgr/qmgr_defer.c @@ -47,7 +47,7 @@ /* .IP transport /* Specifies a message delivery transport. /* .IP dsn -/* X.YY.ZZ Error detail as specified in RFC 1893. +/* X.YY.ZZ Error detail as specified in RFC 3463. /* .IP reason /* Free-format text that describes why delivery is deferred; this /* used for logging purposes, and for updating the message-specific diff --git a/postfix/src/smtp/smtp.c b/postfix/src/smtp/smtp.c index 5455059fd..a35f264a5 100644 --- a/postfix/src/smtp/smtp.c +++ b/postfix/src/smtp/smtp.c @@ -47,12 +47,13 @@ /* RFC 1652 (8bit-MIME transport) /* RFC 1870 (Message Size Declaration) /* RFC 2045 (MIME: Format of Internet Message Bodies) -/* RFC 2034 (Enhanced Error Codes) +/* RFC 2034 (Enhanced Status Codes) /* RFC 2046 (MIME: Media Types) /* RFC 2554 (AUTH command) /* RFC 2821 (SMTP protocol) /* RFC 2920 (SMTP Pipelining) /* RFC 3207 (STARTTLS command) +/* RFC 3463 (Enhanced Status Codes) /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* Corrupted message files are marked so that the queue manager can diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c index f360af9db..e98ebed78 100644 --- a/postfix/src/smtp/smtp_proto.c +++ b/postfix/src/smtp/smtp_proto.c @@ -601,7 +601,7 @@ static int smtp_start_tls(SMTP_STATE *state, int misc_flags) */ serverid = vstring_alloc(10); vstring_sprintf(serverid, "%s:%u", session->addr, ntohs(session->port)); - if (session->helo && strcasecmp(session->host, session->helo) != 0) + if (session->helo != 0) vstring_sprintf_append(serverid, ":%s", session->helo); session->tls_context = tls_client_start(smtp_tls_ctx, session->stream, diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index f5a5eef95..fb021129e 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -36,11 +36,12 @@ /* RFC 1869 (SMTP service extensions) /* RFC 1870 (Message Size Declaration) /* RFC 1985 (ETRN command) -/* RFC 2034 (Enhanced Error Codes) +/* RFC 2034 (Enhanced Status Codes) /* RFC 2554 (AUTH command) /* RFC 2821 (SMTP protocol) /* RFC 2920 (SMTP Pipelining) /* RFC 3207 (STARTTLS command) +/* RFC 3463 (Enhanced Status Codes) /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* @@ -71,7 +72,7 @@ /* Disable the SMTP VRFY command. /* .IP "\fBsmtpd_noop_commands (empty)\fR" /* List of commands that the Postfix SMTP server replies to with "250 -/* 2.0.0 Ok", without doing any syntax checks and without changing state. +/* Ok", without doing any syntax checks and without changing state. /* .IP "\fBstrict_rfc821_envelopes (no)\fR" /* Require that addresses received in SMTP MAIL FROM and RCPT TO /* commands are enclosed with <>, and that those addresses do @@ -1045,7 +1046,7 @@ static int helo_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) /* * RFC 2034: the text part of all 2xx, 4xx, and 5xx SMTP responses other * than the initial greeting and any response to HELO or EHLO are - * prefaced with a status code as defined in RFC 1893. + * prefaced with a status code as defined in RFC 3463. */ if (argc < 2) { state->error_mask |= MAIL_ERROR_PROTOCOL; @@ -1093,7 +1094,7 @@ static int ehlo_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) * * RFC 2034: the text part of all 2xx, 4xx, and 5xx SMTP responses other * than the initial greeting and any response to HELO or EHLO are - * prefaced with a status code as defined in RFC 1893. + * prefaced with a status code as defined in RFC 3463. */ if (argc < 2) { state->error_mask |= MAIL_ERROR_PROTOCOL; @@ -3034,7 +3035,7 @@ static void smtpd_proto(SMTPD_STATE *state, const char *service) /* * RFC 2034: the text part of all 2xx, 4xx, and 5xx SMTP responses * other than the initial greeting and any response to HELO or EHLO - * are prefaced with a status code as defined in RFC 1893. + * are prefaced with a status code as defined in RFC 3463. */ else { smtpd_chat_reply(state, "220 %s", var_smtpd_banner); diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 14689ec5f..ee3c6d7b1 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -1844,7 +1844,7 @@ static int check_table_result(SMTPD_STATE *state, const char *table, int status; const char *cmd_text; int cmd_len; - static char def_dsn[] = "0.0.0"; + static char def_dsn[] = "5.7.1"; DSN_SPLIT dp; /* @@ -2035,7 +2035,7 @@ static int check_table_result(SMTPD_STATE *state, const char *table, * 4xx or 5xx means NO as well. smtpd_check_reject() will validate the * response status code. * - * If the caller specifies an RFC 1893 enhanced status code, put it + * If the caller specifies an RFC 3463 enhanced status code, put it * immediately after the SMTP status code as described in RFC 2034. */ if (cmd_len == 3 && *cmd_text diff --git a/postfix/src/virtual/Makefile.in b/postfix/src/virtual/Makefile.in index 883e827dc..41a6c38dc 100644 --- a/postfix/src/virtual/Makefile.in +++ b/postfix/src/virtual/Makefile.in @@ -104,9 +104,11 @@ maildir.o: ../../include/mail_params.h maildir.o: ../../include/make_dirs.h maildir.o: ../../include/maps.h maildir.o: ../../include/mbox_conf.h +maildir.o: ../../include/mbox_open.h maildir.o: ../../include/msg.h maildir.o: ../../include/mymalloc.h maildir.o: ../../include/recipient_list.h +maildir.o: ../../include/safe_open.h maildir.o: ../../include/sane_fsops.h maildir.o: ../../include/sent.h maildir.o: ../../include/set_eugid.h diff --git a/postfix/src/virtual/mailbox.c b/postfix/src/virtual/mailbox.c index 664b59466..7f5b38a54 100644 --- a/postfix/src/virtual/mailbox.c +++ b/postfix/src/virtual/mailbox.c @@ -117,7 +117,7 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) set_eugid(usr_attr.uid, usr_attr.gid); mp = mbox_open(usr_attr.mailbox, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR, &st, -1, -1, - virtual_mbox_lock_mask, why); + virtual_mbox_lock_mask, "4.2.0", why); if (mp != 0) { if (S_ISREG(st.st_mode) == 0) { vstream_fclose(mp->fp); diff --git a/postfix/src/virtual/maildir.c b/postfix/src/virtual/maildir.c index 00d2e0a46..497c8b15e 100644 --- a/postfix/src/virtual/maildir.c +++ b/postfix/src/virtual/maildir.c @@ -60,6 +60,7 @@ #include #include #include +#include /* Application-specific. */ @@ -182,9 +183,11 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr) && (errno != ENOENT || make_dirs(tmpdir, 0700) < 0 || (dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0)) { - dsn_vstring_update(why, "5.2.0", "create maildir file %s: %m", tmpfile); + dsn_vstring_update(why, mbox_dsn(errno, "4.2.0"), + "create maildir file %s: %m", tmpfile); } else if (fstat(vstream_fileno(dst), &st) < 0) { - dsn_vstring_update(why, "5.2.0", "create maildir file %s: %m", tmpfile); + dsn_vstring_update(why, mbox_dsn(errno, "4.2.0"), + "create maildir file %s: %m", tmpfile); } else { vstring_sprintf(buf, "%lu.V%lxI%lxM%lu.%s", (unsigned long) starttime.tv_sec, @@ -199,8 +202,8 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr) && (errno != ENOENT || (make_dirs(curdir, 0700), make_dirs(newdir, 0700)) < 0 || sane_link(tmpfile, newfile) < 0)) { - dsn_vstring_update(why, "5.2.0", - "create maildir file %s: %m", newfile); + dsn_vstring_update(why, mbox_dsn(errno, "4.2.0"), + "create maildir file %s: %m", newfile); mail_copy_status = MAIL_COPY_STAT_WRITE; } } @@ -223,8 +226,8 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr) "maildir delivery failed: %s", vstring_str(why->vstring)); if (errno == EACCES) { msg_warn("maildir access problem for UID/GID=%lu/%lu: %s", - (long) usr_attr.uid, (long) usr_attr.gid, - vstring_str(why->vstring)); + (long) usr_attr.uid, (long) usr_attr.gid, + vstring_str(why->vstring)); msg_warn("perhaps you need to create the maildirs in advance"); } } else {