diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-07-21 23:29:25 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-07-21 23:29:25 +0000 |
commit | b257ff20505962bcb41d4aedce9f2beb71d67894 (patch) | |
tree | 9b98263a355f3cf73a9900c7f71aa4e08d46f1e2 /usr.sbin/smtpd/smtpctl.c | |
parent | 5c0622bec9f8ff5eab32e92654cbba7aa8a56e7b (diff) |
- update smtpctl.8 to reflect reality
- bring back 'smtpctl schedule' and 'smtpctl remove' to life
Things you should know:
The ramqueue data structure is not finished yet and lacks an envelope tree
for evpid lookups. I wanted to wait until I'm done but too many people are
affected by not being able to reschedule envelopes, this is a quick fix.
So right now there's an O(rrible) complexity as both commands will perform
a (possibly aborted) queue scan leading to O(n). I will make that O(log n)
soon.
Also, smtpctl remove no longer supports removing an entire message, I will
fix that very soon too.
Diffstat (limited to 'usr.sbin/smtpd/smtpctl.c')
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index e785d6434b0..8c13c3b52cc 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.60 2011/05/01 12:57:11 eric Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.61 2011/07/21 23:29:24 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -27,6 +27,7 @@ #include <sys/param.h> #include <err.h> +#include <errno.h> #include <event.h> #include <imsg.h> #include <stdio.h> @@ -128,6 +129,28 @@ connected: case NONE: usage(); /* not reached */ + + case SCHEDULE: + case REMOVE: { + u_int64_t ulval; + char *ep; + + errno = 0; + ulval = strtoul(res->data, &ep, 16); + if (res->data[0] == '\0' || *ep != '\0') + errx(1, "invalid msgid/evpid"); + if (errno == ERANGE && ulval == ULLONG_MAX) + errx(1, "invalid msgid/evpid"); + + if (res->action == SCHEDULE) + imsg_compose(ibuf, IMSG_RUNNER_SCHEDULE, 0, 0, -1, &ulval, + sizeof(ulval)); + if (res->action == REMOVE) + imsg_compose(ibuf, IMSG_RUNNER_REMOVE, 0, 0, -1, &ulval, + sizeof(ulval)); + break; + } + case SHUTDOWN: imsg_compose(ibuf, IMSG_CTL_SHUTDOWN, 0, 0, -1, NULL, 0); break; @@ -185,6 +208,8 @@ connected: break; switch(res->action) { /* case RELOAD: */ + case REMOVE: + case SCHEDULE: case SHUTDOWN: case PAUSE_MDA: case PAUSE_MTA: |