cleanup/cleanup_final.c, cleanup/cleanup_bounce.c,
cleanup/cleanup_api.c.
-20050217
+20070217
Streamline the compile time selection of event handling
styles, replacing multiple on/off macros by just one
Cleanup: remove obsolete Rhapsody and MacOS targets from
makedefs.
+
+20080929
+
+ Workaround: don't log "file has 2 links" warnings when the
+ condition appears to be temporary. As kernels have evolved
+ from non-interruptible system calls towards fine-grained
+ locks, the showq command has become likely to observe a
+ file while the queue manager is in the middle of a rename
+ operation, when the file has links to both the old and new
+ name. File: global/mail_open_ok.c.
+
+ Workaround: don't loop forever when write() fails with a
+ persistent EAGAIN error on a writable file descriptor.
+ File: util/write_buf.c.
+
+20081002
+
+ Bugfix (introduced Postfix 2.1): the introduction of XFORWARD
+ support resulted in inaccurate logging and (delivery agent)
+ $name expansion. Specifically, Postfix no longer properly
+ distinguished between local submissions and submissions
+ from clients with unknown hostname etc. attributes. Files:
+ smtpd/smtpd.c, qmqpd/qmqpd.c, smtp/smtp_proto.c,
+ cleanup/cleanup_envelope.c.
XFORWARD. The keyword is followed by the names of the attributes that the
XFORWARD implementation supports.
-The client may send the XFORWARD request at any time except in the middle of a
-mail delivery transaction (i.e. between MAIL and RSET or DOT). The command may
-be pipelined when the server supports ESMTP command pipelining.
+The client may send one or more XFORWARD requests at any time except in the
+middle of a mail delivery transaction (i.e. between MAIL and RSET or DOT). The
+command may be pipelined when the server supports ESMTP command pipelining.
The syntax of XFORWARD requests is described below. Upper case and quoted
strings specify terminals, lowercase strings specify meta terminals, and SP is
attribute values. Servers that wish to interoperate with these older
implementations should be prepared to receive unencoded information.
-X\bXF\bFO\bOR\bRW\bWA\bAR\bRD\bD S\bSe\ber\brv\bve\ber\br r\bre\bes\bsp\bpo\bon\bns\bse\be
+X\bXF\bFO\bOR\bRW\bWA\bAR\bRD\bD S\bSe\ber\brv\bve\ber\br o\bop\bpe\ber\bra\bat\bti\bio\bon\bn
-Upon receipt of a correctly formatted XFORWARD command, the server stores the
-specified attribute values, and erases the attributes whose value was specified
-as [UNAVAILABLE]. All XFORWARD attributes are reset to the real client
-information after the MAIL FROM transaction completes (i.e. after RSET or DOT).
+Upon receipt of an initial XFORWARD command, the SMTP server initializes all
+XFORWARD attributes to [UNAVAILABLE]. With each XFORWARD command, the server
+overwrites attributes with the specified attribute values, and erases
+attributes whose value is specified as [UNAVAILABLE]. Attributes that are not
+specified in an XFORWARD command retain their current value.
+
+An ADDR attribute value of [UNAVAILABLE] indicates that the next MAIL FROM
+transaction is a forwarded local submission. In this case the SMTP server
+should ignore other client attributes. This behavior is available with Postfix
+version 2.6.
+
+At the end of the next MAIL FROM transaction (i.e. RSET or DOT), all XFORWARD
+attributes are reset to the real client information, and the SMTP server is
+ready to receive another initial XFORWARD command.
X\bXF\bFO\bOR\bRW\bWA\bAR\bRD\bD S\bSe\ber\brv\bve\ber\br r\bre\bep\bpl\bly\by c\bco\bod\bde\bes\bs
The mail_release_date configuration parameter (format: yyyymmdd)
specifies the release date of a stable release or snapshot release.
+Incompatibility with snapshot 20081002
+======================================
+
+There is a minor change in the way that XFORWARD attributes are
+stored in queue files. These attributes are used to propagate remote
+client information through an SMTP-based content filter. If you
+don't use such filters, then the following incompatibility does not
+affect your system.
+
+If you downgrade from this Postfix version to an older version while
+you still have new local submissions in the mail queue, the older
+Postfix cleanup server may log "spurious null attribute value"
+warnings when it processes queue files from the newer Postfix
+version. The older cleanup server will ignore the null-valued
+attributes, and no harm will be done.
+
Incompatibility with snapshot 20080814
======================================
Wish list:
-
+
Force a panic when the VDA patch reduces the file size limit
under the message size. They break the code that marks a
recipient as "done", when that recipient was added late
extension is XFORWARD. The keyword is followed by the names of the
attributes that the XFORWARD implementation supports. </p>
-<p> The client may send the XFORWARD request at any time except in
+<p> The client may send one or more XFORWARD requests at any time
+except in
the middle of a mail delivery transaction (i.e. between MAIL and
RSET or DOT). The command may be pipelined when the server supports
ESMTP command pipelining. </p>
with these older implementations should be prepared to receive
unencoded information. </p>
-<h2> XFORWARD Server response </h2>
+<h2> XFORWARD Server operation </h2>
-<p> Upon receipt of a correctly formatted XFORWARD command, the
-server stores the specified attribute values, and erases the
-attributes whose value was specified as [UNAVAILABLE]. All XFORWARD
-attributes are reset to the real client information after the MAIL
-FROM transaction completes (i.e. after RSET or DOT). </p>
+<p> Upon receipt of an initial XFORWARD command, the SMTP server
+initializes all XFORWARD attributes to [UNAVAILABLE]. With each
+XFORWARD command, the server overwrites attributes with the specified
+attribute values, and erases attributes whose value is specified
+as [UNAVAILABLE]. Attributes that are not specified in an XFORWARD
+command retain their current value. </p>
+
+<p> An ADDR attribute value of [UNAVAILABLE] indicates that the
+next MAIL FROM transaction is a forwarded local submission. In
+this case the SMTP server should ignore other client attributes.
+This behavior is available with Postfix version 2.6. </p>
+
+<p> At the end of the next MAIL FROM transaction (i.e. RSET or DOT),
+all XFORWARD attributes are reset to the real client information,
+and the SMTP server is ready to receive another initial XFORWARD
+command. </p>
<h2> XFORWARD Server reply codes </h2>
extension is XFORWARD. The keyword is followed by the names of the
attributes that the XFORWARD implementation supports. </p>
-<p> The client may send the XFORWARD request at any time except in
+<p> The client may send one or more XFORWARD requests at any time
+except in
the middle of a mail delivery transaction (i.e. between MAIL and
RSET or DOT). The command may be pipelined when the server supports
ESMTP command pipelining. </p>
with these older implementations should be prepared to receive
unencoded information. </p>
-<h2> XFORWARD Server response </h2>
+<h2> XFORWARD Server operation </h2>
-<p> Upon receipt of a correctly formatted XFORWARD command, the
-server stores the specified attribute values, and erases the
-attributes whose value was specified as [UNAVAILABLE]. All XFORWARD
-attributes are reset to the real client information after the MAIL
-FROM transaction completes (i.e. after RSET or DOT). </p>
+<p> Upon receipt of an initial XFORWARD command, the SMTP server
+initializes all XFORWARD attributes to [UNAVAILABLE]. With each
+XFORWARD command, the server overwrites attributes with the specified
+attribute values, and erases attributes whose value is specified
+as [UNAVAILABLE]. Attributes that are not specified in an XFORWARD
+command retain their current value. </p>
+
+<p> An ADDR attribute value of [UNAVAILABLE] indicates that the
+next MAIL FROM transaction is a forwarded local submission. In
+this case the SMTP server should ignore other client attributes.
+This behavior is available with Postfix version 2.6. </p>
+
+<p> At the end of the next MAIL FROM transaction (i.e. RSET or DOT),
+all XFORWARD attributes are reset to the real client information,
+and the SMTP server is ready to receive another initial XFORWARD
+command. </p>
<h2> XFORWARD Server reply codes </h2>
bounce_notify_service.o: ../../include/dsn_buf.h
bounce_notify_service.o: ../../include/dsn_mask.h
bounce_notify_service.o: ../../include/int_filt.h
+bounce_notify_service.o: ../../include/iostuff.h
bounce_notify_service.o: ../../include/mail_addr.h
bounce_notify_service.o: ../../include/mail_error.h
bounce_notify_service.o: ../../include/mail_params.h
+bounce_notify_service.o: ../../include/mail_proto.h
bounce_notify_service.o: ../../include/mail_queue.h
bounce_notify_service.o: ../../include/msg.h
bounce_notify_service.o: ../../include/msg_stats.h
bounce_notify_verp.o: ../../include/dsn_buf.h
bounce_notify_verp.o: ../../include/dsn_mask.h
bounce_notify_verp.o: ../../include/int_filt.h
+bounce_notify_verp.o: ../../include/iostuff.h
bounce_notify_verp.o: ../../include/mail_addr.h
bounce_notify_verp.o: ../../include/mail_error.h
bounce_notify_verp.o: ../../include/mail_params.h
+bounce_notify_verp.o: ../../include/mail_proto.h
bounce_notify_verp.o: ../../include/mail_queue.h
bounce_notify_verp.o: ../../include/msg.h
bounce_notify_verp.o: ../../include/msg_stats.h
bounce_one_service.o: ../../include/dsn_buf.h
bounce_one_service.o: ../../include/dsn_mask.h
bounce_one_service.o: ../../include/int_filt.h
+bounce_one_service.o: ../../include/iostuff.h
bounce_one_service.o: ../../include/mail_addr.h
bounce_one_service.o: ../../include/mail_error.h
bounce_one_service.o: ../../include/mail_params.h
+bounce_one_service.o: ../../include/mail_proto.h
bounce_one_service.o: ../../include/msg.h
bounce_one_service.o: ../../include/msg_stats.h
bounce_one_service.o: ../../include/name_mask.h
bounce_trace_service.o: ../../include/dsn_buf.h
bounce_trace_service.o: ../../include/dsn_mask.h
bounce_trace_service.o: ../../include/int_filt.h
+bounce_trace_service.o: ../../include/iostuff.h
bounce_trace_service.o: ../../include/mail_addr.h
bounce_trace_service.o: ../../include/mail_error.h
bounce_trace_service.o: ../../include/mail_params.h
+bounce_trace_service.o: ../../include/mail_proto.h
bounce_trace_service.o: ../../include/mail_queue.h
bounce_trace_service.o: ../../include/msg.h
bounce_trace_service.o: ../../include/msg_stats.h
cleanup_api.o: cleanup.h
cleanup_api.o: cleanup_api.c
cleanup_body_edit.o: ../../include/argv.h
+cleanup_body_edit.o: ../../include/attr.h
cleanup_body_edit.o: ../../include/been_here.h
cleanup_body_edit.o: ../../include/cleanup_user.h
cleanup_body_edit.o: ../../include/dict.h
cleanup_extracted.o: cleanup.h
cleanup_extracted.o: cleanup_extracted.c
cleanup_final.o: ../../include/argv.h
+cleanup_final.o: ../../include/attr.h
cleanup_final.o: ../../include/been_here.h
cleanup_final.o: ../../include/cleanup_user.h
cleanup_final.o: ../../include/dict.h
cleanup_final.o: cleanup.h
cleanup_final.o: cleanup_final.c
cleanup_init.o: ../../include/argv.h
+cleanup_init.o: ../../include/attr.h
cleanup_init.o: ../../include/been_here.h
cleanup_init.o: ../../include/cleanup_user.h
cleanup_init.o: ../../include/dict.h
cleanup_init.o: cleanup.h
cleanup_init.o: cleanup_init.c
cleanup_map11.o: ../../include/argv.h
+cleanup_map11.o: ../../include/attr.h
cleanup_map11.o: ../../include/been_here.h
cleanup_map11.o: ../../include/cleanup_user.h
cleanup_map11.o: ../../include/dict.h
cleanup_map11.o: cleanup.h
cleanup_map11.o: cleanup_map11.c
cleanup_map1n.o: ../../include/argv.h
+cleanup_map1n.o: ../../include/attr.h
cleanup_map1n.o: ../../include/been_here.h
cleanup_map1n.o: ../../include/cleanup_user.h
cleanup_map1n.o: ../../include/dict.h
cleanup_map1n.o: cleanup.h
cleanup_map1n.o: cleanup_map1n.c
cleanup_masquerade.o: ../../include/argv.h
+cleanup_masquerade.o: ../../include/attr.h
cleanup_masquerade.o: ../../include/been_here.h
cleanup_masquerade.o: ../../include/cleanup_user.h
cleanup_masquerade.o: ../../include/dict.h
cleanup_milter.o: cleanup.h
cleanup_milter.o: cleanup_milter.c
cleanup_out.o: ../../include/argv.h
+cleanup_out.o: ../../include/attr.h
cleanup_out.o: ../../include/been_here.h
cleanup_out.o: ../../include/cleanup_user.h
cleanup_out.o: ../../include/dict.h
cleanup_out_recipient.o: cleanup.h
cleanup_out_recipient.o: cleanup_out_recipient.c
cleanup_region.o: ../../include/argv.h
+cleanup_region.o: ../../include/attr.h
cleanup_region.o: ../../include/been_here.h
cleanup_region.o: ../../include/cleanup_user.h
cleanup_region.o: ../../include/dict.h
state->errs |= CLEANUP_STAT_BAD;
return;
}
+#if 0
/* Zero-length values are place holders for unavailable values. */
if (*attr_value == 0) {
msg_warn("%s: spurious null attribute value for \"%s\" -- ignored",
state->queue_id, attr_name);
return;
}
+#endif
if ((junk = rec_attr_map(attr_name)) != 0) {
mapped_buf = attr_value;
mapped_type = junk;
return;
}
}
- nvtable_update(state->attr, attr_name, attr_value);
+ /* Zero-length values are place holders for non-existent values. */
+ if (*attr_value)
+ nvtable_update(state->attr, attr_name, attr_value);
cleanup_out(state, type, buf, len);
return;
} else {
discard.o: ../../include/dsn_buf.h
discard.o: ../../include/dsn_util.h
discard.o: ../../include/flush_clnt.h
+discard.o: ../../include/iostuff.h
+discard.o: ../../include/mail_proto.h
discard.o: ../../include/mail_queue.h
discard.o: ../../include/mail_server.h
discard.o: ../../include/mail_version.h
int dsn_ret; /* DSN full/header notification */
} DELIVER_REQUEST;
- /*
- * Since we can't send null pointers, null strings represent unavailable
- * attributes instead. They're less likely to explode in our face, too.
- */
-#define DEL_REQ_ATTR_AVAIL(a) (*(a))
-
/*
* How to deliver, really?
*/
#include <sys_defs.h>
#include <sys/stat.h>
+#include <time.h>
#include <errno.h>
/* Utility library. */
}
if ((statp->st_mode & S_IRWXU) != MAIL_QUEUE_STAT_READY)
return (MAIL_OPEN_NO);
+
+ /*
+ * Workaround for spurious "file has 2 links" warnings in showq. As
+ * kernels have evolved from non-interruptible system calls towards
+ * fine-grained locks, the showq command has become likely to observe a
+ * file while the queue manager is in the middle of renaming it, at a
+ * time when the file has links to both the old and new name. We now log
+ * the warning only when the condition appears to be persistent.
+ */
+#define MINUTE_SECONDS 60 /* XXX should be centralized */
+
if (statp->st_nlink > 1) {
- msg_warn("%s: uid %ld: file has %d links", *path,
- (long) statp->st_uid, (int) statp->st_nlink);
+ if (msg_verbose)
+ msg_info("%s: uid %ld: file has %d links", *path,
+ (long) statp->st_uid, (int) statp->st_nlink);
+ else if (statp->st_ctime < time((time_t *) 0) - MINUTE_SECONDS)
+ msg_warn("%s: uid %ld: file has %d links", *path,
+ (long) statp->st_uid, (int) statp->st_nlink);
}
return (MAIL_OPEN_YES);
}
#define MAIL_ATTR_ORG_NONE "unknown" /* origin unknown */
#define MAIL_ATTR_ORG_LOCAL "local" /* local submission */
+ /*
+ * Non-existent attribute values are represented as empty strings (e.g. no
+ * remote client, or no HELO hostname). Unknown attribute values are
+ * represented as "unknown" (e.g., unknown remote client hostname). An empty
+ * string is more convenient to send than a null pointer, and is less likely
+ * to blow up.
+ */
+#define MAIL_ATTR_VAL_NONEXIST ""
+#define MAIL_ATTR_VAL_UNKNOWN "unknown"
+
+#define MAIL_ATTR_IS_EXIST(a) (*(a))
+#define MAIL_ATTR_IS_KNOWN(a) (*(a)) && strcmp((a), MAIL_ATTR_VAL_UNKNOWN)
+
/*
* XCLIENT/XFORWARD in SMTP.
*/
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20080903"
+#define MAIL_RELEASE_DATE "20081002"
#define MAIL_VERSION_NUMBER "2.6"
#ifdef SNAPSHOT
alias.o: ../../include/dsn_mask.h
alias.o: ../../include/fold_addr.h
alias.o: ../../include/htable.h
+alias.o: ../../include/iostuff.h
alias.o: ../../include/mail_params.h
+alias.o: ../../include/mail_proto.h
alias.o: ../../include/maps.h
alias.o: ../../include/mbox_conf.h
alias.o: ../../include/msg.h
command.o: ../../include/dsn_util.h
command.o: ../../include/fold_addr.h
command.o: ../../include/htable.h
+command.o: ../../include/iostuff.h
command.o: ../../include/mac_parse.h
command.o: ../../include/mail_copy.h
command.o: ../../include/mail_params.h
+command.o: ../../include/mail_proto.h
command.o: ../../include/maps.h
command.o: ../../include/mbox_conf.h
command.o: ../../include/msg.h
deliver_attr.o: ../../include/dsn_buf.h
deliver_attr.o: ../../include/fold_addr.h
deliver_attr.o: ../../include/htable.h
+deliver_attr.o: ../../include/iostuff.h
+deliver_attr.o: ../../include/mail_proto.h
deliver_attr.o: ../../include/maps.h
deliver_attr.o: ../../include/mbox_conf.h
deliver_attr.o: ../../include/msg.h
dotforward.o: ../../include/mac_parse.h
dotforward.o: ../../include/mail_conf.h
dotforward.o: ../../include/mail_params.h
+dotforward.o: ../../include/mail_proto.h
dotforward.o: ../../include/maps.h
dotforward.o: ../../include/mbox_conf.h
dotforward.o: ../../include/msg.h
file.o: ../../include/dsn_util.h
file.o: ../../include/fold_addr.h
file.o: ../../include/htable.h
+file.o: ../../include/iostuff.h
file.o: ../../include/mail_copy.h
file.o: ../../include/mail_params.h
+file.o: ../../include/mail_proto.h
file.o: ../../include/maps.h
file.o: ../../include/mbox_conf.h
file.o: ../../include/mbox_open.h
include.o: ../../include/htable.h
include.o: ../../include/iostuff.h
include.o: ../../include/mail_params.h
+include.o: ../../include/mail_proto.h
include.o: ../../include/maps.h
include.o: ../../include/mbox_conf.h
include.o: ../../include/msg.h
indirect.o: ../../include/dsn_buf.h
indirect.o: ../../include/fold_addr.h
indirect.o: ../../include/htable.h
+indirect.o: ../../include/iostuff.h
indirect.o: ../../include/mail_params.h
+indirect.o: ../../include/mail_proto.h
indirect.o: ../../include/maps.h
indirect.o: ../../include/mbox_conf.h
indirect.o: ../../include/msg.h
local.o: ../../include/mail_addr.h
local.o: ../../include/mail_conf.h
local.o: ../../include/mail_params.h
+local.o: ../../include/mail_proto.h
local.o: ../../include/mail_server.h
local.o: ../../include/mail_version.h
local.o: ../../include/maps.h
local_expand.o: ../../include/dsn_buf.h
local_expand.o: ../../include/fold_addr.h
local_expand.o: ../../include/htable.h
+local_expand.o: ../../include/iostuff.h
local_expand.o: ../../include/mac_expand.h
local_expand.o: ../../include/mac_parse.h
local_expand.o: ../../include/mail_params.h
+local_expand.o: ../../include/mail_proto.h
local_expand.o: ../../include/maps.h
local_expand.o: ../../include/mbox_conf.h
local_expand.o: ../../include/msg_stats.h
maildir.o: ../../include/fold_addr.h
maildir.o: ../../include/get_hostname.h
maildir.o: ../../include/htable.h
+maildir.o: ../../include/iostuff.h
maildir.o: ../../include/mail_copy.h
maildir.o: ../../include/mail_params.h
+maildir.o: ../../include/mail_proto.h
maildir.o: ../../include/make_dirs.h
maildir.o: ../../include/maps.h
maildir.o: ../../include/mbox_conf.h
recipient.o: ../../include/ext_prop.h
recipient.o: ../../include/fold_addr.h
recipient.o: ../../include/htable.h
+recipient.o: ../../include/iostuff.h
recipient.o: ../../include/mail_params.h
+recipient.o: ../../include/mail_proto.h
recipient.o: ../../include/maps.h
recipient.o: ../../include/mbox_conf.h
recipient.o: ../../include/msg.h
token.o: ../../include/dsn_buf.h
token.o: ../../include/fold_addr.h
token.o: ../../include/htable.h
+token.o: ../../include/iostuff.h
token.o: ../../include/mail_params.h
+token.o: ../../include/mail_proto.h
token.o: ../../include/maps.h
token.o: ../../include/mbox_conf.h
token.o: ../../include/msg.h
milter_macros.o: ../../include/attr.h
milter_macros.o: ../../include/iostuff.h
milter_macros.o: ../../include/mail_proto.h
+milter_macros.o: ../../include/msg.h
milter_macros.o: ../../include/mymalloc.h
milter_macros.o: ../../include/sys_defs.h
milter_macros.o: ../../include/vbuf.h
qmgr_active.o: ../../include/dsn_buf.h
qmgr_active.o: ../../include/dsn_mask.h
qmgr_active.o: ../../include/events.h
+qmgr_active.o: ../../include/iostuff.h
qmgr_active.o: ../../include/mail_open_ok.h
qmgr_active.o: ../../include/mail_params.h
+qmgr_active.o: ../../include/mail_proto.h
qmgr_active.o: ../../include/mail_queue.h
qmgr_active.o: ../../include/msg.h
qmgr_active.o: ../../include/msg_stats.h
qmgr_bounce.o: ../../include/deliver_request.h
qmgr_bounce.o: ../../include/dsn.h
qmgr_bounce.o: ../../include/dsn_buf.h
+qmgr_bounce.o: ../../include/iostuff.h
+qmgr_bounce.o: ../../include/mail_proto.h
qmgr_bounce.o: ../../include/msg_stats.h
qmgr_bounce.o: ../../include/recipient_list.h
qmgr_bounce.o: ../../include/scan_dir.h
qmgr_entry.o: ../../include/deliver_request.h
qmgr_entry.o: ../../include/dsn.h
qmgr_entry.o: ../../include/events.h
+qmgr_entry.o: ../../include/iostuff.h
qmgr_entry.o: ../../include/mail_params.h
+qmgr_entry.o: ../../include/mail_proto.h
qmgr_entry.o: ../../include/msg.h
qmgr_entry.o: ../../include/msg_stats.h
qmgr_entry.o: ../../include/mymalloc.h
/* qmgr_deliver() executes when a delivery process announces its
/* availability for the named transport. It arranges for delivery
/* of a suitable queue entry. The \fIfp\fR argument specifies a
-/* stream that is connected to the delivery process. Upon completion
+/* stream that is connected to the delivery process, or a null
+/* pointer if the transport accepts no connection. Upon completion
/* of delivery (successful or not), the stream is closed, so that the
/* delivery process is released.
/* DIAGNOSTICS
} else if (strcmp(name, MAIL_ATTR_ACT_HELO_NAME) == 0) {
if (have_log_client_attr == 0 && message->client_helo == 0)
message->client_helo = mystrdup(value);
+ } else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_PORT) == 0) {
+ if (have_log_client_attr == 0 && message->client_port == 0)
+ message->client_port = mystrdup(value);
}
/* Original client attributes. */
else if (strcmp(name, MAIL_ATTR_LOG_CLIENT_NAME) == 0) {
transport->pending += 1;
if ((alloc->stream = mail_connect(MAIL_CLASS_PRIVATE, transport->name,
NON_BLOCKING)) == 0) {
- msg_warn("connect to transport %s: %m", transport->name);
+ msg_warn("connect to transport %s/%s: %m",
+ MAIL_CLASS_PRIVATE, transport->name);
event_request_timer(qmgr_transport_event, (char *) alloc, 0);
return;
}
pipe.o: ../../include/mail_conf.h
pipe.o: ../../include/mail_copy.h
pipe.o: ../../include/mail_params.h
+pipe.o: ../../include/mail_proto.h
pipe.o: ../../include/mail_server.h
pipe.o: ../../include/mail_version.h
pipe.o: ../../include/msg.h
qmgr_active.o: ../../include/dsn_buf.h
qmgr_active.o: ../../include/dsn_mask.h
qmgr_active.o: ../../include/events.h
+qmgr_active.o: ../../include/iostuff.h
qmgr_active.o: ../../include/mail_open_ok.h
qmgr_active.o: ../../include/mail_params.h
+qmgr_active.o: ../../include/mail_proto.h
qmgr_active.o: ../../include/mail_queue.h
qmgr_active.o: ../../include/msg.h
qmgr_active.o: ../../include/msg_stats.h
qmgr_bounce.o: ../../include/deliver_request.h
qmgr_bounce.o: ../../include/dsn.h
qmgr_bounce.o: ../../include/dsn_buf.h
+qmgr_bounce.o: ../../include/iostuff.h
+qmgr_bounce.o: ../../include/mail_proto.h
qmgr_bounce.o: ../../include/msg_stats.h
qmgr_bounce.o: ../../include/recipient_list.h
qmgr_bounce.o: ../../include/scan_dir.h
qmgr_entry.o: ../../include/deliver_request.h
qmgr_entry.o: ../../include/dsn.h
qmgr_entry.o: ../../include/events.h
+qmgr_entry.o: ../../include/iostuff.h
qmgr_entry.o: ../../include/mail_params.h
+qmgr_entry.o: ../../include/mail_proto.h
qmgr_entry.o: ../../include/msg.h
qmgr_entry.o: ../../include/msg_stats.h
qmgr_entry.o: ../../include/mymalloc.h
/* qmgr_deliver() executes when a delivery process announces its
/* availability for the named transport. It arranges for delivery
/* of a suitable queue entry. The \fIfp\fR argument specifies a
-/* stream that is connected to the delivery process. Upon completion
+/* stream that is connected to a delivery process, or a null
+/* pointer if the transport accepts no connection. Upon completion
/* of delivery (successful or not), the stream is closed, so that the
/* delivery process is released.
/* DIAGNOSTICS
} else if (strcmp(name, MAIL_ATTR_ACT_HELO_NAME) == 0) {
if (have_log_client_attr == 0 && message->client_helo == 0)
message->client_helo = mystrdup(value);
+ } else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_PORT) == 0) {
+ if (have_log_client_attr == 0 && message->client_port == 0)
+ message->client_port = mystrdup(value);
}
/* Original client attributes. */
else if (strcmp(name, MAIL_ATTR_LOG_CLIENT_NAME) == 0) {
transport->pending += 1;
if ((alloc->stream = mail_connect(MAIL_CLASS_PRIVATE, transport->name,
NON_BLOCKING)) == 0) {
- msg_warn("connect to transport %s: %m", transport->name);
+ msg_warn("connect to transport %s/%s: %m",
+ MAIL_CLASS_PRIVATE, transport->name);
event_request_timer(qmgr_transport_event, (char *) alloc, 0);
return;
}
get_mail_conf_int2(name, _INIT_DEST_CON,
var_init_dest_concurrency, 1, 0);
transport->rate_delay = get_mail_conf_time2(name, _DEST_RATE_DELAY,
- var_dest_rate_delay,
+ var_dest_rate_delay,
's', 0, 0);
if (transport->rate_delay > 0)
static void qmqpd_write_attributes(QMQPD_STATE *state)
{
- /*
- * Logging attributes, also used for XFORWARD.
- */
- if (IS_AVAIL_CLIENT_NAME(state->name))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
- MAIL_ATTR_LOG_CLIENT_NAME, state->name);
- if (IS_AVAIL_CLIENT_ADDR(state->addr))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
- MAIL_ATTR_LOG_CLIENT_ADDR, state->rfc_addr);
- if (IS_AVAIL_CLIENT_PORT(state->port))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
- MAIL_ATTR_LOG_CLIENT_PORT, state->port);
- if (IS_AVAIL_CLIENT_NAMADDR(state->namaddr))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
- MAIL_ATTR_LOG_ORIGIN, state->namaddr);
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
- MAIL_ATTR_LOG_PROTO_NAME, state->protocol);
-
/*
* Provenance attributes for Milter policy etc.
*/
#define CLIENT_PORT_UNKNOWN CLIENT_ATTR_UNKNOWN
#define CLIENT_NAMADDR_UNKNOWN CLIENT_ATTR_UNKNOWN
-#define IS_AVAIL_CLIENT_ATTR(v) ((v) && strcmp((v), CLIENT_ATTR_UNKNOWN))
-
-#define IS_AVAIL_CLIENT_NAME(v) IS_AVAIL_CLIENT_ATTR(v)
-#define IS_AVAIL_CLIENT_ADDR(v) IS_AVAIL_CLIENT_ATTR(v)
-#define IS_AVAIL_CLIENT_PORT(v) IS_AVAIL_CLIENT_ATTR(v)
-#define IS_AVAIL_CLIENT_NAMADDR(v) IS_AVAIL_CLIENT_ATTR(v)
-
/*
* QMQP protocol status codes.
*/
smtp.o: ../../include/header_body_checks.h
smtp.o: ../../include/header_opts.h
smtp.o: ../../include/htable.h
+smtp.o: ../../include/iostuff.h
smtp.o: ../../include/mail_conf.h
smtp.o: ../../include/mail_params.h
+smtp.o: ../../include/mail_proto.h
smtp.o: ../../include/mail_server.h
smtp.o: ../../include/mail_version.h
smtp.o: ../../include/maps.h
smtp_addr.o: ../../include/htable.h
smtp_addr.o: ../../include/inet_addr_list.h
smtp_addr.o: ../../include/inet_proto.h
+smtp_addr.o: ../../include/iostuff.h
smtp_addr.o: ../../include/mail_params.h
+smtp_addr.o: ../../include/mail_proto.h
smtp_addr.o: ../../include/maps.h
smtp_addr.o: ../../include/match_list.h
smtp_addr.o: ../../include/match_ops.h
smtp_addr.o: ../../include/myaddrinfo.h
smtp_addr.o: ../../include/mymalloc.h
smtp_addr.o: ../../include/name_code.h
+smtp_addr.o: ../../include/name_mask.h
smtp_addr.o: ../../include/own_inet_addr.h
smtp_addr.o: ../../include/recipient_list.h
smtp_addr.o: ../../include/resolve_clnt.h
smtp_chat.o: ../../include/header_opts.h
smtp_chat.o: ../../include/htable.h
smtp_chat.o: ../../include/int_filt.h
+smtp_chat.o: ../../include/iostuff.h
smtp_chat.o: ../../include/line_wrap.h
smtp_chat.o: ../../include/mail_addr.h
smtp_chat.o: ../../include/mail_error.h
smtp_chat.o: ../../include/mail_params.h
+smtp_chat.o: ../../include/mail_proto.h
smtp_chat.o: ../../include/maps.h
smtp_chat.o: ../../include/match_list.h
smtp_chat.o: ../../include/match_ops.h
smtp_map11.o: ../../include/header_body_checks.h
smtp_map11.o: ../../include/header_opts.h
smtp_map11.o: ../../include/htable.h
+smtp_map11.o: ../../include/iostuff.h
smtp_map11.o: ../../include/mail_addr_map.h
+smtp_map11.o: ../../include/mail_proto.h
smtp_map11.o: ../../include/maps.h
smtp_map11.o: ../../include/match_list.h
smtp_map11.o: ../../include/match_ops.h
smtp_map11.o: ../../include/msg.h
smtp_map11.o: ../../include/msg_stats.h
smtp_map11.o: ../../include/name_code.h
+smtp_map11.o: ../../include/name_mask.h
smtp_map11.o: ../../include/quote_822_local.h
smtp_map11.o: ../../include/quote_flags.h
smtp_map11.o: ../../include/recipient_list.h
smtp_rcpt.o: ../../include/header_body_checks.h
smtp_rcpt.o: ../../include/header_opts.h
smtp_rcpt.o: ../../include/htable.h
+smtp_rcpt.o: ../../include/iostuff.h
+smtp_rcpt.o: ../../include/mail_proto.h
smtp_rcpt.o: ../../include/maps.h
smtp_rcpt.o: ../../include/match_list.h
smtp_rcpt.o: ../../include/match_ops.h
smtp_rcpt.o: ../../include/msg_stats.h
smtp_rcpt.o: ../../include/mymalloc.h
smtp_rcpt.o: ../../include/name_code.h
+smtp_rcpt.o: ../../include/name_mask.h
smtp_rcpt.o: ../../include/recipient_list.h
smtp_rcpt.o: ../../include/resolve_clnt.h
smtp_rcpt.o: ../../include/scache.h
smtp_reuse.o: ../../include/header_body_checks.h
smtp_reuse.o: ../../include/header_opts.h
smtp_reuse.o: ../../include/htable.h
+smtp_reuse.o: ../../include/iostuff.h
smtp_reuse.o: ../../include/mail_params.h
+smtp_reuse.o: ../../include/mail_proto.h
smtp_reuse.o: ../../include/maps.h
smtp_reuse.o: ../../include/match_list.h
smtp_reuse.o: ../../include/match_ops.h
smtp_reuse.o: ../../include/msg_stats.h
smtp_reuse.o: ../../include/mymalloc.h
smtp_reuse.o: ../../include/name_code.h
+smtp_reuse.o: ../../include/name_mask.h
smtp_reuse.o: ../../include/recipient_list.h
smtp_reuse.o: ../../include/resolve_clnt.h
smtp_reuse.o: ../../include/scache.h
smtp_sasl_auth_cache.o: ../../include/header_body_checks.h
smtp_sasl_auth_cache.o: ../../include/header_opts.h
smtp_sasl_auth_cache.o: ../../include/htable.h
+smtp_sasl_auth_cache.o: ../../include/iostuff.h
+smtp_sasl_auth_cache.o: ../../include/mail_proto.h
smtp_sasl_auth_cache.o: ../../include/maps.h
smtp_sasl_auth_cache.o: ../../include/match_list.h
smtp_sasl_auth_cache.o: ../../include/match_ops.h
smtp_sasl_auth_cache.o: ../../include/msg_stats.h
smtp_sasl_auth_cache.o: ../../include/mymalloc.h
smtp_sasl_auth_cache.o: ../../include/name_code.h
+smtp_sasl_auth_cache.o: ../../include/name_mask.h
smtp_sasl_auth_cache.o: ../../include/recipient_list.h
smtp_sasl_auth_cache.o: ../../include/resolve_clnt.h
smtp_sasl_auth_cache.o: ../../include/scache.h
smtp_sasl_glue.o: ../../include/header_body_checks.h
smtp_sasl_glue.o: ../../include/header_opts.h
smtp_sasl_glue.o: ../../include/htable.h
+smtp_sasl_glue.o: ../../include/iostuff.h
smtp_sasl_glue.o: ../../include/mail_addr_find.h
smtp_sasl_glue.o: ../../include/mail_params.h
+smtp_sasl_glue.o: ../../include/mail_proto.h
smtp_sasl_glue.o: ../../include/maps.h
smtp_sasl_glue.o: ../../include/match_list.h
smtp_sasl_glue.o: ../../include/match_ops.h
smtp_sasl_glue.o: ../../include/msg_stats.h
smtp_sasl_glue.o: ../../include/mymalloc.h
smtp_sasl_glue.o: ../../include/name_code.h
+smtp_sasl_glue.o: ../../include/name_mask.h
smtp_sasl_glue.o: ../../include/recipient_list.h
smtp_sasl_glue.o: ../../include/resolve_clnt.h
smtp_sasl_glue.o: ../../include/scache.h
smtp_sasl_proto.o: ../../include/header_body_checks.h
smtp_sasl_proto.o: ../../include/header_opts.h
smtp_sasl_proto.o: ../../include/htable.h
+smtp_sasl_proto.o: ../../include/iostuff.h
smtp_sasl_proto.o: ../../include/mail_params.h
+smtp_sasl_proto.o: ../../include/mail_proto.h
smtp_sasl_proto.o: ../../include/maps.h
smtp_sasl_proto.o: ../../include/match_list.h
smtp_sasl_proto.o: ../../include/match_ops.h
smtp_sasl_proto.o: ../../include/msg_stats.h
smtp_sasl_proto.o: ../../include/mymalloc.h
smtp_sasl_proto.o: ../../include/name_code.h
+smtp_sasl_proto.o: ../../include/name_mask.h
smtp_sasl_proto.o: ../../include/recipient_list.h
smtp_sasl_proto.o: ../../include/resolve_clnt.h
smtp_sasl_proto.o: ../../include/scache.h
smtp_session.o: ../../include/header_body_checks.h
smtp_session.o: ../../include/header_opts.h
smtp_session.o: ../../include/htable.h
+smtp_session.o: ../../include/iostuff.h
smtp_session.o: ../../include/mail_params.h
+smtp_session.o: ../../include/mail_proto.h
smtp_session.o: ../../include/maps.h
smtp_session.o: ../../include/match_list.h
smtp_session.o: ../../include/match_ops.h
smtp_session.o: ../../include/msg_stats.h
smtp_session.o: ../../include/mymalloc.h
smtp_session.o: ../../include/name_code.h
+smtp_session.o: ../../include/name_mask.h
smtp_session.o: ../../include/recipient_list.h
smtp_session.o: ../../include/resolve_clnt.h
smtp_session.o: ../../include/scache.h
smtp_state.o: ../../include/header_body_checks.h
smtp_state.o: ../../include/header_opts.h
smtp_state.o: ../../include/htable.h
+smtp_state.o: ../../include/iostuff.h
smtp_state.o: ../../include/mail_params.h
+smtp_state.o: ../../include/mail_proto.h
smtp_state.o: ../../include/maps.h
smtp_state.o: ../../include/match_list.h
smtp_state.o: ../../include/match_ops.h
smtp_state.o: ../../include/msg_stats.h
smtp_state.o: ../../include/mymalloc.h
smtp_state.o: ../../include/name_code.h
+smtp_state.o: ../../include/name_mask.h
smtp_state.o: ../../include/recipient_list.h
smtp_state.o: ../../include/resolve_clnt.h
smtp_state.o: ../../include/scache.h
smtp_trouble.o: ../../include/header_body_checks.h
smtp_trouble.o: ../../include/header_opts.h
smtp_trouble.o: ../../include/htable.h
+smtp_trouble.o: ../../include/iostuff.h
smtp_trouble.o: ../../include/mail_error.h
+smtp_trouble.o: ../../include/mail_proto.h
smtp_trouble.o: ../../include/maps.h
smtp_trouble.o: ../../include/match_list.h
smtp_trouble.o: ../../include/match_ops.h
smtp_unalias.o: ../../include/header_body_checks.h
smtp_unalias.o: ../../include/header_opts.h
smtp_unalias.o: ../../include/htable.h
+smtp_unalias.o: ../../include/iostuff.h
+smtp_unalias.o: ../../include/mail_proto.h
smtp_unalias.o: ../../include/maps.h
smtp_unalias.o: ../../include/match_list.h
smtp_unalias.o: ../../include/match_ops.h
smtp_unalias.o: ../../include/msg_stats.h
smtp_unalias.o: ../../include/myaddrinfo.h
smtp_unalias.o: ../../include/name_code.h
+smtp_unalias.o: ../../include/name_mask.h
smtp_unalias.o: ../../include/recipient_list.h
smtp_unalias.o: ../../include/resolve_clnt.h
smtp_unalias.o: ../../include/scache.h
if (session->features & SMTP_FEATURE_XFORWARD_NAME) {
vstring_strcat(next_command, " " XFORWARD_NAME "=");
xtext_quote_append(next_command,
- DEL_REQ_ATTR_AVAIL(request->client_name) ?
+ MAIL_ATTR_IS_KNOWN(request->client_name) ?
request->client_name : XFORWARD_UNAVAILABLE, "");
}
if (session->features & SMTP_FEATURE_XFORWARD_ADDR) {
vstring_strcat(next_command, " " XFORWARD_ADDR "=");
xtext_quote_append(next_command,
- DEL_REQ_ATTR_AVAIL(request->client_addr) ?
+ MAIL_ATTR_IS_KNOWN(request->client_addr) ?
request->client_addr : XFORWARD_UNAVAILABLE, "");
}
if (session->features & SMTP_FEATURE_XFORWARD_PORT) {
vstring_strcat(next_command, " " XFORWARD_PORT "=");
xtext_quote_append(next_command,
- DEL_REQ_ATTR_AVAIL(request->client_port) ?
+ MAIL_ATTR_IS_KNOWN(request->client_port) ?
request->client_port : XFORWARD_UNAVAILABLE, "");
}
if (session->send_proto_helo)
if (session->features & SMTP_FEATURE_XFORWARD_PROTO) {
vstring_strcat(next_command, " " XFORWARD_PROTO "=");
xtext_quote_append(next_command,
- DEL_REQ_ATTR_AVAIL(request->client_proto) ?
+ MAIL_ATTR_IS_KNOWN(request->client_proto) ?
request->client_proto : XFORWARD_UNAVAILABLE, "");
}
if (session->features & SMTP_FEATURE_XFORWARD_HELO) {
vstring_strcat(next_command, " " XFORWARD_HELO "=");
xtext_quote_append(next_command,
- DEL_REQ_ATTR_AVAIL(request->client_helo) ?
+ MAIL_ATTR_IS_EXIST(request->client_helo) ?
request->client_helo : XFORWARD_UNAVAILABLE, "");
}
if (session->features & SMTP_FEATURE_XFORWARD_DOMAIN) {
vstring_strcat(next_command, " " XFORWARD_DOMAIN "=");
xtext_quote_append(next_command,
- DEL_REQ_ATTR_AVAIL(request->rewrite_context) == 0 ?
+ MAIL_ATTR_IS_EXIST(request->rewrite_context) == 0 ?
XFORWARD_UNAVAILABLE :
strcmp(request->rewrite_context, MAIL_ATTR_RWR_LOCAL) ?
XFORWARD_DOM_REMOTE : XFORWARD_DOM_LOCAL, "");
}
/*
- * Use the XFORWARD command to forward client attributes only when a
- * minimal amount of information is available.
+ * Use the XFORWARD command to send local/remote submission information.
*/
send_name_addr =
var_smtp_send_xforward
- && (((session->features & SMTP_FEATURE_XFORWARD_NAME)
- && DEL_REQ_ATTR_AVAIL(request->client_name))
- || ((session->features & SMTP_FEATURE_XFORWARD_ADDR)
- && DEL_REQ_ATTR_AVAIL(request->client_addr)));
+ && (session->features & (SMTP_FEATURE_XFORWARD_NAME
+ | SMTP_FEATURE_XFORWARD_ADDR));
session->send_proto_helo =
var_smtp_send_xforward
- && (((session->features & SMTP_FEATURE_XFORWARD_PROTO)
- && DEL_REQ_ATTR_AVAIL(request->client_proto))
- || ((session->features & SMTP_FEATURE_XFORWARD_HELO)
- && DEL_REQ_ATTR_AVAIL(request->client_helo)));
+ && (session->features & (SMTP_FEATURE_XFORWARD_PROTO
+ | SMTP_FEATURE_XFORWARD_HELO
+ | SMTP_FEATURE_XFORWARD_DOMAIN));
if (send_name_addr)
recv_state = send_state = SMTP_STATE_XFORWARD_NAME_ADDR;
else if (session->send_proto_helo)
if (SMTPD_STAND_ALONE(state) == 0) {
/*
- * Attributes for logging, also used for XFORWARD.
+ * Forwarded client attributes.
+ *
+ * In the case of a forwarded remote submission, store original
+ * client attributes in our own internal representation: either
+ * actual values or "unknown"; don't bother with storing
+ * non-existent HELO attributes.
+ *
+ * In the case of a forwarded local submission, specify explicitly
+ * that the original client attributes are non-existent.
*/
- if (IS_AVAIL_CLIENT_NAME(FORWARD_NAME(state)))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
+ if (state->xforward.flags & SMTPD_STATE_XFORWARD_CLIENT_MASK) {
+ if (MAIL_ATTR_IS_KNOWN(FORWARD_ADDR(state))) {
+ rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
MAIL_ATTR_LOG_CLIENT_NAME, FORWARD_NAME(state));
- if (IS_AVAIL_CLIENT_ADDR(FORWARD_ADDR(state)))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
+ rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
MAIL_ATTR_LOG_CLIENT_ADDR, FORWARD_ADDR(state));
- if (IS_AVAIL_CLIENT_PORT(FORWARD_PORT(state)))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
+ rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
MAIL_ATTR_LOG_CLIENT_PORT, FORWARD_PORT(state));
- if (IS_AVAIL_CLIENT_NAMADDR(FORWARD_NAMADDR(state)))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
- MAIL_ATTR_LOG_ORIGIN, FORWARD_NAMADDR(state));
- if (IS_AVAIL_CLIENT_HELO(FORWARD_HELO(state)))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
- MAIL_ATTR_LOG_HELO_NAME, FORWARD_HELO(state));
- if (IS_AVAIL_CLIENT_PROTO(FORWARD_PROTO(state)))
- rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
+ rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
+ MAIL_ATTR_LOG_ORIGIN, FORWARD_NAMADDR(state));
+ if (FORWARD_HELO(state))
+ rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
+ MAIL_ATTR_LOG_HELO_NAME, FORWARD_HELO(state));
+ rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
MAIL_ATTR_LOG_PROTO_NAME, FORWARD_PROTO(state));
+ } else {
+ /* Local submission. */
+ rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s",
+ MAIL_ATTR_LOG_CLIENT_ADDR, MAIL_ATTR_VAL_NONEXIST);
+ }
+ }
/*
* Attributes with actual client information. These are used by
*
* Note 1: inside the SMTP server, forwarded attributes must have the exact
* same representation as normal attributes: unknown string values are
- * "unknown", except for HELO which defaults to null. This is better than
- * having to change every piece of code that accesses a possibly forwarded
- * attribute.
+ * "unknown", and non-existent HELO is null.
*
- * Note 2: outside the SMTP server, the representation of unknown/known
- * attribute values is different in queue files, in queue manager delivery
- * requests, and in over-the-network XFORWARD commands.
+ * Note 2: the SMTP server representation of unknown/known attribute values is
+ * also used in queue files and in delivery requests, while non-existent
+ * information is represented in those contexts as empty strings. In queue
+ * files and delivery requests, forwarded local submissions are represented
+ * by forwarded client attributes with empty string values (actually one
+ * attribute is sufficient).
*
* Note 3: if forwarding client information, don't mix information from the
* current SMTP session with forwarded information from an up-stream
/* void smtpd_xforward_init(state)
/* SMTPD_STATE *state;
/*
+/* void smtpd_xforward_preset(state)
+/* SMTPD_STATE *state;
+/*
/* void smtpd_xforward_reset(state)
/* SMTPD_STATE *state;
/* DESCRIPTION
safe_open.o: msg.h
safe_open.o: safe_open.c
safe_open.o: safe_open.h
+safe_open.o: stringops.h
safe_open.o: sys_defs.h
safe_open.o: vbuf.h
safe_open.o: vstream.h
#include <sys_defs.h>
#include <unistd.h>
#include <errno.h>
+#include <time.h>
/* Utility library. */
{
const char *start = buf;
ssize_t count;
+ time_t expire;
+ int time_left = timeout;
+
+ if (time_left > 0)
+ expire = time((time_t *) 0) + time_left;
while (len > 0) {
- if (timeout > 0 && write_wait(fd, timeout) < 0)
+ if (time_left > 0 && write_wait(fd, time_left) < 0)
return (-1);
if ((count = write(fd, buf, len)) < 0) {
- if (errno == EAGAIN && timeout > 0)
- continue;
- if (errno == EINTR)
- continue;
- return (-1);
+ if ((errno == EAGAIN && time_left > 0) || errno == EINTR)
+ /* void */ ;
+ else
+ return (-1);
+ } else {
+ buf += count;
+ len -= count;
+ }
+ if (len > 0 && time_left > 0) {
+ time_left = expire - time((time_t *) 0);
+ if (time_left <= 0) {
+ errno = ETIMEDOUT;
+ return (-1);
+ }
}
- if (count == 0)
- msg_fatal("write returned 0");
- buf += count;
- len -= count;
}
return (buf - start);
}
deliver_attr.o: ../../include/dict.h
deliver_attr.o: ../../include/dsn.h
deliver_attr.o: ../../include/dsn_buf.h
+deliver_attr.o: ../../include/iostuff.h
+deliver_attr.o: ../../include/mail_proto.h
deliver_attr.o: ../../include/maps.h
deliver_attr.o: ../../include/mbox_conf.h
deliver_attr.o: ../../include/msg.h
mailbox.o: ../../include/dsn.h
mailbox.o: ../../include/dsn_buf.h
mailbox.o: ../../include/dsn_util.h
+mailbox.o: ../../include/iostuff.h
mailbox.o: ../../include/mail_addr_find.h
mailbox.o: ../../include/mail_copy.h
mailbox.o: ../../include/mail_params.h
+mailbox.o: ../../include/mail_proto.h
mailbox.o: ../../include/maps.h
mailbox.o: ../../include/mbox_conf.h
mailbox.o: ../../include/mbox_open.h
maildir.o: ../../include/dsn_buf.h
maildir.o: ../../include/dsn_util.h
maildir.o: ../../include/get_hostname.h
+maildir.o: ../../include/iostuff.h
maildir.o: ../../include/mail_copy.h
maildir.o: ../../include/mail_params.h
+maildir.o: ../../include/mail_proto.h
maildir.o: ../../include/make_dirs.h
maildir.o: ../../include/maps.h
maildir.o: ../../include/mbox_conf.h
recipient.o: ../../include/dict.h
recipient.o: ../../include/dsn.h
recipient.o: ../../include/dsn_buf.h
+recipient.o: ../../include/iostuff.h
+recipient.o: ../../include/mail_proto.h
recipient.o: ../../include/maps.h
recipient.o: ../../include/mbox_conf.h
recipient.o: ../../include/msg.h
unknown.o: ../../include/dict.h
unknown.o: ../../include/dsn.h
unknown.o: ../../include/dsn_buf.h
+unknown.o: ../../include/iostuff.h
+unknown.o: ../../include/mail_proto.h
unknown.o: ../../include/maps.h
unknown.o: ../../include/mbox_conf.h
unknown.o: ../../include/msg.h
virtual.o: ../../include/mail_addr_find.h
virtual.o: ../../include/mail_conf.h
virtual.o: ../../include/mail_params.h
+virtual.o: ../../include/mail_proto.h
virtual.o: ../../include/mail_queue.h
virtual.o: ../../include/mail_server.h
virtual.o: ../../include/mail_version.h