summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2015-10-06 06:04:47 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2015-10-06 06:04:47 +0000
commitf5cc67c3313cce02d40f01ef436afdbc3ef72cbf (patch)
tree8f0897c7922bc50ea41a93d99ffe835a90db687a
parentcc8bc8b2b5d8683469535a630d65be7c45e70680 (diff)
fix values passed to umask(), they should be octal.
the permissions are even more restrictive than they should. misc bug reported by qualys
-rw-r--r--usr.sbin/smtpd/enqueue.c4
-rw-r--r--usr.sbin/smtpd/makemap.c4
-rw-r--r--usr.sbin/smtpd/smtpd.c4
-rw-r--r--usr.sbin/smtpd/util.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index 5a2696f0d10..004a040b08f 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.95 2015/09/07 15:36:53 gilles Exp $ */
+/* $OpenBSD: enqueue.c,v 1.96 2015/10/06 06:04:46 gilles Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -818,7 +818,7 @@ enqueue_offline(int argc, char *argv[], FILE *ifile)
PATH_OFFLINE, (long long int) time(NULL)))
err(EX_UNAVAILABLE, "snprintf");
- omode = umask(7077);
+ omode = umask(07077);
if ((fd = mkstemp(path)) == -1 || (fp = fdopen(fd, "w+")) == NULL) {
warn("cannot create temporary file %s", path);
if (fd != -1)
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c
index de743cb4f6d..641d4698c97 100644
--- a/usr.sbin/smtpd/makemap.c
+++ b/usr.sbin/smtpd/makemap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemap.c,v 1.52 2015/01/20 17:37:54 deraadt Exp $ */
+/* $OpenBSD: makemap.c,v 1.53 2015/10/06 06:04:46 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -185,7 +185,7 @@ main(int argc, char *argv[])
if (! bsnprintf(dbname, sizeof(dbname), "%s.XXXXXXXXXXX", oflag))
errx(1, "path too long");
- omode = umask(7077);
+ omode = umask(07077);
if (mkstemp(dbname) == -1)
err(1, "mkstemp");
umask(omode);
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 9e55df0cfcb..abc3856ee84 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.240 2015/10/02 00:37:53 gilles Exp $ */
+/* $OpenBSD: smtpd.c,v 1.241 2015/10/06 06:04:46 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -942,7 +942,7 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver)
/* prepare file which captures stdout and stderr */
(void)strlcpy(sfn, "/tmp/smtpd.out.XXXXXXXXXXX", sizeof(sfn));
- omode = umask(7077);
+ omode = umask(07077);
allout = mkstemp(sfn);
umask(omode);
if (allout < 0) {
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 9d2bb34eff6..d51dea43105 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.117 2015/10/06 05:48:34 gilles Exp $ */
+/* $OpenBSD: util.c,v 1.118 2015/10/06 06:04:46 gilles Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -385,7 +385,7 @@ mktmpfile(void)
fatal("exiting");
}
- omode = umask(7077);
+ omode = umask(07077);
if ((fd = mkstemp(path)) == -1) {
log_warn("cannot create temporary file %s", path);
fatal("exiting");