summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-06-01 14:55:10 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-06-01 14:55:10 +0000
commit49a6c813c2cd15f783bac4068f1ce59091c717e3 (patch)
tree0bba07173f8c70e076174f75d34fc773b0df0959
parent008b7a2e2d0f86b9a58a6c673f24eda26188b6b1 (diff)
allow to pause some subsystems at startup.
ok gilles@ chl@
-rw-r--r--usr.sbin/smtpd/smtp.c4
-rw-r--r--usr.sbin/smtpd/smtpd.c17
2 files changed, 17 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index 2b5d7cf1884..fc0871c20cb 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.101 2012/01/31 21:05:26 gilles Exp $ */
+/* $OpenBSD: smtp.c,v 1.102 2012/06/01 14:55:09 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -232,6 +232,8 @@ smtp_imsg(struct imsgev *iev, struct imsg *imsg)
if (!(env->sc_flags & SMTPD_CONFIGURING))
return;
smtp_setup_events();
+ if (env->sc_flags & SMTPD_SMTP_PAUSED)
+ smtp_pause();
env->sc_flags &= ~SMTPD_CONFIGURING;
return;
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 680d8331147..9cfda52a2d3 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.150 2012/01/28 16:52:24 gilles Exp $ */
+/* $OpenBSD: smtpd.c,v 1.151 2012/06/01 14:55:09 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -415,7 +415,7 @@ main(int argc, char *argv[])
{
int c;
int debug, verbose;
- int opts;
+ int opts, flags;
const char *conffile = CONF_FILE;
struct smtpd smtpd;
struct event ev_sigint;
@@ -435,6 +435,7 @@ main(int argc, char *argv[])
env = &smtpd;
+ flags = 0;
opts = 0;
debug = 0;
verbose = 0;
@@ -443,7 +444,7 @@ main(int argc, char *argv[])
TAILQ_INIT(&offline_q);
- while ((c = getopt(argc, argv, "dD:nf:T:v")) != -1) {
+ while ((c = getopt(argc, argv, "dD:nP:f:T:v")) != -1) {
switch (c) {
case 'd':
debug = 2;
@@ -477,6 +478,14 @@ main(int argc, char *argv[])
else
log_warnx("unknown trace flag \"%s\"", optarg);
break;
+ case 'P':
+ if (!strcmp(optarg, "smtp"))
+ flags |= SMTPD_SMTP_PAUSED;
+ else if (!strcmp(optarg, "mta"))
+ flags |= SMTPD_MTA_PAUSED;
+ else if (!strcmp(optarg, "mda"))
+ flags |= SMTPD_MDA_PAUSED;
+ break;
case 'v':
verbose |= TRACE_VERBOSE;
break;
@@ -503,6 +512,8 @@ main(int argc, char *argv[])
exit(0);
}
+ env->sc_flags |= flags;
+
/* check for root privileges */
if (geteuid())
errx(1, "need root privileges");