diff options
author | gilles <gilles@poolp.org> | 2016-09-01 12:41:52 +0200 |
---|---|---|
committer | gilles <gilles@poolp.org> | 2016-09-01 12:41:52 +0200 |
commit | 5d84737b42c5fdc38a572e69a6875a05b3e6d1de (patch) | |
tree | d0ce61b31fb291edcfab8acd7dbe8e88186f2ee7 /smtpd | |
parent | bring back CVS/ in gitignore (diff) | |
download | OpenSMTPD-5d84737b42c5fdc38a572e69a6875a05b3e6d1de.tar.xz OpenSMTPD-5d84737b42c5fdc38a572e69a6875a05b3e6d1de.zip |
sync with OpenBSD
Diffstat (limited to 'smtpd')
-rw-r--r-- | smtpd/aliases.c | 11 | ||||
-rw-r--r-- | smtpd/delivery_maildir.c | 4 | ||||
-rw-r--r-- | smtpd/lka_session.c | 8 | ||||
-rw-r--r-- | smtpd/mproc.c | 33 | ||||
-rw-r--r-- | smtpd/parse.y | 62 | ||||
-rw-r--r-- | smtpd/queue.c | 57 | ||||
-rw-r--r-- | smtpd/ruleset.c | 5 | ||||
-rw-r--r-- | smtpd/smtp_session.c | 17 | ||||
-rw-r--r-- | smtpd/smtpd-defines.h | 4 | ||||
-rw-r--r-- | smtpd/smtpd.c | 12 | ||||
-rw-r--r-- | smtpd/smtpd.conf.5 | 26 | ||||
-rw-r--r-- | smtpd/smtpd.h | 17 | ||||
-rw-r--r-- | smtpd/util.c | 6 |
13 files changed, 162 insertions, 100 deletions
diff --git a/smtpd/aliases.c b/smtpd/aliases.c index 20645878..b1396512 100644 --- a/smtpd/aliases.c +++ b/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.70 2016/05/21 19:28:19 gilles Exp $ */ +/* $OpenBSD: aliases.c,v 1.71 2016/08/31 10:18:08 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -54,7 +54,7 @@ aliases_get(struct expand *expand, const char *username) xlowercase(buf, username, sizeof(buf)); /* first, check if entry has a user-part tag */ - pbuf = strchr(buf, TAG_CHAR); + pbuf = strchr(buf, *env->sc_subaddressing_delim); if (pbuf) { ret = table_lookup(mapping, NULL, buf, K_ALIAS, &lk); if (ret < 0) @@ -116,7 +116,7 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) xlowercase(domain, domain, sizeof(domain)); memset(tag, '\0', sizeof tag); - pbuf = strchr(user, TAG_CHAR); + pbuf = strchr(user, *env->sc_subaddressing_delim); if (pbuf) { if (!bsnprintf(tag, sizeof(tag), "%s", pbuf + 1)) return 0; @@ -127,7 +127,7 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) /* first, check if entry has a user-part tag */ if (tag[0]) { if (!bsnprintf(buf, sizeof(buf), "%s%c%s@%s", - user, TAG_CHAR, tag, domain)) + user, *env->sc_subaddressing_delim, tag, domain)) return 0; ret = table_lookup(mapping, NULL, buf, K_ALIAS, &lk); if (ret < 0) @@ -147,7 +147,8 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) if (tag[0]) { /* Failed ? We lookup for username + user-part tag */ - if (!bsnprintf(buf, sizeof(buf), "%s%c%s", user, TAG_CHAR, tag)) + if (!bsnprintf(buf, sizeof(buf), "%s%c%s", + user, *env->sc_subaddressing_delim, tag)) return 0; ret = table_lookup(mapping, NULL, buf, K_ALIAS, &lk); if (ret < 0) diff --git a/smtpd/delivery_maildir.c b/smtpd/delivery_maildir.c index 83ab82ec..2990eb61 100644 --- a/smtpd/delivery_maildir.c +++ b/smtpd/delivery_maildir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery_maildir.c,v 1.17 2015/12/28 22:08:30 jung Exp $ */ +/* $OpenBSD: delivery_maildir.c,v 1.18 2016/08/31 10:18:08 gilles Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org> @@ -55,7 +55,7 @@ mailaddr_tag(const struct mailaddr *maddr, char *dest, size_t len) char *tag; char *sanitized; - if ((tag = strchr(maddr->user, TAG_CHAR))) { + if ((tag = strchr(maddr->user, *env->sc_subaddressing_delim))) { tag++; while (*tag == '.') tag++; diff --git a/smtpd/lka_session.c b/smtpd/lka_session.c index 87ff4641..e70f359d 100644 --- a/smtpd/lka_session.c +++ b/smtpd/lka_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_session.c,v 1.79 2015/12/28 22:08:30 jung Exp $ */ +/* $OpenBSD: lka_session.c,v 1.80 2016/08/31 10:18:08 gilles Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org> @@ -274,7 +274,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) int r; union lookup lk; char *tag; - + if (xn->depth >= EXPAND_DEPTH) { log_trace(TRACE_EXPAND, "expand: lka_expand: node too deep."); lks->error = LKA_PERMFAIL; @@ -378,7 +378,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) } /* gilles+hackers@ -> gilles@ */ - if ((tag = strchr(xn->u.user, TAG_CHAR)) != NULL) + if ((tag = strchr(xn->u.user, *env->sc_subaddressing_delim)) != NULL) *tag++ = '\0'; r = table_lookup(rule->r_userbase, NULL, xn->u.user, K_USERINFO, &lk); @@ -874,7 +874,7 @@ mod_strip(char *buf, size_t len) unsigned int i; /* gilles+hackers -> gilles */ - if ((tag = strchr(buf, TAG_CHAR)) != NULL) { + if ((tag = strchr(buf, *env->sc_subaddressing_delim)) != NULL) { /* gilles+hackers@poolp.org -> gilles@poolp.org */ if ((at = strchr(tag, '@')) != NULL) { for (i = 0; i <= strlen(at); ++i) diff --git a/smtpd/mproc.c b/smtpd/mproc.c index 122b70cf..7006d31c 100644 --- a/smtpd/mproc.c +++ b/smtpd/mproc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mproc.c,v 1.22 2016/09/01 10:07:20 eric Exp $ */ +/* $OpenBSD: mproc.c,v 1.21 2016/08/31 21:49:01 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@faurot.net> @@ -174,6 +174,7 @@ mproc_dispatch(int fd, short event, void *arg) p->handler(p, NULL); return; default: + p->bytes_in += n; break; } } @@ -188,6 +189,9 @@ mproc_dispatch(int fd, short event, void *arg) proc_name(smtpd_process), p->name); p->handler(p, NULL); return; + } else if (n != -1) { + p->bytes_out += n; + p->bytes_queued -= n; } } @@ -208,16 +212,12 @@ mproc_dispatch(int fd, short event, void *arg) if (n == 0) break; + p->msg_in += 1; p->handler(p, &imsg); imsg_free(&imsg); } -#if 0 - if (smtpd_process == PROC_QUEUE) - queue_flow_control(); -#endif - mproc_event_add(p); } @@ -327,6 +327,11 @@ m_forward(struct mproc *p, struct imsg *imsg) imsg->hdr.len - sizeof(imsg->hdr), imsg_to_str(imsg->hdr.type)); + p->msg_out += 1; + p->bytes_queued += imsg->hdr.len; + if (p->bytes_queued > p->bytes_queued_max) + p->bytes_queued_max = p->bytes_queued; + mproc_event_add(p); } @@ -344,6 +349,11 @@ m_compose(struct mproc *p, uint32_t type, uint32_t peerid, pid_t pid, int fd, len, imsg_to_str(type)); + p->msg_out += 1; + p->bytes_queued += len + IMSG_HEADER_SIZE; + if (p->bytes_queued > p->bytes_queued_max) + p->bytes_queued_max = p->bytes_queued; + mproc_event_add(p); } @@ -360,6 +370,11 @@ m_composev(struct mproc *p, uint32_t type, uint32_t peerid, pid_t pid, for (i = 0; i < n; i++) len += iov[i].iov_len; + p->msg_out += 1; + p->bytes_queued += IMSG_HEADER_SIZE + len; + if (p->bytes_queued > p->bytes_queued_max) + p->bytes_queued_max = p->bytes_queued; + if (type != IMSG_STAT_DECREMENT && type != IMSG_STAT_INCREMENT) log_trace(TRACE_MPROC, "mproc: %s -> %s : %zu %s", @@ -437,6 +452,11 @@ m_close(struct mproc *p) p->m_pos, imsg_to_str(p->m_type)); + p->msg_out += 1; + p->bytes_queued += p->m_pos + IMSG_HEADER_SIZE; + if (p->bytes_queued > p->bytes_queued_max) + p->bytes_queued_max = p->bytes_queued; + mproc_event_add(p); } @@ -453,6 +473,7 @@ m_flush(struct mproc *p) p->m_pos, imsg_to_str(p->m_type)); + p->msg_out += 1; p->m_pos = 0; imsg_flush(&p->imsgbuf); diff --git a/smtpd/parse.y b/smtpd/parse.y index 6d14f9a2..81572f65 100644 --- a/smtpd/parse.y +++ b/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.186 2016/07/01 17:53:23 eric Exp $ */ +/* $OpenBSD: parse.y,v 1.189 2016/08/31 15:24:04 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -178,7 +178,7 @@ typedef struct { %token ACCEPT REJECT INCLUDE ERROR MDA FROM FOR SOURCE MTA PKI SCHEDULER %token ARROW AUTH TLS LOCAL VIRTUAL TAG TAGGED ALIAS FILTER KEY CA DHE %token AUTH_OPTIONAL TLS_REQUIRE USERBASE SENDER SENDERS MASK_SOURCE VERIFY FORWARDONLY RECIPIENT -%token CIPHERS RECEIVEDAUTH MASQUERADE SOCKET +%token CIPHERS RECEIVEDAUTH MASQUERADE SOCKET SUBADDRESSING_DELIM AUTHENTICATED %token <v.string> STRING %token <v.number> NUMBER %type <v.table> table @@ -272,6 +272,11 @@ tagged : TAGGED negation STRING { } ; +authenticated : AUTHENTICATED { + rule->r_wantauth = 1; + } + ; + bouncedelay : STRING { time_t d; int i; @@ -435,6 +440,38 @@ opt_sock_listen : FILTER STRING { YYERROR; } } + | SENDERS tables { + struct table *t = $2; + + if (listen_opts.options & LO_SENDERS) { + yyerror("senders already specified"); + YYERROR; + } + listen_opts.options |= LO_SENDERS; + + if (!table_check_use(t, T_DYNAMIC|T_HASH, K_MAILADDRMAP)) { + yyerror("invalid use of table \"%s\" as " + "SENDERS parameter", t->t_name); + YYERROR; + } + listen_opts.sendertable = t; + } + | SENDERS tables MASQUERADE { + struct table *t = $2; + + if (listen_opts.options & LO_SENDERS) { + yyerror("senders already specified"); + YYERROR; + } + listen_opts.options |= LO_SENDERS|LO_MASQUERADE; + + if (!table_check_use(t, T_DYNAMIC|T_HASH, K_MAILADDRMAP)) { + yyerror("invalid use of table \"%s\" as " + "SENDERS parameter", t->t_name); + YYERROR; + } + listen_opts.sendertable = t; + } ; opt_if_listen : INET4 { @@ -848,6 +885,21 @@ relay_via : opt_relay_common relay_via main : BOUNCEWARN { memset(conf->sc_bounce_warn, 0, sizeof conf->sc_bounce_warn); } bouncedelays + | SUBADDRESSING_DELIM STRING { + if (strlen($2) != 1) { + yyerror("subaddressing-delimiter must be one character"); + free($2); + YYERROR; + } + + if (isspace((int)*$2) || !isprint((int)*$2) || *$2== '@') { + yyerror("subaddressing-delimiter uses invalid character"); + free($2); + YYERROR; + } + + conf->sc_subaddressing_delim = $2; + } | QUEUE COMPRESSION { conf->sc_queue_flags |= QUEUE_COMPRESSION; } @@ -958,7 +1010,7 @@ main : BOUNCEWARN { } } ca | CIPHERS STRING { - env->sc_tls_ciphers = $2; + conf->sc_tls_ciphers = $2; } ; @@ -1362,6 +1414,7 @@ opt_decision : sender | from | for | tagged + | authenticated ; decision : opt_decision decision | @@ -1472,6 +1525,7 @@ lookup(char *s) { "as", AS }, { "auth", AUTH }, { "auth-optional", AUTH_OPTIONAL }, + { "authenticated", AUTHENTICATED }, { "backup", BACKUP }, { "bounce-warn", BOUNCEWARN }, { "ca", CA }, @@ -1523,6 +1577,7 @@ lookup(char *s) { "smtps", SMTPS }, { "socket", SOCKET }, { "source", SOURCE }, + { "subaddressing-delimiter", SUBADDRESSING_DELIM }, { "table", TABLE }, { "tag", TAG }, { "tagged", TAGGED }, @@ -1877,6 +1932,7 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts) (void)strlcpy(conf->sc_hostname, hostname, sizeof(conf->sc_hostname)); conf->sc_maxsize = DEFAULT_MAX_BODY_SIZE; + conf->sc_subaddressing_delim = SUBADDRESSING_DELIMITER; conf->sc_tables_dict = calloc(1, sizeof(*conf->sc_tables_dict)); conf->sc_rules = calloc(1, sizeof(*conf->sc_rules)); diff --git a/smtpd/queue.c b/smtpd/queue.c index 6660f96c..5582d04b 100644 --- a/smtpd/queue.c +++ b/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.178 2016/05/28 21:21:20 eric Exp $ */ +/* $OpenBSD: queue.c,v 1.179 2016/08/31 21:49:01 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -49,15 +49,6 @@ static void queue_sig_handler(int, short, void *); static void queue_log(const struct envelope *, const char *, const char *); static void queue_msgid_walk(int, short, void *); -static size_t flow_agent_hiwat = 10 * 1024 * 1024; -static size_t flow_agent_lowat = 1 * 1024 * 1024; -static size_t flow_scheduler_hiwat = 10 * 1024 * 1024; -static size_t flow_scheduler_lowat = 1 * 1024 * 1024; - -#define LIMIT_AGENT 0x01 -#define LIMIT_SCHEDULER 0x02 - -static int limit = 0; static void queue_imsg(struct mproc *p, struct imsg *imsg) @@ -797,49 +788,3 @@ queue_log(const struct envelope *e, const char *prefix, const char *status) duration_to_text(time(NULL) - e->creation), status); } - -void -queue_flow_control(void) -{ - size_t bufsz; - int oldlimit = limit; - int set, unset; - - bufsz = p_pony->bytes_queued; - if (bufsz <= flow_agent_lowat) - limit &= ~LIMIT_AGENT; - else if (bufsz > flow_agent_hiwat) - limit |= LIMIT_AGENT; - - if (p_scheduler->bytes_queued <= flow_scheduler_lowat) - limit &= ~LIMIT_SCHEDULER; - else if (p_scheduler->bytes_queued > flow_scheduler_hiwat) - limit |= LIMIT_SCHEDULER; - - set = limit & (limit ^ oldlimit); - unset = oldlimit & (limit ^ oldlimit); - - if (set & LIMIT_SCHEDULER) { - log_warnx("warn: queue: Hiwat reached on scheduler buffer: " - "suspending transfer, delivery and lookup input"); - mproc_disable(p_pony); - mproc_disable(p_lka); - } - else if (unset & LIMIT_SCHEDULER) { - log_warnx("warn: queue: Down to lowat on scheduler buffer: " - "resuming transfer, delivery and lookup input"); - mproc_enable(p_pony); - mproc_enable(p_lka); - } - - if (set & LIMIT_AGENT) { - log_warnx("warn: queue: Hiwat reached on transfer and delivery " - "buffers: suspending scheduler input"); - mproc_disable(p_scheduler); - } - else if (unset & LIMIT_AGENT) { - log_warnx("warn: queue: Down to lowat on transfer and delivery " - "buffers: resuming scheduler input"); - mproc_enable(p_scheduler); - } -} diff --git a/smtpd/ruleset.c b/smtpd/ruleset.c index 2b9e6855..5583b6c9 100644 --- a/smtpd/ruleset.c +++ b/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.32 2015/10/27 20:14:19 gilles Exp $ */ +/* $OpenBSD: ruleset.c,v 1.33 2016/08/31 15:24:04 gilles Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@poolp.org> @@ -56,6 +56,9 @@ ruleset_match(const struct envelope *evp) continue; } + if (r->r_wantauth && !(evp->flags & EF_AUTHENTICATED)) + continue; + ret = ruleset_check_source(r->r_sources, ss, evp->flags); if (ret == -1) { errno = EAGAIN; diff --git a/smtpd/smtp_session.c b/smtpd/smtp_session.c index 0a17aed9..1927ec5f 100644 --- a/smtpd/smtp_session.c +++ b/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.284 2016/07/22 12:12:29 eric Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.285 2016/07/29 08:53:07 giovanni Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -934,23 +934,26 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) strnvis(user, s->username, sizeof user, VIS_WHITE | VIS_SAFE); if (success == LKA_OK) { log_info("%016"PRIx64" smtp " - "event=authentication user=%s result=ok", - s->id, user); + "event=authentication user=%s address=%s " + "host=%s result=ok", + s->id, user, ss_to_text(&s->ss), s->hostname); s->flags |= SF_AUTHENTICATED; smtp_reply(s, "235 %s: Authentication succeeded", esc_code(ESC_STATUS_OK, ESC_OTHER_STATUS)); } else if (success == LKA_PERMFAIL) { log_info("%016"PRIx64" smtp " - "event=authentication user=%s result=permfail", - s->id, user); + "event=authentication user=%s address=%s " + "host=%s result=permfail", + s->id, user, ss_to_text(&s->ss), s->hostname); smtp_auth_failure_pause(s); return; } else if (success == LKA_TEMPFAIL) { log_info("%016"PRIx64" smtp " - "event=authentication user=%s result=tempfail", - s->id, user); + "event=authentication user=%s address=%s " + "host=%s result=tempfail", + s->id, user, ss_to_text(&s->ss), s->hostname); smtp_reply(s, "421 %s: Temporary failure", esc_code(ESC_STATUS_TEMPFAIL, ESC_OTHER_MAIL_SYSTEM_STATUS)); } diff --git a/smtpd/smtpd-defines.h b/smtpd/smtpd-defines.h index 09337bf6..0fc459cb 100644 --- a/smtpd/smtpd-defines.h +++ b/smtpd/smtpd-defines.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd-defines.h,v 1.6 2015/11/30 14:39:21 gilles Exp $ */ +/* $OpenBSD: smtpd-defines.h,v 1.7 2016/08/31 10:18:08 gilles Exp $ */ /* * Copyright (c) 2013 Gilles Chehade <gilles@poolp.org> @@ -37,7 +37,7 @@ #define SMTPD_QUEUE_GROUP "_smtpq" #define PATH_SPOOL "/var/spool/smtpd" -#define TAG_CHAR '+' +#define SUBADDRESSING_DELIMITER "+" /* sendmail compat */ diff --git a/smtpd/smtpd.c b/smtpd/smtpd.c index cbf1019c..f2060208 100644 --- a/smtpd/smtpd.c +++ b/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.281 2016/09/01 10:07:20 eric Exp $ */ +/* $OpenBSD: smtpd.c,v 1.280 2016/08/19 15:35:08 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -552,6 +552,8 @@ main(int argc, char *argv[]) profiling |= PROFILE_IMSG; else if (!strcmp(optarg, "profile-queue")) profiling |= PROFILE_QUEUE; + else if (!strcmp(optarg, "profile-buffers")) + profiling |= PROFILE_BUFFERS; else log_warnx("warn: unknown trace flag \"%s\"", optarg); @@ -707,7 +709,7 @@ main(int argc, char *argv[]) setup_done(p_queue); setup_done(p_scheduler); - log_info("smtpd: setup done"); + log_debug("smtpd: setup done"); return smtpd(); } @@ -869,7 +871,7 @@ setup_done(struct mproc *p) if (imsg.hdr.type != IMSG_SETUP_DONE) fatalx("expect IMSG_SETUP_DONE"); - log_info("setup_done: %s[%d] done", p->name, p->pid); + log_debug("setup_done: %s[%d] done", p->name, p->pid); imsg_free(&imsg); } @@ -918,7 +920,7 @@ setup_proc(void) if (imsg_flush(ibuf) == -1) fatal("imsg_flush"); - log_info("setup_proc: %s done", proc_title(smtpd_process)); + log_debug("setup_proc: %s done", proc_title(smtpd_process)); } static struct mproc * @@ -926,7 +928,7 @@ setup_peer(enum smtp_proc_type proc, pid_t pid, int sock) { struct mproc *p, **pp; - log_info("setup_peer: %s -> %s[%u] fd=%d", proc_title(smtpd_process), + log_debug("setup_peer: %s -> %s[%u] fd=%d", proc_title(smtpd_process), proc_title(proc), pid, sock); if (sock == -1) diff --git a/smtpd/smtpd.conf.5 b/smtpd/smtpd.conf.5 index 4ff848b2..88af32e0 100644 --- a/smtpd/smtpd.conf.5 +++ b/smtpd/smtpd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: smtpd.conf.5,v 1.161 2016/05/19 08:21:23 gilles Exp $ +.\" $OpenBSD: smtpd.conf.5,v 1.165 2016/08/31 16:39:24 jmc Exp $ .\" .\" Copyright (c) 2008 Janne Johansson <jj@openbsd.org> .\" Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net> @@ -17,7 +17,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .\" -.Dd $Mdocdate: May 19 2016 $ +.Dd $Mdocdate: August 31 2016 $ .Dt SMTPD.CONF 5 .Os .Sh NAME @@ -82,7 +82,14 @@ the default action is to reject the message. An exclamation mark may be specified to perform a reverse match. .Pp Following the accept/reject -decision comes the optional tag matching: +decision comes the matching of optional session related properties: +.Bl -tag -width Ds +.It Ic authenticated +If specified, the rule will only be matched if the client session was +authenticated either by requesting authentication over the network or +because the message was submitted over the local enqueuer. +.El +.Pp .Bl -tag -width Ds .It Xo .Ic tagged @@ -899,6 +906,19 @@ utility. .Pp Queue encryption can be used with queue compression and will always perform compression before encryption. +.It Ic subaddressing-delimiter Ar delimiter +Redefine the subaddressing delimiter from the default +.Sq + +to +.Ar delimiter . +.Pp +Any printable character valid in an email address is allowed, +except spaces and +.Sq @ . +.Pp +The first character in the user-part of an email address that matches +.Ar delimiter +is considered to be the subaddressing delimiter. .It Ic table Ar name Oo Ar type : Oc Ns Ar config Tables are used to provide additional configuration information for .Xr smtpd 8 diff --git a/smtpd/smtpd.h b/smtpd/smtpd.h index 943a998c..be15fe87 100644 --- a/smtpd/smtpd.h +++ b/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.520 2016/09/01 10:07:20 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.519 2016/08/31 21:49:01 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -52,7 +52,7 @@ #define SMTPD_QUEUE_EXPIRY (4 * 24 * 60 * 60) #define SMTPD_SOCKET "/var/run/smtpd.sock" #define SMTPD_NAME "OpenSMTPD" -#define SMTPD_VERSION "master" +#define SMTPD_VERSION "6.0.0" #define SMTPD_SESSION_TIMEOUT 300 #define SMTPD_BACKLOG 5 @@ -395,6 +395,8 @@ struct rule { enum dest_type r_desttype; struct table *r_destination; + uint8_t r_wantauth; + enum action_type r_action; union rule_dest { char buffer[EXPAND_BUFFER]; @@ -633,6 +635,8 @@ struct smtpd { char sc_enqueue_filter[PATH_MAX]; char *sc_tls_ciphers; + + char *sc_subaddressing_delim; }; #define TRACE_DEBUG 0x0001 @@ -654,6 +658,7 @@ struct smtpd { #define PROFILE_TOSTAT 0x0001 #define PROFILE_IMSG 0x0002 #define PROFILE_QUEUE 0x0004 +#define PROFILE_BUFFERS 0x0008 struct forward_req { uint64_t id; @@ -1004,6 +1009,13 @@ struct mproc { short events; struct event ev; void *data; + + off_t msg_in; + off_t msg_out; + off_t bytes_in; + off_t bytes_out; + size_t bytes_queued; + size_t bytes_queued_max; }; struct msg { @@ -1329,7 +1341,6 @@ int cmdline_symset(char *); /* queue.c */ int queue(void); -void queue_flow_control(void); /* queue_backend.c */ diff --git a/smtpd/util.c b/smtpd/util.c index 728b1a99..bf2b86f3 100644 --- a/smtpd/util.c +++ b/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.127 2016/05/16 17:43:18 gilles Exp $ */ +/* $OpenBSD: util.c,v 1.128 2016/08/31 10:18:08 gilles Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -455,9 +455,9 @@ mailaddr_match(const struct mailaddr *maddr1, const struct mailaddr *maddr2) if (m2.user[0]) { /* if address from table has a tag, we must respect it */ - if (strchr(m2.user, TAG_CHAR) == NULL) { + if (strchr(m2.user, *env->sc_subaddressing_delim) == NULL) { /* otherwise, strip tag from session address if any */ - p = strchr(m1.user, TAG_CHAR); + p = strchr(m1.user, *env->sc_subaddressing_delim); if (p) *p = '\0'; } |