summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/lka_session.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2011-10-25 10:25:52 +0000
committerEric Faurot <eric@cvs.openbsd.org>2011-10-25 10:25:52 +0000
commita40911d58a8f5f9d2f189dc88ad84e25bfdb8493 (patch)
treeb12ff7e55180d9bf875998733ea86ca969f5612f /usr.sbin/smtpd/lka_session.c
parent44d661c7e0a659eeaae1fdf2d7f038b78a694f03 (diff)
rewrite the sender user/domain as specified in the manpage when matching
a "relay... as" rule. mikeb can now send mails. ok gilles@ mikeb@
Diffstat (limited to 'usr.sbin/smtpd/lka_session.c')
-rw-r--r--usr.sbin/smtpd/lka_session.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c
index 6c0ddcb82a3..f4bd85b138b 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.11 2011/10/23 09:30:07 gilles Exp $ */
+/* $OpenBSD: lka_session.c,v 1.12 2011/10/25 10:25:51 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -395,8 +395,18 @@ lka_session_deliver(struct lka_session *lks, struct envelope *ep)
else if (new_ep->type == D_MTA) {
if (ep->rule.r_action == A_RELAYVIA)
new_ep->agent.mta.relay = ep->rule.r_value.relayhost;
- if (ep->rule.r_as)
- new_ep->sender = *ep->rule.r_as;
+ if (ep->rule.r_as) {
+ if (ep->rule.r_as->user[0]) {
+ strlcpy(new_ep->sender.user,
+ ep->rule.r_as->user,
+ sizeof new_ep->sender.user);
+ }
+ if (ep->rule.r_as->domain[0]) {
+ strlcpy(new_ep->sender.domain,
+ ep->rule.r_as->domain,
+ sizeof new_ep->sender.domain);
+ }
+ }
}
TAILQ_INSERT_TAIL(&lks->deliverylist, new_ep, entry);
}