diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2014-07-10 15:54:56 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2014-07-10 15:54:56 +0000 |
commit | c8df0f414a0fc1320cafec1a1bd98b4ef71cf60d (patch) | |
tree | 43ba2f4cd9746463b6b3865f6303942274c01d1a /usr.sbin/smtpd/control.c | |
parent | 7fe09af8ed39a0b92b125886a9ff828900114a09 (diff) |
make the control process broadcast verbose/profile admin requests directly,
rather than going through the parent process. simplify code in the meantime.
Diffstat (limited to 'usr.sbin/smtpd/control.c')
-rw-r--r-- | usr.sbin/smtpd/control.c | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index f7afeedf2eb..d13501b6b50 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.100 2014/04/19 11:17:14 gilles Exp $ */ +/* $OpenBSD: control.c,v 1.101 2014/07/10 15:54:55 eric Exp $ */ /* * Copyright (c) 2012 Gilles Chehade <gilles@poolp.org> @@ -65,6 +65,7 @@ static void control_close(struct ctl_conn *); static void control_sig_handler(int, short, void *); static void control_dispatch_ext(struct mproc *, struct imsg *); static void control_digest_update(const char *, size_t, int); +static void control_broadcast_verbose(int, int); static struct stat_backend *stat_backend = NULL; extern const char *backend_stat; @@ -286,6 +287,7 @@ control(void) config_peer(PROC_PARENT); config_peer(PROC_LKA); config_peer(PROC_PONY); + config_peer(PROC_CA); config_done(); control_listen(); @@ -501,9 +503,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) verbose = v; log_verbose(verbose); - m_create(p_parent, IMSG_CTL_VERBOSE, 0, 0, -1); - m_add_int(p_parent, verbose); - m_close(p_parent); + control_broadcast_verbose(IMSG_CTL_VERBOSE, verbose); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -519,9 +519,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) verbose |= v; log_verbose(verbose); - m_create(p_parent, IMSG_CTL_TRACE_ENABLE, 0, 0, -1); - m_add_int(p_parent, v); - m_close(p_parent); + control_broadcast_verbose(IMSG_CTL_VERBOSE, verbose); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -537,9 +535,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) verbose &= ~v; log_verbose(verbose); - m_create(p_parent, IMSG_CTL_TRACE_DISABLE, 0, 0, -1); - m_add_int(p_parent, v); - m_close(p_parent); + control_broadcast_verbose(IMSG_CTL_VERBOSE, verbose); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -554,9 +550,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) memcpy(&v, imsg->data, sizeof(v)); profiling |= v; - m_create(p_parent, IMSG_CTL_PROFILE_ENABLE, 0, 0, -1); - m_add_int(p_parent, v); - m_close(p_parent); + control_broadcast_verbose(IMSG_CTL_PROFILE, profiling); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -571,9 +565,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) memcpy(&v, imsg->data, sizeof(v)); profiling &= ~v; - m_create(p_parent, IMSG_CTL_PROFILE_DISABLE, 0, 0, -1); - m_add_int(p_parent, v); - m_close(p_parent); + control_broadcast_verbose(IMSG_CTL_PROFILE, profiling); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -773,3 +765,31 @@ badcred: invalid: m_compose(p, IMSG_CTL_FAIL, 0, 0, -1, NULL, 0); } + +static void +control_broadcast_verbose(int msg, int v) +{ + m_create(p_lka, msg, 0, 0, -1); + m_add_int(p_lka, v); + m_close(p_lka); + + m_create(p_pony, msg, 0, 0, -1); + m_add_int(p_pony, v); + m_close(p_pony); + + m_create(p_queue, msg, 0, 0, -1); + m_add_int(p_queue, v); + m_close(p_queue); + + m_create(p_ca, msg, 0, 0, -1); + m_add_int(p_ca, v); + m_close(p_ca); + + m_create(p_scheduler, msg, 0, 0, -1); + m_add_int(p_scheduler, v); + m_close(p_scheduler); + + m_create(p_parent, msg, 0, 0, -1); + m_add_int(p_parent, v); + m_close(p_parent); +} |