diff options
author | martijn <martijn@openbsd.org> | 2020-12-31 08:27:15 +0000 |
---|---|---|
committer | Gilles CHEHADE <gilles@poolp.org> | 2021-01-19 09:59:20 +0100 |
commit | f4a047e7530fe5e2d5c9f31dca10ba1b188041a3 (patch) | |
tree | 48574a9554cacc265bb73b68e9a399e1b2d81bb9 | |
parent | sync usage() with SYNOPSIS; the -S option remains (diff) | |
download | OpenSMTPD-f4a047e7530fe5e2d5c9f31dca10ba1b188041a3.tar.xz OpenSMTPD-f4a047e7530fe5e2d5c9f31dca10ba1b188041a3.zip |
Rename the pony process to dispatcher and klondike to crypto.
From gilles@
OK millert@ giovanni@
-rw-r--r-- | usr.sbin/smtpd/bounce.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/ca.c | 16 | ||||
-rw-r--r-- | usr.sbin/smtpd/config.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/control.c | 28 | ||||
-rw-r--r-- | usr.sbin/smtpd/dispatcher.c (renamed from usr.sbin/smtpd/pony.c) | 24 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka_filter.c | 56 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka_session.c | 16 | ||||
-rw-r--r-- | usr.sbin/smtpd/parse.y | 178 | ||||
-rw-r--r-- | usr.sbin/smtpd/queue.c | 36 | ||||
-rw-r--r-- | usr.sbin/smtpd/resolver.c | 18 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 128 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 12 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd/Makefile | 4 |
14 files changed, 263 insertions, 273 deletions
diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c index 4a4a0992..bb07c5af 100644 --- a/usr.sbin/smtpd/bounce.c +++ b/usr.sbin/smtpd/bounce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bounce.c,v 1.82 2020/04/24 11:34:07 eric Exp $ */ +/* $OpenBSD: bounce.c,v 1.83 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@poolp.org> @@ -292,7 +292,7 @@ bounce_drain() } log_debug("debug: bounce: requesting new enqueue socket..."); - m_compose(p_pony, IMSG_QUEUE_SMTP_SESSION, 0, 0, -1, NULL, 0); + m_compose(p_dispatcher, IMSG_QUEUE_SMTP_SESSION, 0, 0, -1, NULL, 0); running += 1; } diff --git a/usr.sbin/smtpd/ca.c b/usr.sbin/smtpd/ca.c index b36033b4..eef3f1d6 100644 --- a/usr.sbin/smtpd/ca.c +++ b/usr.sbin/smtpd/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.36 2019/09/21 07:46:53 semarie Exp $ */ +/* $OpenBSD: ca.c,v 1.37 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org> @@ -112,10 +112,10 @@ ca(void) config_peer(PROC_CONTROL); config_peer(PROC_PARENT); - config_peer(PROC_PONY); + config_peer(PROC_DISPATCHER); /* Ignore them until we get our config */ - mproc_disable(p_pony); + mproc_disable(p_dispatcher); #if HAVE_PLEDGE if (pledge("stdio", NULL) == -1) @@ -250,7 +250,7 @@ ca_imsg(struct mproc *p, struct imsg *imsg) ca_init(); /* Start fulfilling requests */ - mproc_enable(p_pony); + mproc_enable(p_dispatcher); return; case IMSG_CTL_VERBOSE: @@ -389,7 +389,7 @@ rsae_send_imsg(int flen, const unsigned char *from, unsigned char *to, if (n == 0) break; - log_imsg(PROC_PONY, PROC_CA, &imsg); + log_imsg(PROC_DISPATCHER, PROC_CA, &imsg); switch (imsg.hdr.type) { case IMSG_CA_RSA_PRIVENC: @@ -397,7 +397,7 @@ rsae_send_imsg(int flen, const unsigned char *from, unsigned char *to, break; default: /* Another imsg is queued up in the buffer */ - pony_imsg(p_ca, &imsg); + dispatcher_imsg(p_ca, &imsg); imsg_free(&imsg); continue; } @@ -584,14 +584,14 @@ ecdsae_send_enc_imsg(const unsigned char *dgst, int dgst_len, if (n == 0) break; - log_imsg(PROC_PONY, PROC_CA, &imsg); + log_imsg(PROC_DISPATCHER, PROC_CA, &imsg); switch (imsg.hdr.type) { case IMSG_CA_ECDSA_SIGN: break; default: /* Another imsg is queued up in the buffer */ - pony_imsg(p_ca, &imsg); + dispatcher_imsg(p_ca, &imsg); imsg_free(&imsg); continue; } diff --git a/usr.sbin/smtpd/config.c b/usr.sbin/smtpd/config.c index 8fe983d6..b612854f 100644 --- a/usr.sbin/smtpd/config.c +++ b/usr.sbin/smtpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.51 2019/12/18 10:00:39 gilles Exp $ */ +/* $OpenBSD: config.c,v 1.52 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -332,8 +332,8 @@ config_peer(enum smtp_proc_type proc) p = p_queue; else if (proc == PROC_SCHEDULER) p = p_scheduler; - else if (proc == PROC_PONY) - p = p_pony; + else if (proc == PROC_DISPATCHER) + p = p_dispatcher; else if (proc == PROC_CA) p = p_ca; else diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index dbb2840d..369b4404 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.125 2020/09/23 19:11:50 martijn Exp $ */ +/* $OpenBSD: control.c,v 1.126 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2012 Gilles Chehade <gilles@poolp.org> @@ -251,7 +251,7 @@ control(void) config_peer(PROC_QUEUE); config_peer(PROC_PARENT); config_peer(PROC_LKA); - config_peer(PROC_PONY); + config_peer(PROC_DISPATCHER); config_peer(PROC_CA); control_listen(); @@ -465,7 +465,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) m_compose(p, IMSG_CTL_FAIL, 0, 0, -1, NULL, 0); return; } - m_compose(p_pony, IMSG_CTL_SMTP_SESSION, c->id, 0, -1, + m_compose(p_dispatcher, IMSG_CTL_SMTP_SESSION, c->id, 0, -1, &c->euid, sizeof(c->euid)); return; @@ -612,7 +612,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) } log_info("info: smtp paused"); env->sc_flags |= SMTPD_SMTP_PAUSED; - m_compose(p_pony, IMSG_CTL_PAUSE_SMTP, 0, 0, -1, NULL, 0); + m_compose(p_dispatcher, IMSG_CTL_PAUSE_SMTP, 0, 0, -1, NULL, 0); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -662,7 +662,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) } log_info("info: smtp resumed"); env->sc_flags &= ~SMTPD_SMTP_PAUSED; - m_forward(p_pony, imsg); + m_forward(p_dispatcher, imsg); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -670,7 +670,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) if (c->euid) goto badcred; - m_forward(p_pony, imsg); + m_forward(p_dispatcher, imsg); m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0); return; @@ -697,7 +697,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) goto badcred; imsg->hdr.peerid = c->id; - m_forward(p_pony, imsg); + m_forward(p_dispatcher, imsg); return; case IMSG_CTL_SHOW_STATUS: @@ -716,10 +716,10 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) if (imsg->hdr.len - IMSG_HEADER_SIZE <= sizeof(ss)) goto invalid; memmove(&ss, imsg->data, sizeof(ss)); - m_create(p_pony, imsg->hdr.type, c->id, 0, -1); - m_add_sockaddr(p_pony, (struct sockaddr *)&ss); - m_add_string(p_pony, (char *)imsg->data + sizeof(ss)); - m_close(p_pony); + m_create(p_dispatcher, imsg->hdr.type, c->id, 0, -1); + m_add_sockaddr(p_dispatcher, (struct sockaddr *)&ss); + m_add_string(p_dispatcher, (char *)imsg->data + sizeof(ss)); + m_close(p_dispatcher); return; case IMSG_CTL_SCHEDULE: @@ -795,9 +795,9 @@ control_broadcast_verbose(int msg, int v) 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_dispatcher, msg, 0, 0, -1); + m_add_int(p_dispatcher, v); + m_close(p_dispatcher); m_create(p_queue, msg, 0, 0, -1); m_add_int(p_queue, v); diff --git a/usr.sbin/smtpd/pony.c b/usr.sbin/smtpd/dispatcher.c index 1865b339..b1c5d934 100644 --- a/usr.sbin/smtpd/pony.c +++ b/usr.sbin/smtpd/dispatcher.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pony.c,v 1.27 2019/06/13 11:45:35 eric Exp $ */ +/* $OpenBSD: dispatcher.c,v 1.1 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2014 Gilles Chehade <gilles@poolp.org> @@ -46,16 +46,16 @@ void mda_imsg(struct mproc *, struct imsg *); void mta_imsg(struct mproc *, struct imsg *); void smtp_imsg(struct mproc *, struct imsg *); -static void pony_shutdown(void); +static void dispatcher_shutdown(void); void -pony_imsg(struct mproc *p, struct imsg *imsg) +dispatcher_imsg(struct mproc *p, struct imsg *imsg) { struct msg m; int v; if (imsg == NULL) - pony_shutdown(); + dispatcher_shutdown(); switch (imsg->hdr.type) { @@ -145,14 +145,14 @@ pony_imsg(struct mproc *p, struct imsg *imsg) } static void -pony_shutdown(void) +dispatcher_shutdown(void) { - log_debug("debug: pony agent exiting"); + log_debug("debug: dispatcher agent exiting"); _exit(0); } int -pony(void) +dispatcher(void) { struct passwd *pw; @@ -169,18 +169,18 @@ pony(void) fatalx("unknown user " SMTPD_USER); if (chroot(PATH_CHROOT) == -1) - fatal("pony: chroot"); + fatal("dispatcher: chroot"); if (chdir("/") == -1) - fatal("pony: chdir(\"/\")"); + fatal("dispatcher: chdir(\"/\")"); - config_process(PROC_PONY); + config_process(PROC_DISPATCHER); if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) - fatal("pony: cannot drop privileges"); + fatal("dispatcher: cannot drop privileges"); - imsg_callback = pony_imsg; + imsg_callback = dispatcher_imsg; event_init(); mda_postprivdrop(); diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 6ac21245..98dbe1db 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.243 2019/12/21 10:23:37 gilles Exp $ */ +/* $OpenBSD: lka.c,v 1.244 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -340,7 +340,7 @@ lka_imsg(struct mproc *p, struct imsg *imsg) case IMSG_LKA_AUTHENTICATE: imsg->hdr.type = IMSG_SMTP_AUTHENTICATE; - m_forward(p_pony, imsg); + m_forward(p_dispatcher, imsg); return; case IMSG_CTL_VERBOSE: @@ -707,10 +707,10 @@ lka(void) config_peer(PROC_PARENT); config_peer(PROC_QUEUE); config_peer(PROC_CONTROL); - config_peer(PROC_PONY); + config_peer(PROC_DISPATCHER); /* Ignore them until we get our config */ - mproc_disable(p_pony); + mproc_disable(p_dispatcher); lka_report_init(); lka_filter_init(); @@ -737,7 +737,7 @@ proc_timeout(int fd, short event, void *p) goto reset; lka_filter_ready(); - mproc_enable(p_pony); + mproc_enable(p_dispatcher); return; reset: diff --git a/usr.sbin/smtpd/lka_filter.c b/usr.sbin/smtpd/lka_filter.c index 23a3bfae..e1ff99f3 100644 --- a/usr.sbin/smtpd/lka_filter.c +++ b/usr.sbin/smtpd/lka_filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_filter.c,v 1.65 2020/12/23 20:17:49 millert Exp $ */ +/* $OpenBSD: lka_filter.c,v 1.66 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org> @@ -561,10 +561,10 @@ lka_filter_data_begin(uint64_t reqid) io_set_callback(fs->io, filter_session_io, fs); end: - m_create(p_pony, IMSG_FILTER_SMTP_DATA_BEGIN, 0, 0, fd); - m_add_id(p_pony, reqid); - m_add_int(p_pony, fd != -1 ? 1 : 0); - m_close(p_pony); + m_create(p_dispatcher, IMSG_FILTER_SMTP_DATA_BEGIN, 0, 0, fd); + m_add_id(p_dispatcher, reqid); + m_add_int(p_dispatcher, fd != -1 ? 1 : 0); + m_close(p_dispatcher); log_trace(TRACE_FILTERS, "%016"PRIx64" filters data-begin fd=%d", reqid, fd); } @@ -983,49 +983,49 @@ filter_data_query(struct filter *filter, uint64_t token, uint64_t reqid, const c static void filter_result_proceed(uint64_t reqid) { - m_create(p_pony, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); - m_add_id(p_pony, reqid); - m_add_int(p_pony, FILTER_PROCEED); - m_close(p_pony); + m_create(p_dispatcher, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); + m_add_id(p_dispatcher, reqid); + m_add_int(p_dispatcher, FILTER_PROCEED); + m_close(p_dispatcher); } static void filter_result_junk(uint64_t reqid) { - m_create(p_pony, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); - m_add_id(p_pony, reqid); - m_add_int(p_pony, FILTER_JUNK); - m_close(p_pony); + m_create(p_dispatcher, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); + m_add_id(p_dispatcher, reqid); + m_add_int(p_dispatcher, FILTER_JUNK); + m_close(p_dispatcher); } static void filter_result_rewrite(uint64_t reqid, const char *param) { - m_create(p_pony, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); - m_add_id(p_pony, reqid); - m_add_int(p_pony, FILTER_REWRITE); - m_add_string(p_pony, param); - m_close(p_pony); + m_create(p_dispatcher, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); + m_add_id(p_dispatcher, reqid); + m_add_int(p_dispatcher, FILTER_REWRITE); + m_add_string(p_dispatcher, param); + m_close(p_dispatcher); } static void filter_result_reject(uint64_t reqid, const char *message) { - m_create(p_pony, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); - m_add_id(p_pony, reqid); - m_add_int(p_pony, FILTER_REJECT); - m_add_string(p_pony, message); - m_close(p_pony); + m_create(p_dispatcher, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); + m_add_id(p_dispatcher, reqid); + m_add_int(p_dispatcher, FILTER_REJECT); + m_add_string(p_dispatcher, message); + m_close(p_dispatcher); } static void filter_result_disconnect(uint64_t reqid, const char *message) { - m_create(p_pony, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); - m_add_id(p_pony, reqid); - m_add_int(p_pony, FILTER_DISCONNECT); - m_add_string(p_pony, message); - m_close(p_pony); + m_create(p_dispatcher, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); + m_add_id(p_dispatcher, reqid); + m_add_int(p_dispatcher, FILTER_DISCONNECT); + m_add_string(p_dispatcher, message); + m_close(p_dispatcher); } diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c index 999e01d6..95aa1ffe 100644 --- a/usr.sbin/smtpd/lka_session.c +++ b/usr.sbin/smtpd/lka_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_session.c,v 1.93 2019/09/20 17:46:05 gilles Exp $ */ +/* $OpenBSD: lka_session.c,v 1.94 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org> @@ -217,20 +217,20 @@ lka_resume(struct lka_session *lks) } error: if (lks->error) { - m_create(p_pony, IMSG_SMTP_EXPAND_RCPT, 0, 0, -1); - m_add_id(p_pony, lks->id); - m_add_int(p_pony, lks->error); + m_create(p_dispatcher, IMSG_SMTP_EXPAND_RCPT, 0, 0, -1); + m_add_id(p_dispatcher, lks->id); + m_add_int(p_dispatcher, lks->error); if (lks->errormsg) - m_add_string(p_pony, lks->errormsg); + m_add_string(p_dispatcher, lks->errormsg); else { if (lks->error == LKA_PERMFAIL) - m_add_string(p_pony, "550 Invalid recipient"); + m_add_string(p_dispatcher, "550 Invalid recipient"); else if (lks->error == LKA_TEMPFAIL) - m_add_string(p_pony, "451 Temporary failure"); + m_add_string(p_dispatcher, "451 Temporary failure"); } - m_close(p_pony); + m_close(p_dispatcher); while ((ep = TAILQ_FIRST(&lks->deliverylist)) != NULL) { TAILQ_REMOVE(&lks->deliverylist, ep, entry); free(ep); diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index a82f8206..1e8265c2 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.281 2020/09/23 19:11:50 martijn Exp $ */ +/* $OpenBSD: parse.y,v 1.282 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -109,7 +109,7 @@ struct mta_limits *limits; static struct pki *pki; static struct ca *sca; -struct dispatcher *dispatcher; +struct dispatcher *dsp; struct rule *rule; struct filter_proc *processor; struct filter_config *filter_config; @@ -588,37 +588,37 @@ SRS KEY STRING { dispatcher_local_option: USER STRING { - if (dispatcher->u.local.is_mbox) { + if (dsp->u.local.is_mbox) { yyerror("user may not be specified for this dispatcher"); YYERROR; } - if (dispatcher->u.local.forward_only) { + if (dsp->u.local.forward_only) { yyerror("user may not be specified for forward-only"); YYERROR; } - if (dispatcher->u.local.expand_only) { + if (dsp->u.local.expand_only) { yyerror("user may not be specified for expand-only"); YYERROR; } - if (dispatcher->u.local.user) { + if (dsp->u.local.user) { yyerror("user already specified for this dispatcher"); YYERROR; } - dispatcher->u.local.user = $2; + dsp->u.local.user = $2; } | ALIAS tables { struct table *t = $2; - if (dispatcher->u.local.table_alias) { + if (dsp->u.local.table_alias) { yyerror("alias mapping already specified for this dispatcher"); YYERROR; } - if (dispatcher->u.local.table_virtual) { + if (dsp->u.local.table_virtual) { yyerror("virtual mapping already specified for this dispatcher"); YYERROR; } @@ -629,17 +629,17 @@ USER STRING { YYERROR; } - dispatcher->u.local.table_alias = strdup(t->t_name); + dsp->u.local.table_alias = strdup(t->t_name); } | VIRTUAL tables { struct table *t = $2; - if (dispatcher->u.local.table_virtual) { + if (dsp->u.local.table_virtual) { yyerror("virtual mapping already specified for this dispatcher"); YYERROR; } - if (dispatcher->u.local.table_alias) { + if (dsp->u.local.table_alias) { yyerror("alias mapping already specified for this dispatcher"); YYERROR; } @@ -650,12 +650,12 @@ USER STRING { YYERROR; } - dispatcher->u.local.table_virtual = strdup(t->t_name); + dsp->u.local.table_virtual = strdup(t->t_name); } | USERBASE tables { struct table *t = $2; - if (dispatcher->u.local.table_userbase) { + if (dsp->u.local.table_userbase) { yyerror("userbase mapping already specified for this dispatcher"); YYERROR; } @@ -666,14 +666,14 @@ USER STRING { YYERROR; } - dispatcher->u.local.table_userbase = strdup(t->t_name); + dsp->u.local.table_userbase = strdup(t->t_name); } | WRAPPER STRING { if (! dict_get(conf->sc_mda_wrappers, $2)) { yyerror("no mda wrapper with that name: %s", $2); YYERROR; } - dispatcher->u.local.mda_wrapper = $2; + dsp->u.local.mda_wrapper = $2; } ; @@ -684,65 +684,67 @@ dispatcher_local_option dispatcher_local_options dispatcher_local: MBOX { - dispatcher->u.local.is_mbox = 1; - asprintf(&dispatcher->u.local.command, PATH_LIBEXEC"/mail.local -f %%{mbox.from} -- %%{user.username}"); + dsp->u.local.is_mbox = 1; + asprintf(&dsp->u.local.command, "/usr/libexec/mail.local -f %%{mbox.from} -- %%{user.username}"); } dispatcher_local_options | MAILDIR { - asprintf(&dispatcher->u.local.command, PATH_LIBEXEC"/mail.maildir"); + asprintf(&dsp->u.local.command, "/usr/libexec/mail.maildir"); } dispatcher_local_options | MAILDIR JUNK { - asprintf(&dispatcher->u.local.command, PATH_LIBEXEC"/mail.maildir -j"); + asprintf(&dsp->u.local.command, "/usr/libexec/mail.maildir -j"); } dispatcher_local_options | MAILDIR STRING { if (strncmp($2, "~/", 2) == 0) - asprintf(&dispatcher->u.local.command, - PATH_LIBEXEC"/mail.maildir \"%%{user.directory}/%s\"", $2+2); + asprintf(&dsp->u.local.command, + "/usr/libexec/mail.maildir \"%%{user.directory}/%s\"", $2+2); else - asprintf(&dispatcher->u.local.command, - PATH_LIBEXEC"/mail.maildir \"%s\"", $2); + asprintf(&dsp->u.local.command, + "/usr/libexec/mail.maildir \"%s\"", $2); } dispatcher_local_options | MAILDIR STRING JUNK { if (strncmp($2, "~/", 2) == 0) - asprintf(&dispatcher->u.local.command, - PATH_LIBEXEC"/mail.maildir -j \"%%{user.directory}/%s\"", $2+2); + asprintf(&dsp->u.local.command, + "/usr/libexec/mail.maildir -j \"%%{user.directory}/%s\"", $2+2); else - asprintf(&dispatcher->u.local.command, - PATH_LIBEXEC"/mail.maildir -j \"%s\"", $2); + asprintf(&dsp->u.local.command, + "/usr/libexec/mail.maildir -j \"%s\"", $2); } dispatcher_local_options | LMTP STRING { - asprintf(&dispatcher->u.local.command, - PATH_LIBEXEC"/mail.lmtp -d \"%s\" -u", $2); + asprintf(&dsp->u.local.command, + "/usr/libexec/mail.lmtp -d %s -u", $2); + dsp->u.local.user = SMTPD_USER; } dispatcher_local_options | LMTP STRING RCPT_TO { - asprintf(&dispatcher->u.local.command, - PATH_LIBEXEC"/mail.lmtp -d \"%s\" -r", $2); + asprintf(&dsp->u.local.command, + "/usr/libexec/mail.lmtp -d %s -r", $2); + dsp->u.local.user = SMTPD_USER; } dispatcher_local_options | MDA STRING { - asprintf(&dispatcher->u.local.command, - PATH_LIBEXEC"/mail.mda \"%s\"", $2); + asprintf(&dsp->u.local.command, + "/usr/libexec/mail.mda \"%s\"", $2); } dispatcher_local_options | FORWARD_ONLY { - dispatcher->u.local.forward_only = 1; + dsp->u.local.forward_only = 1; } dispatcher_local_options | EXPAND_ONLY { - dispatcher->u.local.expand_only = 1; + dsp->u.local.expand_only = 1; } dispatcher_local_options ; dispatcher_remote_option: HELO STRING { - if (dispatcher->u.remote.helo) { + if (dsp->u.remote.helo) { yyerror("helo already specified for this dispatcher"); YYERROR; } - dispatcher->u.remote.helo = $2; + dsp->u.remote.helo = $2; } | HELO_SRC tables { struct table *t = $2; - if (dispatcher->u.remote.helo_source) { + if (dsp->u.remote.helo_source) { yyerror("helo-source mapping already specified for this dispatcher"); YYERROR; } @@ -752,28 +754,28 @@ HELO STRING { YYERROR; } - dispatcher->u.remote.helo_source = strdup(t->t_name); + dsp->u.remote.helo_source = strdup(t->t_name); } | PKI STRING { - if (dispatcher->u.remote.pki) { + if (dsp->u.remote.pki) { yyerror("pki already specified for this dispatcher"); YYERROR; } - dispatcher->u.remote.pki = $2; + dsp->u.remote.pki = $2; } | CA STRING { - if (dispatcher->u.remote.ca) { + if (dsp->u.remote.ca) { yyerror("ca already specified for this dispatcher"); YYERROR; } - dispatcher->u.remote.ca = $2; + dsp->u.remote.ca = $2; } | SRC tables { struct table *t = $2; - if (dispatcher->u.remote.source) { + if (dsp->u.remote.source) { yyerror("source mapping already specified for this dispatcher"); YYERROR; } @@ -784,49 +786,49 @@ HELO STRING { YYERROR; } - dispatcher->u.remote.source = strdup(t->t_name); + dsp->u.remote.source = strdup(t->t_name); } | MAIL_FROM STRING { - if (dispatcher->u.remote.mail_from) { + if (dsp->u.remote.mail_from) { yyerror("mail-from already specified for this dispatcher"); YYERROR; } - dispatcher->u.remote.mail_from = $2; + dsp->u.remote.mail_from = $2; } | BACKUP MX STRING { - if (dispatcher->u.remote.backup) { + if (dsp->u.remote.backup) { yyerror("backup already specified for this dispatcher"); YYERROR; } - if (dispatcher->u.remote.smarthost) { + if (dsp->u.remote.smarthost) { yyerror("backup and host are mutually exclusive"); YYERROR; } - dispatcher->u.remote.backup = 1; - dispatcher->u.remote.backupmx = $3; + dsp->u.remote.backup = 1; + dsp->u.remote.backupmx = $3; } | BACKUP { - if (dispatcher->u.remote.backup) { + if (dsp->u.remote.backup) { yyerror("backup already specified for this dispatcher"); YYERROR; } - if (dispatcher->u.remote.smarthost) { + if (dsp->u.remote.smarthost) { yyerror("backup and host are mutually exclusive"); YYERROR; } - dispatcher->u.remote.backup = 1; + dsp->u.remote.backup = 1; } | HOST tables { struct table *t = $2; - if (dispatcher->u.remote.smarthost) { + if (dsp->u.remote.smarthost) { yyerror("host mapping already specified for this dispatcher"); YYERROR; } - if (dispatcher->u.remote.backup) { + if (dsp->u.remote.backup) { yyerror("backup and host are mutually exclusive"); YYERROR; } @@ -837,16 +839,16 @@ HELO STRING { YYERROR; } - dispatcher->u.remote.smarthost = strdup(t->t_name); + dsp->u.remote.smarthost = strdup(t->t_name); } | DOMAIN tables { struct table *t = $2; - if (dispatcher->u.remote.smarthost) { + if (dsp->u.remote.smarthost) { yyerror("host mapping already specified for this dispatcher"); YYERROR; } - if (dispatcher->u.remote.backup) { + if (dsp->u.remote.backup) { yyerror("backup and domain are mutually exclusive"); YYERROR; } @@ -857,35 +859,35 @@ HELO STRING { YYERROR; } - dispatcher->u.remote.smarthost = strdup(t->t_name); - dispatcher->u.remote.smarthost_domain = 1; + dsp->u.remote.smarthost = strdup(t->t_name); + dsp->u.remote.smarthost_domain = 1; } | TLS { - if (dispatcher->u.remote.tls_required == 1) { + if (dsp->u.remote.tls_required == 1) { yyerror("tls already specified for this dispatcher"); YYERROR; } - dispatcher->u.remote.tls_required = 1; + dsp->u.remote.tls_required = 1; } | TLS NO_VERIFY { - if (dispatcher->u.remote.tls_required == 1) { + if (dsp->u.remote.tls_required == 1) { yyerror("tls already specified for this dispatcher"); YYERROR; } - dispatcher->u.remote.tls_required = 1; - dispatcher->u.remote.tls_noverify = 1; + dsp->u.remote.tls_required = 1; + dsp->u.remote.tls_noverify = 1; } | AUTH tables { struct table *t = $2; - if (dispatcher->u.remote.smarthost == NULL) { + if (dsp->u.remote.smarthost == NULL) { yyerror("auth may not be specified without host on a dispatcher"); YYERROR; } - if (dispatcher->u.remote.auth) { + if (dsp->u.remote.auth) { yyerror("auth mapping already specified for this dispatcher"); YYERROR; } @@ -896,12 +898,12 @@ HELO STRING { YYERROR; } - dispatcher->u.remote.auth = strdup(t->t_name); + dsp->u.remote.auth = strdup(t->t_name); } | FILTER STRING { struct filter_config *fc; - if (dispatcher->u.remote.filtername) { + if (dsp->u.remote.filtername) { yyerror("filter already specified for this dispatcher"); YYERROR; } @@ -912,13 +914,13 @@ HELO STRING { YYERROR; } fc->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_OUT; - dispatcher->u.remote.filtername = $2; + dsp->u.remote.filtername = $2; } | FILTER { char buffer[128]; char *filtername; - if (dispatcher->u.remote.filtername) { + if (dsp->u.remote.filtername) { yyerror("filter already specified for this dispatcher"); YYERROR; } @@ -932,9 +934,9 @@ HELO STRING { filter_config->filter_type = FILTER_TYPE_CHAIN; filter_config->filter_subsystem |= FILTER_SUBSYSTEM_SMTP_OUT; dict_init(&filter_config->chain_procs); - dispatcher->u.remote.filtername = filtername; + dsp->u.remote.filtername = filtername; } '{' filter_list '}' { - dict_set(conf->sc_filters_dict, dispatcher->u.remote.filtername, filter_config); + dict_set(conf->sc_filters_dict, dsp->u.remote.filtername, filter_config); filter_config = NULL; } | SRS { @@ -942,12 +944,12 @@ HELO STRING { yyerror("an srs key is required for srs to be specified in an action"); YYERROR; } - if (dispatcher->u.remote.srs == 1) { + if (dsp->u.remote.srs == 1) { yyerror("srs already specified for this dispatcher"); YYERROR; } - dispatcher->u.remote.srs = 1; + dsp->u.remote.srs = 1; } ; @@ -962,22 +964,22 @@ RELAY dispatcher_remote_options dispatcher_type: dispatcher_local { - dispatcher->type = DISPATCHER_LOCAL; + dsp->type = DISPATCHER_LOCAL; } | dispatcher_remote { - dispatcher->type = DISPATCHER_REMOTE; + dsp->type = DISPATCHER_REMOTE; } ; dispatcher_option: TTL STRING { - if (dispatcher->ttl) { + if (dsp->ttl) { yyerror("ttl already specified for this dispatcher"); YYERROR; } - dispatcher->ttl = delaytonum($2); - if (dispatcher->ttl == -1) { + dsp->ttl = delaytonum($2); + if (dsp->ttl == -1) { yyerror("ttl delay \"%s\" is invalid", $2); free($2); YYERROR; @@ -997,13 +999,13 @@ ACTION STRING { yyerror("dispatcher already declared with that name: %s", $2); YYERROR; } - dispatcher = xcalloc(1, sizeof *dispatcher); + dsp = xcalloc(1, sizeof *dsp); } dispatcher_type dispatcher_options { - if (dispatcher->type == DISPATCHER_LOCAL) - if (dispatcher->u.local.table_userbase == NULL) - dispatcher->u.local.table_userbase = "<getpwnam>"; - dict_set(conf->sc_dispatchers, $2, dispatcher); - dispatcher = NULL; + if (dsp->type == DISPATCHER_LOCAL) + if (dsp->u.local.table_userbase == NULL) + dsp->u.local.table_userbase = "<getpwnam>"; + dict_set(conf->sc_dispatchers, $2, dsp); + dsp = NULL; } ; diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index 434e3647..c54d7552 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.190 2020/04/22 11:35:34 eric Exp $ */ +/* $OpenBSD: queue.c,v 1.191 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -156,15 +156,15 @@ queue_imsg(struct mproc *p, struct imsg *imsg) log_warnx("warn: imsg_queue_submit_envelope: msgid=0, " "evpid=%016"PRIx64, evp.id); ret = queue_envelope_create(&evp); - m_create(p_pony, IMSG_QUEUE_ENVELOPE_SUBMIT, 0, 0, -1); - m_add_id(p_pony, reqid); + m_create(p_dispatcher, IMSG_QUEUE_ENVELOPE_SUBMIT, 0, 0, -1); + m_add_id(p_dispatcher, reqid); if (ret == 0) - m_add_int(p_pony, 0); + m_add_int(p_dispatcher, 0); else { - m_add_int(p_pony, 1); - m_add_evpid(p_pony, evp.id); + m_add_int(p_dispatcher, 1); + m_add_evpid(p_dispatcher, evp.id); } - m_close(p_pony); + m_close(p_dispatcher); if (ret) { m_create(p_scheduler, IMSG_QUEUE_ENVELOPE_SUBMIT, 0, 0, -1); @@ -177,10 +177,10 @@ queue_imsg(struct mproc *p, struct imsg *imsg) m_msg(&m, imsg); m_get_id(&m, &reqid); m_end(&m); - m_create(p_pony, IMSG_QUEUE_ENVELOPE_COMMIT, 0, 0, -1); - m_add_id(p_pony, reqid); - m_add_int(p_pony, 1); - m_close(p_pony); + m_create(p_dispatcher, IMSG_QUEUE_ENVELOPE_COMMIT, 0, 0, -1); + m_add_id(p_dispatcher, reqid); + m_add_int(p_dispatcher, 1); + m_close(p_dispatcher); return; case IMSG_SCHED_ENVELOPE_REMOVE: @@ -254,9 +254,9 @@ queue_imsg(struct mproc *p, struct imsg *imsg) return; } evp.lasttry = time(NULL); - m_create(p_pony, IMSG_QUEUE_DELIVER, 0, 0, -1); - m_add_envelope(p_pony, &evp); - m_close(p_pony); + m_create(p_dispatcher, IMSG_QUEUE_DELIVER, 0, 0, -1); + m_add_envelope(p_dispatcher, &evp); + m_close(p_dispatcher); return; case IMSG_SCHED_ENVELOPE_INJECT: @@ -279,9 +279,9 @@ queue_imsg(struct mproc *p, struct imsg *imsg) return; } evp.lasttry = time(NULL); - m_create(p_pony, IMSG_QUEUE_TRANSFER, 0, 0, -1); - m_add_envelope(p_pony, &evp); - m_close(p_pony); + m_create(p_dispatcher, IMSG_QUEUE_TRANSFER, 0, 0, -1); + m_add_envelope(p_dispatcher, &evp); + m_close(p_dispatcher); return; case IMSG_CTL_LIST_ENVELOPES: @@ -669,7 +669,7 @@ queue(void) config_peer(PROC_CONTROL); config_peer(PROC_LKA); config_peer(PROC_SCHEDULER); - config_peer(PROC_PONY); + config_peer(PROC_DISPATCHER); /* setup queue loading task */ evtimer_set(&ev_qload, queue_timeout, &ev_qload); diff --git a/usr.sbin/smtpd/resolver.c b/usr.sbin/smtpd/resolver.c index ec9b2487..6d0f7fa6 100644 --- a/usr.sbin/smtpd/resolver.c +++ b/usr.sbin/smtpd/resolver.c @@ -284,30 +284,18 @@ resolver_dispatch_request(struct mproc *proc, struct imsg *imsg) static struct addrinfo * _alloc_addrinfo(const struct addrinfo *ai0, const struct sockaddr *sa, -<<<<<<< HEAD - const char *cname) -{ - struct addrinfo *ai; - - ai = calloc(1, sizeof(*ai) + SA_LEN(sa)); -======= const char *cname) { struct addrinfo *ai; - ai = calloc(1, sizeof(*ai) + sa->sa_len); ->>>>>>> ce5509e44fe... Fix a memory leak: use a single memory allocation for struct addrinfo and + ai = calloc(1, sizeof(*ai) + SA_LEN(sa)); if (ai == NULL) { log_warn("%s: calloc", __func__); return NULL; } *ai = *ai0; ai->ai_addr = (void *)(ai + 1); -<<<<<<< HEAD - memmove(ai->ai_addr, sa, SA_LEN(sa)); -======= - memcpy(ai->ai_addr, sa, sa->sa_len); ->>>>>>> ce5509e44fe... Fix a memory leak: use a single memory allocation for struct addrinfo and + memcpy(ai->ai_addr, sa, SA_LEN(sa)); if (cname) { ai->ai_canonname = strdup(cname); @@ -317,7 +305,7 @@ _alloc_addrinfo(const struct addrinfo *ai0, const struct sockaddr *sa, return NULL; } } - +git return ai; } diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index 9307fc3b..24f561a5 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.335 2020/09/23 19:11:50 martijn Exp $ */ +/* $OpenBSD: smtpd.c,v 1.336 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -98,7 +98,7 @@ static int smtpd(void); static void parent_shutdown(void); static void parent_send_config(int, short, void *); static void parent_send_config_lka(void); -static void parent_send_config_pony(void); +static void parent_send_config_dispatcher(void); static void parent_send_config_ca(void); static void parent_sig_handler(int, short, void *); static void forkmda(struct mproc *, uint64_t, struct deliver *); @@ -172,7 +172,7 @@ struct mproc *p_lka = NULL; struct mproc *p_parent = NULL; struct mproc *p_queue = NULL; struct mproc *p_scheduler = NULL; -struct mproc *p_pony = NULL; +struct mproc *p_dispatcher = NULL; struct mproc *p_ca = NULL; const char *backend_queue = "fs"; @@ -325,7 +325,7 @@ parent_shutdown(void) pid_t pid; mproc_clear(p_ca); - mproc_clear(p_pony); + mproc_clear(p_dispatcher); mproc_clear(p_control); mproc_clear(p_lka); mproc_clear(p_scheduler); @@ -345,17 +345,17 @@ static void parent_send_config(int fd, short event, void *p) { parent_send_config_lka(); - parent_send_config_pony(); + parent_send_config_dispatcher(); parent_send_config_ca(); purge_config(PURGE_PKI); } static void -parent_send_config_pony(void) +parent_send_config_dispatcher(void) { - log_debug("debug: parent_send_config: configuring pony process"); - m_compose(p_pony, IMSG_CONF_START, 0, 0, -1, NULL, 0); - m_compose(p_pony, IMSG_CONF_END, 0, 0, -1, NULL, 0); + log_debug("debug: parent_send_config: configuring dispatcher process"); + m_compose(p_dispatcher, IMSG_CONF_START, 0, 0, -1, NULL, 0); + m_compose(p_dispatcher, IMSG_CONF_END, 0, 0, -1, NULL, 0); } void @@ -473,13 +473,13 @@ parent_sig_handler(int sig, short event, void *p) "for session %016"PRIx64 ": %s", child->mda_id, cause); - m_create(p_pony, IMSG_MDA_DONE, 0, 0, + m_create(p_dispatcher, IMSG_MDA_DONE, 0, 0, child->mda_out); - m_add_id(p_pony, child->mda_id); - m_add_int(p_pony, mda_status); - m_add_int(p_pony, mda_sysexit); - m_add_string(p_pony, cause); - m_close(p_pony); + m_add_id(p_dispatcher, child->mda_id); + m_add_int(p_dispatcher, mda_status); + m_add_int(p_dispatcher, mda_sysexit); + m_add_string(p_dispatcher, cause); + m_close(p_dispatcher); break; @@ -759,8 +759,8 @@ main(int argc, char *argv[]) p_lka = start_child(save_argc, save_argv, "lka"); p_lka->proc = PROC_LKA; - p_pony = start_child(save_argc, save_argv, "pony"); - p_pony->proc = PROC_PONY; + p_dispatcher = start_child(save_argc, save_argv, "dispatcher"); + p_dispatcher->proc = PROC_DISPATCHER; p_queue = start_child(save_argc, save_argv, "queue"); p_queue->proc = PROC_QUEUE; @@ -770,12 +770,12 @@ main(int argc, char *argv[]) setup_peers(p_control, p_ca); setup_peers(p_control, p_lka); - setup_peers(p_control, p_pony); + setup_peers(p_control, p_dispatcher); setup_peers(p_control, p_queue); setup_peers(p_control, p_scheduler); - setup_peers(p_pony, p_ca); - setup_peers(p_pony, p_lka); - setup_peers(p_pony, p_queue); + setup_peers(p_dispatcher, p_ca); + setup_peers(p_dispatcher, p_lka); + setup_peers(p_dispatcher, p_queue); setup_peers(p_queue, p_lka); setup_peers(p_queue, p_scheduler); @@ -791,7 +791,7 @@ main(int argc, char *argv[]) setup_done(p_ca); setup_done(p_control); setup_done(p_lka); - setup_done(p_pony); + setup_done(p_dispatcher); setup_done(p_queue); setup_done(p_scheduler); @@ -828,11 +828,11 @@ main(int argc, char *argv[]) return lka(); } - else if (!strcmp(rexec, "pony")) { - smtpd_process = PROC_PONY; + else if (!strcmp(rexec, "dispatcher")) { + smtpd_process = PROC_DISPATCHER; setup_proc(); - return pony(); + return dispatcher(); } else if (!strcmp(rexec, "queue")) { @@ -1038,8 +1038,8 @@ setup_peer(enum smtp_proc_type proc, pid_t pid, int sock) case PROC_SCHEDULER: pp = &p_scheduler; break; - case PROC_PONY: - pp = &p_pony; + case PROC_DISPATCHER: + pp = &p_dispatcher; break; case PROC_CA: pp = &p_ca; @@ -1110,7 +1110,7 @@ smtpd(void) { child_add(p_control->pid, CHILD_DAEMON, proc_title(PROC_CONTROL)); child_add(p_lka->pid, CHILD_DAEMON, proc_title(PROC_LKA)); child_add(p_scheduler->pid, CHILD_DAEMON, proc_title(PROC_SCHEDULER)); - child_add(p_pony->pid, CHILD_DAEMON, proc_title(PROC_PONY)); + child_add(p_dispatcher->pid, CHILD_DAEMON, proc_title(PROC_DISPATCHER)); child_add(p_ca->pid, CHILD_DAEMON, proc_title(PROC_CA)); event_init(); @@ -1129,7 +1129,7 @@ smtpd(void) { config_peer(PROC_LKA); config_peer(PROC_QUEUE); config_peer(PROC_CA); - config_peer(PROC_PONY); + config_peer(PROC_DISPATCHER); evtimer_set(&config_ev, parent_send_config, NULL); memset(&tv, 0, sizeof(tv)); @@ -1485,12 +1485,12 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver) (void)snprintf(ebuf, sizeof ebuf, "delivery user '%s' does not exist", dsp->u.local.user); - m_create(p_pony, IMSG_MDA_DONE, 0, 0, -1); - m_add_id(p_pony, id); - m_add_int(p_pony, MDA_PERMFAIL); - m_add_int(p_pony, EX_NOUSER); - m_add_string(p_pony, ebuf); - m_close(p_pony); + m_create(p_dispatcher, IMSG_MDA_DONE, 0, 0, -1); + m_add_id(p_dispatcher, id); + m_add_int(p_dispatcher, MDA_PERMFAIL); + m_add_int(p_dispatcher, EX_NOUSER); + m_add_string(p_dispatcher, ebuf); + m_close(p_dispatcher); return; } pw_name = pw->pw_name; @@ -1515,23 +1515,23 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver) if (pw_uid == 0 && !dsp->u.local.is_mbox) { (void)snprintf(ebuf, sizeof ebuf, "not allowed to deliver to: %s", deliver->userinfo.username); - m_create(p_pony, IMSG_MDA_DONE, 0, 0, -1); - m_add_id(p_pony, id); - m_add_int(p_pony, MDA_PERMFAIL); - m_add_int(p_pony, EX_NOPERM); - m_add_string(p_pony, ebuf); - m_close(p_pony); + m_create(p_dispatcher, IMSG_MDA_DONE, 0, 0, -1); + m_add_id(p_dispatcher, id); + m_add_int(p_dispatcher, MDA_PERMFAIL); + m_add_int(p_dispatcher, EX_NOPERM); + m_add_string(p_dispatcher, ebuf); + m_close(p_dispatcher); return; } if (pipe(pipefd) == -1) { (void)snprintf(ebuf, sizeof ebuf, "pipe: %s", strerror(errno)); - m_create(p_pony, IMSG_MDA_DONE, 0, 0, -1); - m_add_id(p_pony, id); - m_add_int(p_pony, MDA_TEMPFAIL); - m_add_int(p_pony, EX_OSERR); - m_add_string(p_pony, ebuf); - m_close(p_pony); + m_create(p_dispatcher, IMSG_MDA_DONE, 0, 0, -1); + m_add_id(p_dispatcher, id); + m_add_int(p_dispatcher, MDA_TEMPFAIL); + m_add_int(p_dispatcher, EX_OSERR); + m_add_string(p_dispatcher, ebuf); + m_close(p_dispatcher); return; } @@ -1540,12 +1540,12 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver) allout = mkstemp(sfn); if (allout == -1) { (void)snprintf(ebuf, sizeof ebuf, "mkstemp: %s", strerror(errno)); - m_create(p_pony, IMSG_MDA_DONE, 0, 0, -1); - m_add_id(p_pony, id); - m_add_int(p_pony, MDA_TEMPFAIL); - m_add_int(p_pony, EX_OSERR); - m_add_string(p_pony, ebuf); - m_close(p_pony); + m_create(p_dispatcher, IMSG_MDA_DONE, 0, 0, -1); + m_add_id(p_dispatcher, id); + m_add_int(p_dispatcher, MDA_TEMPFAIL); + m_add_int(p_dispatcher, EX_OSERR); + m_add_string(p_dispatcher, ebuf); + m_close(p_dispatcher); close(pipefd[0]); close(pipefd[1]); return; @@ -1555,12 +1555,12 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver) pid = fork(); if (pid == -1) { (void)snprintf(ebuf, sizeof ebuf, "fork: %s", strerror(errno)); - m_create(p_pony, IMSG_MDA_DONE, 0, 0, -1); - m_add_id(p_pony, id); - m_add_int(p_pony, MDA_TEMPFAIL); - m_add_int(p_pony, EX_OSERR); - m_add_string(p_pony, ebuf); - m_close(p_pony); + m_create(p_dispatcher, IMSG_MDA_DONE, 0, 0, -1); + m_add_id(p_dispatcher, id); + m_add_int(p_dispatcher, MDA_TEMPFAIL); + m_add_int(p_dispatcher, EX_OSERR); + m_add_string(p_dispatcher, ebuf); + m_close(p_dispatcher); close(pipefd[0]); close(pipefd[1]); close(allout); @@ -1974,10 +1974,10 @@ proc_title(enum smtp_proc_type proc) return "control"; case PROC_SCHEDULER: return "scheduler"; - case PROC_PONY: - return "pony express"; + case PROC_DISPATCHER: + return "dispatcher"; case PROC_CA: - return "klondike"; + return "crypto"; case PROC_CLIENT: return "client"; case PROC_PROCESSOR: @@ -2000,8 +2000,8 @@ proc_name(enum smtp_proc_type proc) return "control"; case PROC_SCHEDULER: return "scheduler"; - case PROC_PONY: - return "pony"; + case PROC_DISPATCHER: + return "dispatcher"; case PROC_CA: return "ca"; case PROC_CLIENT: diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index c420c388..9e9e52be 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.659 2020/09/23 19:11:50 martijn Exp $ */ +/* $OpenBSD: smtpd.h,v 1.660 2020/12/31 08:27:15 martijn Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -371,7 +371,7 @@ enum smtp_proc_type { PROC_QUEUE, PROC_CONTROL, PROC_SCHEDULER, - PROC_PONY, + PROC_DISPATCHER, PROC_CA, PROC_PROCESSOR, PROC_CLIENT, @@ -1033,7 +1033,7 @@ extern struct mproc *p_parent; extern struct mproc *p_lka; extern struct mproc *p_queue; extern struct mproc *p_scheduler; -extern struct mproc *p_pony; +extern struct mproc *p_dispatcher; extern struct mproc *p_ca; extern struct smtpd *env; @@ -1605,9 +1605,9 @@ struct scheduler_backend *scheduler_backend_lookup(const char *); void scheduler_info(struct scheduler_info *, struct envelope *); -/* pony.c */ -int pony(void); -void pony_imsg(struct mproc *, struct imsg *); +/* dispatcher.c */ +int dispatcher(void); +void dispatcher_imsg(struct mproc *, struct imsg *); /* resolver.c */ diff --git a/usr.sbin/smtpd/smtpd/Makefile b/usr.sbin/smtpd/smtpd/Makefile index 858bfeda..1610b96f 100644 --- a/usr.sbin/smtpd/smtpd/Makefile +++ b/usr.sbin/smtpd/smtpd/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.109 2020/09/23 19:11:50 martijn Exp $ +# $OpenBSD: Makefile,v 1.110 2020/12/31 08:27:15 martijn Exp $ .PATH: ${.CURDIR}/.. @@ -35,7 +35,7 @@ SRCS+= mproc.c SRCS+= mta.c SRCS+= mta_session.c SRCS+= parse.y -SRCS+= pony.c +SRCS+= dispatcher.c SRCS+= proxy.c SRCS+= queue.c SRCS+= queue_backend.c |