-.\" $OpenBSD: aliases.5,v 1.9 2015/09/03 12:23:23 millert Exp $
+.\" $OpenBSD: aliases.5,v 1.10 2015/10/28 07:25:30 gilles Exp $
.\"
.\" Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 3 2015 $
+.Dd $Mdocdate: October 28 2015 $
.Dt ALIASES 5
.Os
.Sh NAME
The code must be 3 digits,
starting 4XX (TempFail) or 5XX (PermFail).
The message must be present and can be freely chosen.
+.It Ar maildir Ns : Ns /path
+Deliver messages to Maildir at the
+.Ar path.
.El
.Sh FILES
.Bl -tag -width "/etc/mail/aliasesXXX" -compact
-/* $OpenBSD: lka_session.c,v 1.71 2015/10/06 06:44:47 gilles Exp $ */
+/* $OpenBSD: lka_session.c,v 1.72 2015/10/28 07:25:30 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
"[depth=%d]", xn->u.buffer, xn->depth);
lka_submit(lks, rule, xn);
break;
+
+ case EXPAND_MAILDIR:
+ log_trace(TRACE_EXPAND, "expand: lka_expand: maildir: %s "
+ "[depth=%d]", xn->u.buffer, xn->depth);
+ r = table_lookup(rule->r_userbase, NULL,
+ xn->parent->u.user, K_USERINFO, &lk);
+ if (r == -1) {
+ log_trace(TRACE_EXPAND, "expand: lka_expand: maildir: "
+ "backend error while searching user");
+ lks->error = LKA_TEMPFAIL;
+ break;
+ }
+ if (r == 0) {
+ log_trace(TRACE_EXPAND, "expand: lka_expand: maildir: "
+ "user-part does not match system user");
+ lks->error = LKA_PERMFAIL;
+ break;
+ }
+
+ lka_submit(lks, rule, xn);
+ break;
}
}
(void)strlcpy(ep->agent.mda.buffer, rule->r_value.buffer,
sizeof ep->agent.mda.buffer);
}
+ else if (xn->type == EXPAND_MAILDIR) {
+ ep->agent.mda.method = A_MAILDIR;
+ (void)strlcpy(ep->agent.mda.buffer, xn->u.buffer,
+ sizeof ep->agent.mda.buffer);
+ }
else
fatalx("lka_deliver: bad node type");
-/* $OpenBSD: smtpd.h,v 1.480 2015/10/27 20:14:19 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.481 2015/10/28 07:25:30 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
EXPAND_FILTER,
EXPAND_INCLUDE,
EXPAND_ADDRESS,
- EXPAND_ERROR
+ EXPAND_ERROR,
+ EXPAND_MAILDIR
};
struct expandnode {
-/* $OpenBSD: to.c,v 1.20 2015/10/14 22:01:43 gilles Exp $ */
+/* $OpenBSD: to.c,v 1.21 2015/10/28 07:25:30 gilles Exp $ */
/*
* Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
#include "log.h"
static const char *in6addr_to_text(const struct in6_addr *);
+static int alias_is_maildir(struct expandnode *, const char *, size_t);
static int alias_is_filter(struct expandnode *, const char *, size_t);
static int alias_is_username(struct expandnode *, const char *, size_t);
static int alias_is_address(struct expandnode *, const char *, size_t);
alias_is_filter(expandnode, s, l) ||
alias_is_filename(expandnode, s, l) ||
alias_is_address(expandnode, s, l) ||
+ alias_is_maildir(expandnode, s, l) ||
alias_is_username(expandnode, s, l))
return (1);
case EXPAND_FILENAME:
case EXPAND_INCLUDE:
case EXPAND_ERROR:
+ case EXPAND_MAILDIR:
return expandnode->u.buffer;
case EXPAND_USERNAME:
return expandnode->u.user;
/******/
+static int
+alias_is_maildir(struct expandnode *alias, const char *line, size_t len)
+{
+ if (strncasecmp("maildir:", line, 8) != 0)
+ return (0);
+
+ line += 8;
+ memset(alias, 0, sizeof *alias);
+ alias->type = EXPAND_MAILDIR;
+ if (strlcpy(alias->u.buffer, line,
+ sizeof(alias->u.buffer)) >= sizeof(alias->u.buffer))
+ return (0);
+
+ return (1);
+}
+
static int
alias_is_filter(struct expandnode *alias, const char *line, size_t len)
{