From 8d60711790bd44483d070b4ddf2038845bc6d723 Mon Sep 17 00:00:00 2001 From: gilles Date: Tue, 27 Oct 2015 20:14:19 +0000 Subject: [PATCH] aliases_virtual_check() has been unneeded for a while ok jung@, ok sunil@, ok millert@ --- usr.sbin/smtpd/aliases.c | 48 ++-------------------------------------- usr.sbin/smtpd/ruleset.c | 9 +------- usr.sbin/smtpd/smtpd.h | 3 +-- 3 files changed, 4 insertions(+), 56 deletions(-) diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 0b260f58cf6..a01cb73a074 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.66 2015/01/20 17:37:54 deraadt Exp $ */ +/* $OpenBSD: aliases.c,v 1.67 2015/10/27 20:14:19 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -49,7 +49,7 @@ aliases_get(struct expand *expand, const char *username) mapping = expand->rule->r_mapping; userbase = expand->rule->r_userbase; - + xlowercase(buf, username, sizeof(buf)); ret = table_lookup(mapping, NULL, buf, K_ALIAS, &lk); if (ret <= 0) @@ -75,50 +75,6 @@ aliases_get(struct expand *expand, const char *username) return nbaliases; } -int -aliases_virtual_check(struct table *table, const struct mailaddr *maddr) -{ - char buf[LINE_MAX]; - char *pbuf; - int ret; - - if (! bsnprintf(buf, sizeof(buf), "%s@%s", maddr->user, - maddr->domain)) - return 0; - xlowercase(buf, buf, sizeof(buf)); - - /* First, we lookup for full entry: user@domain */ - ret = table_lookup(table, NULL, buf, K_ALIAS, NULL); - if (ret < 0) - return (-1); - if (ret) - return 1; - - /* Failed ? We lookup for username only */ - pbuf = strchr(buf, '@'); - *pbuf = '\0'; - ret = table_lookup(table, NULL, buf, K_ALIAS, NULL); - if (ret < 0) - return (-1); - if (ret) - return 1; - - *pbuf = '@'; - /* Failed ? We lookup for catch all for virtual domain */ - ret = table_lookup(table, NULL, pbuf, K_ALIAS, NULL); - if (ret < 0) - return (-1); - if (ret) - return 1; - - /* Failed ? We lookup for a *global* catch all */ - ret = table_lookup(table, NULL, "@", K_ALIAS, NULL); - if (ret <= 0) - return (ret); - - return 1; -} - int aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) { diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c index 120b20505fd..2b9e6855ce0 100644 --- a/usr.sbin/smtpd/ruleset.c +++ b/usr.sbin/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.31 2015/01/20 17:37:54 deraadt Exp $ */ +/* $OpenBSD: ruleset.c,v 1.32 2015/10/27 20:14:19 gilles Exp $ */ /* * Copyright (c) 2009 Gilles Chehade @@ -94,13 +94,6 @@ ruleset_match(const struct envelope *evp) if ((ret == 0 && !r->r_notdestination) || (ret != 0 && r->r_notdestination)) continue; - if (r->r_desttype == DEST_VDOM && - (r->r_action == A_RELAY || r->r_action == A_RELAYVIA)) { - if (! aliases_virtual_check(r->r_mapping, - &evp->rcpt)) { - return NULL; - } - } goto matched; } diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 56c9bcc9218..57a6a7e1ffc 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.479 2015/10/21 16:44:28 jsing Exp $ */ +/* $OpenBSD: smtpd.h,v 1.480 2015/10/27 20:14:19 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -1061,7 +1061,6 @@ struct ca_vrfy_resp_msg { /* aliases.c */ int aliases_get(struct expand *, const char *); -int aliases_virtual_check(struct table *, const struct mailaddr *); int aliases_virtual_get(struct expand *, const struct mailaddr *); int alias_parse(struct expandnode *, const char *); -- 2.20.1