Download raw body.
smtpd: be more relaxed in table usage
Hi
I just stumbled over a blogpost[0] about smtpd, where I noticed that the
config needs some duplicate tables for domains which are relayed. Here
is the relevant config from the post:
table relay_for_domains {
"nuug.no",
"blug.linux.no"
# again more domains in the real smtpd.conf, left out here
}
table domain_relays {
"nuug.no" = "smtp://mx1.nuug.no",
"blug.linux.no" = "smtp://mail.lamasti.net"
# again more domains in the real smtpd.conf, left out here
}
action "relay_domain" relay domain <domain_relays>
match from any for domain <relay_for_domains> action relay_domain
To avoid config errors it would be better when the config could use only
the domain_relays table. Following patch allowes this:
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index 7fc3a63d83f..a4cfbbf624a 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1460,7 +1460,7 @@ negation TAG REGEX tables {
YYERROR;
}
- if (!table_check_use(t, T_DYNAMIC|T_LIST, K_DOMAIN)) {
+ if (!table_check_use(t, T_DYNAMIC|T_LIST|T_HASH, K_DOMAIN)) {
yyerror("table \"%s\" may not be used for 'for' lookups",
t->t_name);
YYERROR;
I haven't had time to test this but this is more or less a follow up to
an old patch[1] and does basicly the same for a different option.
Philipp
Ps: I have started to check the other match options as well, so there
might follow some similar patches.
[0] https://nxdomain.no/~peter/time_for_opensmtpd.html
[1] https://marc.info/?l=openbsd-tech&m=170731437129617&w=2
smtpd: be more relaxed in table usage