summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/enqueue.c
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-12-12 14:04:00 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-12-12 14:04:00 +0000
commit9dfe6e27554c4e9ba33949827433f475758d59f1 (patch)
tree03fdbacb300cbac33848fe257e081297a144c613 /usr.sbin/smtpd/enqueue.c
parent32ca805073b05a555e12df3429094a6a0fd4d86d (diff)
When acting as a client do content reads from the disk progressively
as the remote accepts more data instead of doing one big read into the memory in the beginning of session.
Diffstat (limited to 'usr.sbin/smtpd/enqueue.c')
-rw-r--r--usr.sbin/smtpd/enqueue.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index f5f6c949f95..251a2346c1f 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.28 2009/12/12 10:33:11 jacekm Exp $ */
+/* $OpenBSD: enqueue.c,v 1.29 2009/12/12 14:03:59 jacekm Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -27,6 +27,7 @@
#include <err.h>
#include <errno.h>
#include <event.h>
+#include <fcntl.h>
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
@@ -190,7 +191,8 @@ enqueue(int argc, char *argv[])
msg.fd = open_connection();
/* init session */
- pcb = client_init(msg.fd, "localhost", verbose);
+ pcb = client_init(msg.fd, open("/dev/null", O_RDONLY), "localhost",
+ verbose);
/* parse message */
if ((body = buf_dynamic(0, SIZE_T_MAX)) < 0)
@@ -208,25 +210,25 @@ enqueue(int argc, char *argv[])
/* add From */
if (!msg.saw_from)
- client_data_printf(pcb, "From: %s%s<%s>\n",
+ client_printf(pcb, "From: %s%s<%s>\n",
msg.fromname ? msg.fromname : "",
msg.fromname ? " " : "",
msg.from);
/* add Date */
if (!msg.saw_date)
- client_data_printf(pcb, "Date: %s\n", time_to_text(timestamp));
+ client_printf(pcb, "Date: %s\n", time_to_text(timestamp));
/* add Message-Id */
if (!msg.saw_msgid)
- client_data_printf(pcb, "Message-Id: <%llu.enqueue@%s>\n",
+ client_printf(pcb, "Message-Id: <%llu.enqueue@%s>\n",
generate_uid(), host);
/* add separating newline */
if (noheader)
- client_data_printf(pcb, "\n");
+ client_printf(pcb, "\n");
- client_data_printf(pcb, "%.*s", buf_size(body), body->buf);
+ client_printf(pcb, "%.*s", buf_size(body), body->buf);
buf_free(body);
/* run the protocol engine */