summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/smtpd/queue_fsqueue.c11
-rw-r--r--usr.sbin/smtpd/smtpctl.c4
-rw-r--r--usr.sbin/smtpd/smtpd.c4
-rw-r--r--usr.sbin/smtpd/smtpd.h4
4 files changed, 12 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/queue_fsqueue.c b/usr.sbin/smtpd/queue_fsqueue.c
index 963a6191c65..ba44cc30341 100644
--- a/usr.sbin/smtpd/queue_fsqueue.c
+++ b/usr.sbin/smtpd/queue_fsqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_fsqueue.c,v 1.34 2012/01/14 19:35:31 eric Exp $ */
+/* $OpenBSD: queue_fsqueue.c,v 1.35 2012/01/24 12:20:18 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -59,7 +59,7 @@ static int fsqueue_message_path(enum queue_kind, uint32_t, char *, size_t);
static int fsqueue_envelope_path(enum queue_kind, u_int64_t, char *, size_t);
static int fsqueue_envelope_dump_atomic(char *, struct envelope *);
-int fsqueue_init(void);
+int fsqueue_init(int);
int fsqueue_message(enum queue_kind, enum queue_op, u_int32_t *);
int fsqueue_envelope(enum queue_kind, enum queue_op , struct envelope *);
int fsqueue_load_envelope_ascii(FILE *, struct envelope *);
@@ -385,7 +385,7 @@ again:
}
int
-fsqueue_init(void)
+fsqueue_init(int server)
{
unsigned int n;
char *paths[] = { PATH_INCOMING, PATH_QUEUE, PATH_CORRUPT };
@@ -397,7 +397,8 @@ fsqueue_init(void)
if (!fsqueue_envelope_path(Q_INCOMING, 0, path, sizeof(path)))
errx(1, "cannot store envelope path in %s", PATH_INCOMING);
- mvpurge(PATH_SPOOL PATH_INCOMING, PATH_SPOOL PATH_PURGE);
+ if (server)
+ mvpurge(PATH_SPOOL PATH_INCOMING, PATH_SPOOL PATH_PURGE);
ret = 1;
for (n = 0; n < nitems(paths); n++) {
@@ -405,7 +406,7 @@ fsqueue_init(void)
if (strlcat(path, paths[n], sizeof(path)) >= sizeof(path))
errx(1, "path too long %s%s", PATH_SPOOL, paths[n]);
- if (ckdir(path, 0700, env->sc_pw->pw_uid, 0, 1) == 0)
+ if (ckdir(path, 0700, env->sc_pw->pw_uid, 0, server) == 0)
ret = 0;
}
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index d2bd0155430..e4ab391b840 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpctl.c,v 1.76 2012/01/12 22:59:55 eric Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.77 2012/01/24 12:20:18 eric Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -85,7 +85,7 @@ setup_env(struct smtpd *smtpd)
if (env->sc_queue == NULL)
errx(1, "could not find queue backend");
- if (!env->sc_queue->init())
+ if (!env->sc_queue->init(0))
errx(1, "invalid directory permissions");
}
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 2f98c62de04..77fdf7cc89a 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.148 2012/01/18 13:41:54 chl Exp $ */
+/* $OpenBSD: smtpd.c,v 1.149 2012/01/24 12:20:18 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -521,7 +521,7 @@ main(int argc, char *argv[])
if (env->sc_queue == NULL)
errx(1, "could not find queue backend");
- if (!env->sc_queue->init())
+ if (!env->sc_queue->init(1))
errx(1, "could not initialize queue backend");
log_init(debug);
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index b6db0f6642e..31a988ceaa1 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.280 2012/01/18 13:41:54 chl Exp $ */
+/* $OpenBSD: smtpd.h,v 1.281 2012/01/24 12:20:18 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -930,7 +930,7 @@ enum queue_op {
};
struct queue_backend {
- int (*init)(void);
+ int (*init)(int);
int (*message)(enum queue_kind, enum queue_op, u_int32_t *);
int (*envelope)(enum queue_kind, enum queue_op, struct envelope *);