summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/util.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2012-08-26 11:52:49 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2012-08-26 11:52:49 +0000
commita10ddaa6927e9019fd1ac0a1c5de462b3b90427e (patch)
treec79842606b932be982e9d495ccd45c799d3f88cd /usr.sbin/smtpd/util.c
parent5f5286de0a0de74ab7e362a34220341aa04be063 (diff)
- define ZLIB_BUFFER_SIZE instead of hardcoding 8192
- check gzdopen() failure - call gzclose() whenever a failure occurs after gzdopen() - simplify slightly some checks in compress/uncompress - create PATH_TEMPORARY in /var/spool/smtpd, chmod 700, owned by _smtpd - compress_zlib should use PATH_TEMPORARY instread of /tmp as we're chrooted and this will otherwise lead to a fatal() ok chl@
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r--usr.sbin/smtpd/util.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 3469d75d390..05b2050c8da 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.73 2012/08/25 23:35:09 chl Exp $ */
+/* $OpenBSD: util.c,v 1.74 2012/08/26 11:52:48 gilles Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -336,12 +336,10 @@ mktmpfile(void)
char path[MAXPATHLEN];
int fd;
-#define PATH_TMP "/tmp"
+ if (ckdir(PATH_TEMPORARY, 0700, env->sc_pw->pw_uid, 0, 0) == 0)
+ errx(1, "error in %s directory setup", PATH_TEMPORARY);
- if (ckdir(PATH_TMP, 0700, env->sc_pw->pw_uid, 0, 0) == 0)
- errx(1, "error in /tmp directory setup");
-
- if (! bsnprintf(path, sizeof(path), "%s/zlib.XXXXXXXXXX", PATH_TMP))
+ if (! bsnprintf(path, sizeof(path), "%s/smtpd.XXXXXXXXXX", PATH_TEMPORARY))
err(1, "snprintf");
if ((fd = mkstemp(path)) == -1)