summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/lka_session.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2012-10-13 21:33:34 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2012-10-13 21:33:34 +0000
commitccef80578e2da390227fda4e7f8ba6772e716fd0 (patch)
tree463d644a101e5fd745af345f2941b431569c3377 /usr.sbin/smtpd/lka_session.c
parentfdde35671bd7139f956eab50727985bf57a18f7c (diff)
in aliases expansion, we can avoid requesting parent for ~user/.forward, if
we check that user is a system user first before sending the imsg
Diffstat (limited to 'usr.sbin/smtpd/lka_session.c')
-rw-r--r--usr.sbin/smtpd/lka_session.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c
index 488d6c062a5..0c09acbeb9a 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.44 2012/10/13 08:01:47 eric Exp $ */
+/* $OpenBSD: lka_session.c,v 1.45 2012/10/13 21:33:33 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -195,6 +195,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn)
struct forward_req fwreq;
struct envelope ep;
struct expandnode node;
+ struct passwd *pw;
int r;
if (xn->depth >= EXPAND_DEPTH) {
@@ -290,6 +291,14 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn)
break;
}
+ pw = getpwnam(xn->u.user);
+ if (pw == NULL) {
+ log_debug("lka_expand: user-part does not match system user");
+ lks->flags |= F_ERROR;
+ lks->ss.code = 530;
+ break;
+ }
+
/* no aliases found, query forward file */
lks->rule = rule;
lks->node = xn;