From: gilles Date: Tue, 6 Oct 2015 06:04:46 +0000 (+0000) Subject: fix values passed to umask(), they should be octal. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e691cb063f12f81b9b7e8e8a70eb4269ca04a162;p=openbsd fix values passed to umask(), they should be octal. the permissions are even more restrictive than they should. misc bug reported by qualys --- 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 @@ -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 @@ -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 @@ -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");