summaryrefslogtreecommitdiffstats
path: root/usr.sbin/smtpd/enqueue.c
diff options
context:
space:
mode:
authoreric <eric@openbsd.org>2013-01-31 18:34:43 +0000
committereric <eric@openbsd.org>2013-01-31 18:34:43 +0000
commit1c6ac25114bf06f7d43719e74b098aea17cee49c (patch)
treec6a9197bc346c4c8a38fb7caf01b634152987a65 /usr.sbin/smtpd/enqueue.c
parentdo not need to tweak the socket sndbuf, now that the envelopes are passed (diff)
downloadwireguard-openbsd-1c6ac25114bf06f7d43719e74b098aea17cee49c.tar.xz
wireguard-openbsd-1c6ac25114bf06f7d43719e74b098aea17cee49c.zip
assorted fixes spotted by Coverity.
some log message updates. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/enqueue.c')
-rw-r--r--usr.sbin/smtpd/enqueue.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index 8d332544199..0413d27927d 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.66 2013/01/26 09:37:23 gilles Exp $ */
+/* $OpenBSD: enqueue.c,v 1.67 2013/01/31 18:34:43 eric Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -23,6 +23,7 @@
#include <sys/socket.h>
#include <sys/tree.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <ctype.h>
#include <err.h>
@@ -680,6 +681,8 @@ rcpt_add(char *addr)
if ((p = strchr(addr, ',')) != NULL)
*p++ = '\0';
msg.rcpts[msg.rcpt_cnt++] = qualify_addr(addr);
+ if (p == NULL)
+ break;
addr = p;
}
}
@@ -732,6 +735,7 @@ enqueue_offline(int argc, char *argv[])
char path[MAXPATHLEN];
FILE *fp;
int i, fd, ch;
+ mode_t omode;
if (ckdir(PATH_SPOOL PATH_OFFLINE, 01777, 0, 0, 0) == 0)
errx(1, "error in offline directory setup");
@@ -740,12 +744,14 @@ enqueue_offline(int argc, char *argv[])
PATH_OFFLINE, (long long int) time(NULL)))
err(1, "snprintf");
+ omode = umask(7077);
if ((fd = mkstemp(path)) == -1 || (fp = fdopen(fd, "w+")) == NULL) {
warn("cannot create temporary file %s", path);
if (fd != -1)
unlink(path);
exit(1);
}
+ umask(omode);
for (i = 1; i < argc; i++) {
if (strchr(argv[i], '|') != NULL) {