aboutsummaryrefslogtreecommitdiffstats
path: root/smtpd/mta.c
diff options
context:
space:
mode:
Diffstat (limited to 'smtpd/mta.c')
-rw-r--r--smtpd/mta.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/smtpd/mta.c b/smtpd/mta.c
index 59592695..03ab187c 100644
--- a/smtpd/mta.c
+++ b/smtpd/mta.c
@@ -1572,6 +1572,9 @@ mta_relay(struct envelope *e)
key.helotable = e->agent.mta.relay.helotable;
if (!key.helotable[0])
key.helotable = NULL;
+ key.heloname = e->agent.mta.relay.heloname;
+ if (!key.heloname[0])
+ key.heloname = NULL;
if ((r = SPLAY_FIND(mta_relay_tree, &relays, &key)) == NULL) {
r = xcalloc(1, sizeof *r, "mta_relay");
@@ -1594,6 +1597,9 @@ mta_relay(struct envelope *e)
if (key.helotable)
r->helotable = xstrdup(key.helotable,
"mta: helotable");
+ if (key.heloname)
+ r->heloname = xstrdup(key.heloname,
+ "mta: heloname");
SPLAY_INSERT(mta_relay_tree, &relays, r);
stat_increment("mta.relay", 1);
} else {
@@ -1635,6 +1641,7 @@ mta_relay_unref(struct mta_relay *relay)
free(relay->backupname);
free(relay->cert);
free(relay->helotable);
+ free(relay->heloname);
free(relay->secret);
free(relay->sourcetable);
@@ -1707,6 +1714,12 @@ mta_relay_to_text(struct mta_relay *relay)
strlcat(buf, relay->helotable, sizeof buf);
}
+ if (relay->heloname) {
+ strlcat(buf, sep, sizeof buf);
+ strlcat(buf, "heloname=", sizeof buf);
+ strlcat(buf, relay->heloname, sizeof buf);
+ }
+
strlcat(buf, "]", sizeof buf);
return (buf);
@@ -1844,6 +1857,12 @@ mta_relay_cmp(const struct mta_relay *a, const struct mta_relay *b)
return (1);
if (a->helotable && ((r = strcmp(a->helotable, b->helotable))))
return (r);
+ if (a->heloname == NULL && b->heloname)
+ return (-1);
+ if (a->heloname && b->heloname == NULL)
+ return (1);
+ if (a->heloname && ((r = strcmp(a->heloname, b->heloname))))
+ return (r);
if (a->cert == NULL && b->cert)
return (-1);