diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/control.c | 18 | ||||
-rw-r--r-- | usr.sbin/smtpd/parser.c | 14 | ||||
-rw-r--r-- | usr.sbin/smtpd/queue.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/runner.c | 33 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.8 | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 10 |
8 files changed, 60 insertions, 55 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index 9dd53fe9721..efa95132f87 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.61 2011/10/09 18:39:53 eric Exp $ */ +/* $OpenBSD: control.c,v 1.62 2011/10/26 20:47:31 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -398,7 +398,7 @@ control_dispatch_ext(int fd, short event, void *arg) imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; } - case IMSG_QUEUE_PAUSE_LOCAL: + case IMSG_QUEUE_PAUSE_MDA: if (euid) goto badcred; @@ -409,10 +409,10 @@ control_dispatch_ext(int fd, short event, void *arg) } env->sc_flags |= SMTPD_MDA_PAUSED; imsg_compose_event(env->sc_ievs[PROC_QUEUE], - IMSG_QUEUE_PAUSE_LOCAL, 0, 0, -1, NULL, 0); + IMSG_QUEUE_PAUSE_MDA, 0, 0, -1, NULL, 0); imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; - case IMSG_QUEUE_PAUSE_OUTGOING: + case IMSG_QUEUE_PAUSE_MTA: if (euid) goto badcred; @@ -423,7 +423,7 @@ control_dispatch_ext(int fd, short event, void *arg) } env->sc_flags |= SMTPD_MTA_PAUSED; imsg_compose_event(env->sc_ievs[PROC_QUEUE], - IMSG_QUEUE_PAUSE_OUTGOING, 0, 0, -1, NULL, 0); + IMSG_QUEUE_PAUSE_MTA, 0, 0, -1, NULL, 0); imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; case IMSG_SMTP_PAUSE: @@ -440,7 +440,7 @@ control_dispatch_ext(int fd, short event, void *arg) 0, 0, -1, NULL, 0); imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; - case IMSG_QUEUE_RESUME_LOCAL: + case IMSG_QUEUE_RESUME_MDA: if (euid) goto badcred; @@ -451,10 +451,10 @@ control_dispatch_ext(int fd, short event, void *arg) } env->sc_flags &= ~SMTPD_MDA_PAUSED; imsg_compose_event(env->sc_ievs[PROC_QUEUE], - IMSG_QUEUE_RESUME_LOCAL, 0, 0, -1, NULL, 0); + IMSG_QUEUE_RESUME_MDA, 0, 0, -1, NULL, 0); imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; - case IMSG_QUEUE_RESUME_OUTGOING: + case IMSG_QUEUE_RESUME_MTA: if (euid) goto badcred; @@ -465,7 +465,7 @@ control_dispatch_ext(int fd, short event, void *arg) } env->sc_flags &= ~SMTPD_MTA_PAUSED; imsg_compose_event(env->sc_ievs[PROC_QUEUE], - IMSG_QUEUE_RESUME_OUTGOING, 0, 0, -1, NULL, 0); + IMSG_QUEUE_RESUME_MTA, 0, 0, -1, NULL, 0); imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0); break; diff --git a/usr.sbin/smtpd/parser.c b/usr.sbin/smtpd/parser.c index f14576887bb..9bdf367a255 100644 --- a/usr.sbin/smtpd/parser.c +++ b/usr.sbin/smtpd/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.22 2011/10/23 17:12:41 gilles Exp $ */ +/* $OpenBSD: parser.c,v 1.23 2011/10/26 20:47:31 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -88,16 +88,16 @@ static const struct token t_show[] = { }; static const struct token t_pause[] = { - {KEYWORD, "local", PAUSE_MDA, NULL}, - {KEYWORD, "outgoing", PAUSE_MTA, NULL}, - {KEYWORD, "incoming", PAUSE_SMTP, NULL}, + {KEYWORD, "mda", PAUSE_MDA, NULL}, + {KEYWORD, "mta", PAUSE_MTA, NULL}, + {KEYWORD, "smtp", PAUSE_SMTP, NULL}, {ENDTOKEN, "", NONE, NULL} }; static const struct token t_resume[] = { - {KEYWORD, "local", RESUME_MDA, NULL}, - {KEYWORD, "outgoing", RESUME_MTA, NULL}, - {KEYWORD, "incoming", RESUME_SMTP, NULL}, + {KEYWORD, "mda", RESUME_MDA, NULL}, + {KEYWORD, "mta", RESUME_MTA, NULL}, + {KEYWORD, "smtp", RESUME_SMTP, NULL}, {ENDTOKEN, "", NONE, NULL} }; diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index 2d19a2698b6..c041225b4a9 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.108 2011/10/23 09:30:07 gilles Exp $ */ +/* $OpenBSD: queue.c,v 1.109 2011/10/26 20:47:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -183,10 +183,10 @@ queue_imsg(struct imsgev *iev, struct imsg *imsg) if (iev->proc == PROC_CONTROL) { switch (imsg->hdr.type) { - case IMSG_QUEUE_PAUSE_LOCAL: - case IMSG_QUEUE_PAUSE_OUTGOING: - case IMSG_QUEUE_RESUME_LOCAL: - case IMSG_QUEUE_RESUME_OUTGOING: + case IMSG_QUEUE_PAUSE_MDA: + case IMSG_QUEUE_PAUSE_MTA: + case IMSG_QUEUE_RESUME_MDA: + case IMSG_QUEUE_RESUME_MTA: case IMSG_QUEUE_SCHEDULE: case IMSG_QUEUE_REMOVE: queue_pass_to_runner(iev, imsg); diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c index 6c7d5c70717..2ac8e61a3e2 100644 --- a/usr.sbin/smtpd/runner.c +++ b/usr.sbin/smtpd/runner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: runner.c,v 1.120 2011/10/23 09:30:07 gilles Exp $ */ +/* $OpenBSD: runner.c,v 1.121 2011/10/26 20:47:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -142,20 +142,22 @@ runner_imsg(struct imsgev *iev, struct imsg *imsg) } return; - case IMSG_QUEUE_PAUSE_LOCAL: + case IMSG_QUEUE_PAUSE_MDA: env->sc_opts |= SMTPD_MDA_PAUSED; return; - case IMSG_QUEUE_RESUME_LOCAL: + case IMSG_QUEUE_RESUME_MDA: env->sc_opts &= ~SMTPD_MDA_PAUSED; + runner_reset_events(); return; - case IMSG_QUEUE_PAUSE_OUTGOING: + case IMSG_QUEUE_PAUSE_MTA: env->sc_opts |= SMTPD_MTA_PAUSED; return; - case IMSG_QUEUE_RESUME_OUTGOING: + case IMSG_QUEUE_RESUME_MTA: env->sc_opts &= ~SMTPD_MTA_PAUSED; + runner_reset_events(); return; case IMSG_CTL_VERBOSE: @@ -334,14 +336,17 @@ runner_timeout(int fd, short event, void *p) curtm = time(NULL); rq_evp = ramqueue_next_envelope(rqueue); while (rq_evp) { - if (rq_evp->sched > curtm) + if (rq_evp->sched > curtm) { + nsched = rq_evp->sched; break; + } runner_process_envelope(rq_evp, curtm); rq_evp = ramqueue_next_envelope(rqueue); } - if (rq_done && rq_off_done && ramqueue_is_empty(rqueue)) { - log_debug("runner: ramqueue is empty, wake me up. zZzZzZ"); + if (rq_evp == NULL || + (rq_done && rq_off_done && ramqueue_is_empty(rqueue))) { + log_debug("runner: nothing to schedule, wake me up. zZzZzZ"); return; } @@ -372,30 +377,30 @@ runner_process_envelope(struct ramqueue_envelope *rq_evp, time_t curtm) mda_av = env->sc_maxconn - stat_get(STATS_MDA_SESSION, STAT_ACTIVE); bnc_av = env->sc_maxconn - stat_get(STATS_RUNNER_BOUNCES, STAT_ACTIVE); - if (! queue_envelope_load(Q_QUEUE, rq_evp->evpid, &envelope)) - return 0; - - if (envelope.type & D_MDA) { + if (rq_evp->rq_batch->type == D_MDA) { if (env->sc_opts & SMTPD_MDA_PAUSED) return 0; if (mda_av == 0) return 0; } - if (envelope.type & D_MTA) { + if (rq_evp->rq_batch->type == D_MTA) { if (env->sc_opts & SMTPD_MTA_PAUSED) return 0; if (mta_av == 0) return 0; } - if (envelope.type & D_BOUNCE) { + if (rq_evp->rq_batch->type == D_BOUNCE) { if (env->sc_opts & (SMTPD_MDA_PAUSED|SMTPD_MTA_PAUSED)) return 0; if (bnc_av == 0) return 0; } + if (! queue_envelope_load(Q_QUEUE, rq_evp->evpid, &envelope)) + return 0; + if (runner_check_loop(&envelope)) { struct envelope bounce; diff --git a/usr.sbin/smtpd/smtpctl.8 b/usr.sbin/smtpd/smtpctl.8 index dcd2cbec06b..51b0a7c06ce 100644 --- a/usr.sbin/smtpd/smtpctl.8 +++ b/usr.sbin/smtpd/smtpctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: smtpctl.8,v 1.23 2011/10/23 18:37:34 jmc Exp $ +.\" $OpenBSD: smtpctl.8,v 1.24 2011/10/26 20:47:31 gilles Exp $ .\" .\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 23 2011 $ +.Dd $Mdocdate: October 26 2011 $ .Dt SMTPCTL 8 .Os .Sh NAME @@ -40,11 +40,11 @@ The following commands are available: Disable verbose debug logging. .It Cm log verbose Enable verbose debug logging. -.It Cm pause incoming +.It Cm pause smtp Temporarily stop accepting incoming sessions. -.It Cm pause local +.It Cm pause mda Temporarily stop deliveries to local users. -.It Cm pause outgoing +.It Cm pause mta Temporarily stop relaying and deliveries to remote users. .It Cm remove Ar envelope-id | message-id diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 6c5be25191a..654f47ff15c 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.69 2011/10/23 17:12:41 gilles Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.70 2011/10/26 20:47:31 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -170,19 +170,19 @@ connected: imsg_compose(ibuf, IMSG_CTL_SHUTDOWN, 0, 0, -1, NULL, 0); break; case PAUSE_MDA: - imsg_compose(ibuf, IMSG_QUEUE_PAUSE_LOCAL, 0, 0, -1, NULL, 0); + imsg_compose(ibuf, IMSG_QUEUE_PAUSE_MDA, 0, 0, -1, NULL, 0); break; case PAUSE_MTA: - imsg_compose(ibuf, IMSG_QUEUE_PAUSE_OUTGOING, 0, 0, -1, NULL, 0); + imsg_compose(ibuf, IMSG_QUEUE_PAUSE_MTA, 0, 0, -1, NULL, 0); break; case PAUSE_SMTP: imsg_compose(ibuf, IMSG_SMTP_PAUSE, 0, 0, -1, NULL, 0); break; case RESUME_MDA: - imsg_compose(ibuf, IMSG_QUEUE_RESUME_LOCAL, 0, 0, -1, NULL, 0); + imsg_compose(ibuf, IMSG_QUEUE_RESUME_MDA, 0, 0, -1, NULL, 0); break; case RESUME_MTA: - imsg_compose(ibuf, IMSG_QUEUE_RESUME_OUTGOING, 0, 0, -1, NULL, 0); + imsg_compose(ibuf, IMSG_QUEUE_RESUME_MTA, 0, 0, -1, NULL, 0); break; case RESUME_SMTP: imsg_compose(ibuf, IMSG_SMTP_RESUME, 0, 0, -1, NULL, 0); diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index ead1d8911e9..60fb1190e21 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.133 2011/10/22 06:42:44 jmc Exp $ */ +/* $OpenBSD: smtpd.c,v 1.134 2011/10/26 20:47:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -1192,10 +1192,10 @@ imsg_to_str(int type) CASE(IMSG_QUEUE_REMOVE_MESSAGE); CASE(IMSG_QUEUE_COMMIT_MESSAGE); CASE(IMSG_QUEUE_TEMPFAIL); - CASE(IMSG_QUEUE_PAUSE_LOCAL); - CASE(IMSG_QUEUE_PAUSE_OUTGOING); - CASE(IMSG_QUEUE_RESUME_LOCAL); - CASE(IMSG_QUEUE_RESUME_OUTGOING); + CASE(IMSG_QUEUE_PAUSE_MDA); + CASE(IMSG_QUEUE_PAUSE_MTA); + CASE(IMSG_QUEUE_RESUME_MDA); + CASE(IMSG_QUEUE_RESUME_MTA); CASE(IMSG_QUEUE_MESSAGE_UPDATE); CASE(IMSG_QUEUE_MESSAGE_FD); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 142ac9754de..2738b63b6bd 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.246 2011/10/23 15:36:53 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.247 2011/10/26 20:47:31 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -155,10 +155,10 @@ enum imsg_type { IMSG_QUEUE_REMOVE_MESSAGE, IMSG_QUEUE_COMMIT_MESSAGE, IMSG_QUEUE_TEMPFAIL, - IMSG_QUEUE_PAUSE_LOCAL, - IMSG_QUEUE_PAUSE_OUTGOING, - IMSG_QUEUE_RESUME_LOCAL, - IMSG_QUEUE_RESUME_OUTGOING, + IMSG_QUEUE_PAUSE_MDA, + IMSG_QUEUE_PAUSE_MTA, + IMSG_QUEUE_RESUME_MDA, + IMSG_QUEUE_RESUME_MTA, IMSG_QUEUE_MESSAGE_UPDATE, IMSG_QUEUE_MESSAGE_FD, |