-/* $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 <gilles@poolp.org>
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)
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)
{
-/* $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 <gilles@poolp.org>
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;
}
-/* $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 <gilles@poolp.org>
/* 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 *);