diff options
author | Charles Longeau <chl@cvs.openbsd.org> | 2012-07-12 08:51:44 +0000 |
---|---|---|
committer | Charles Longeau <chl@cvs.openbsd.org> | 2012-07-12 08:51:44 +0000 |
commit | 9f54542debb76e221205d8e0c355fb8f04cff66d (patch) | |
tree | a4255a3cca2c9c3fd47e41e5321f22121855da0a /usr.sbin/smtpd/lka_session.c | |
parent | 9f028027b87696fcb7ebed94f66e6c23c36ccf0d (diff) |
add support for maildir tagging/folders.
ok gilles@
ok eric@ on previous versions of this patch
Diffstat (limited to 'usr.sbin/smtpd/lka_session.c')
-rw-r--r-- | usr.sbin/smtpd/lka_session.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c index 5c7398c988c..87fc63f8f76 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.16 2011/12/13 22:04:35 eric Exp $ */ +/* $OpenBSD: lka_session.c,v 1.17 2012/07/12 08:51:43 chl Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org> @@ -75,7 +75,7 @@ int lka_session_envelope_expand(struct lka_session *lks, struct envelope *ep) { char *user; - char *sep; + char *tag; struct user_backend *ub; struct mta_user u; char username[MAX_LOCALPART_SIZE]; @@ -97,8 +97,13 @@ lka_session_envelope_expand(struct lka_session *lks, struct envelope *ep) lowercase(username, user, sizeof(username)); /* gilles+hackers@ -> gilles@ */ - if ((sep = strchr(username, '+')) != NULL) - *sep = '\0'; + if ((tag = strchr(username, '+')) != NULL) { + *tag++ = '\0'; + + /* skip dots after the '+' */ + while (*tag == '.') + tag++; + } if (aliases_exist(ep->rule.r_amap, username)) { if (! aliases_get(ep->rule.r_amap, @@ -131,6 +136,13 @@ lka_session_envelope_expand(struct lka_session *lks, struct envelope *ep) (void)strlcpy(ep->agent.mda.to.buffer, ep->rule.r_value.buffer, sizeof (ep->agent.mda.to.buffer)); + + if (tag && *tag) { + (void)strlcat(ep->agent.mda.to.buffer, "/.", + sizeof (ep->agent.mda.to.buffer)); + (void)strlcat(ep->agent.mda.to.buffer, tag, + sizeof (ep->agent.mda.to.buffer)); + } break; default: fatalx("lka_session_envelope_expand: unexpected rule action"); |