summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2011-10-23 17:12:42 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2011-10-23 17:12:42 +0000
commit64b7a5c1b008ef83032593f294372b2905980851 (patch)
tree4e5b86cdb931babebcd1f9df59dc2a7077caa61b /usr.sbin/smtpd
parent8b3a50e556cbecf7d2c19e7e40fce0a2aa4d5341 (diff)
- smtpctl schedule no longer works, instead, use 'smtpctl schedule-id <id>'
- introduce 'smtpctl schedule-all' ok eric@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/parser.c11
-rw-r--r--usr.sbin/smtpd/parser.h3
-rw-r--r--usr.sbin/smtpd/ramqueue.c9
-rw-r--r--usr.sbin/smtpd/smtpctl.88
-rw-r--r--usr.sbin/smtpd/smtpctl.c13
5 files changed, 33 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/parser.c b/usr.sbin/smtpd/parser.c
index 61f82eed172..f14576887bb 100644
--- a/usr.sbin/smtpd/parser.c
+++ b/usr.sbin/smtpd/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.21 2011/08/16 19:12:40 gilles Exp $ */
+/* $OpenBSD: parser.c,v 1.22 2011/10/23 17:12:41 gilles Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -48,7 +48,7 @@ struct token {
};
static const struct token t_main[];
-static const struct token t_schedule[];
+static const struct token t_schedule_id[];
static const struct token t_show[];
static const struct token t_pause[];
static const struct token t_remove[];
@@ -56,8 +56,9 @@ static const struct token t_resume[];
static const struct token t_log[];
static const struct token t_main[] = {
- {KEYWORD, "schedule", NONE, t_schedule},
- {KEYWORD, "show", NONE, t_show},
+ {KEYWORD, "schedule-id", NONE, t_schedule_id},
+ {KEYWORD, "schedule-all", SCHEDULE_ALL, NULL},
+ {KEYWORD, "show", NONE, t_show},
{KEYWORD, "monitor", MONITOR, NULL},
{KEYWORD, "pause", NONE, t_pause},
/* {KEYWORD, "reload", RELOAD, NULL},*/
@@ -73,7 +74,7 @@ static const struct token t_remove[] = {
{ENDTOKEN, "", NONE, NULL}
};
-static const struct token t_schedule[] = {
+static const struct token t_schedule_id[] = {
{VARIABLE, "msgid/evpid", SCHEDULE, NULL},
{ENDTOKEN, "", NONE, NULL}
};
diff --git a/usr.sbin/smtpd/parser.h b/usr.sbin/smtpd/parser.h
index 70ccd3081ff..9bdfee1183a 100644
--- a/usr.sbin/smtpd/parser.h
+++ b/usr.sbin/smtpd/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.18 2011/08/16 19:12:40 gilles Exp $ */
+/* $OpenBSD: parser.h,v 1.19 2011/10/23 17:12:41 gilles Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -24,6 +24,7 @@ enum actions {
LOG_VERBOSE,
LOG_BRIEF,
SCHEDULE,
+ SCHEDULE_ALL,
SHOW_QUEUE,
SHOW_RUNQUEUE,
SHOW_STATS,
diff --git a/usr.sbin/smtpd/ramqueue.c b/usr.sbin/smtpd/ramqueue.c
index d1615988fc5..b6bced5ed72 100644
--- a/usr.sbin/smtpd/ramqueue.c
+++ b/usr.sbin/smtpd/ramqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ramqueue.c,v 1.22 2011/10/23 15:36:53 eric Exp $ */
+/* $OpenBSD: ramqueue.c,v 1.23 2011/10/23 17:12:41 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -376,6 +376,13 @@ ramqueue_schedule(struct ramqueue *rq, u_int64_t id)
struct ramqueue_message *rq_msg;
struct ramqueue_envelope *rq_evp;
+ /* schedule *all* */
+ if (id == 0) {
+ TAILQ_FOREACH(rq_evp, &rq->queue, queue_entry) {
+ ramqueue_schedule_envelope(rq, rq_evp);
+ }
+ }
+
/* scheduling by evpid */
if (id > 0xffffffffL) {
rq_evp = ramqueue_lookup_envelope(rq, id);
diff --git a/usr.sbin/smtpd/smtpctl.8 b/usr.sbin/smtpd/smtpctl.8
index f53d62eb7b5..8e85a520e07 100644
--- a/usr.sbin/smtpd/smtpctl.8
+++ b/usr.sbin/smtpd/smtpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: smtpctl.8,v 1.21 2011/08/17 20:04:43 gilles Exp $
+.\" $OpenBSD: smtpctl.8,v 1.22 2011/10/23 17:12:41 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: August 17 2011 $
+.Dd $Mdocdate: October 23 2011 $
.Dt SMTPCTL 8
.Os
.Sh NAME
@@ -55,9 +55,11 @@ Resume accepting incoming sessions.
Resume deliveries to local users.
.It Cm resume outgoing
Resume relaying and deliveries to remote users.
-.It Cm schedule Ar envelope-id | message-id
+.It Cm schedule-id Ar envelope-id | message-id
Marks a single envelope, or all envelopes with the same message ID,
as ready for immediate delivery.
+.It Cm schedule-all
+Marks all envelopes as ready for immediate delivery.
.It Cm show queue
Displays information concerning envelopes
that are currently in a queue.
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index 3c97118d018..6c5be25191a 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpctl.c,v 1.68 2011/10/23 09:30:07 gilles Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.69 2011/10/23 17:12:41 gilles Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -146,6 +146,8 @@ connected:
errx(1, "invalid msgid/evpid");
if (errno == ERANGE && ulval == ULLONG_MAX)
errx(1, "invalid msgid/evpid");
+ if (ulval == 0)
+ errx(1, "invalid msgid/evpid");
if (res->action == SCHEDULE)
imsg_compose(ibuf, IMSG_RUNNER_SCHEDULE, 0, 0, -1, &ulval,
@@ -156,6 +158,14 @@ connected:
break;
}
+ case SCHEDULE_ALL: {
+ u_int64_t ulval = 0;
+
+ imsg_compose(ibuf, IMSG_RUNNER_SCHEDULE, 0, 0, -1, &ulval,
+ sizeof(ulval));
+ break;
+ }
+
case SHUTDOWN:
imsg_compose(ibuf, IMSG_CTL_SHUTDOWN, 0, 0, -1, NULL, 0);
break;
@@ -215,6 +225,7 @@ connected:
/* case RELOAD: */
case REMOVE:
case SCHEDULE:
+ case SCHEDULE_ALL:
case SHUTDOWN:
case PAUSE_MDA:
case PAUSE_MTA: