From: eric Date: Wed, 19 Sep 2018 05:31:12 +0000 (+0000) Subject: rename the ill-named "flags" member to "as_host" in domain structure. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1a271186e85b66dcbe83011aad3f479438afe003;p=openbsd rename the ill-named "flags" member to "as_host" in domain structure. remove yet another useless relay flag while there. ok gilles@ --- diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index 638ccb958d5..4da1a84c2eb 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.224 2018/09/17 12:16:27 eric Exp $ */ +/* $OpenBSD: mta.c,v 1.225 2018/09/19 05:31:12 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -848,7 +848,7 @@ mta_query_mx(struct mta_relay *relay) if (waitq_wait(&relay->domain->mxs, mta_on_mx, relay)) { id = generate_uid(); tree_xset(&wait_mx, id, relay->domain); - if (relay->domain->flags) + if (relay->domain->as_host) m_create(p_lka, IMSG_MTA_DNS_HOST, 0, 0, -1); else m_create(p_lka, IMSG_MTA_DNS_MX, 0, 0, -1); @@ -1722,7 +1722,6 @@ mta_relay(struct envelope *e, struct relayhost *relayh) if (relayh->hostname[0]) { key.domain = mta_domain(relayh->hostname, 1); - key.flags |= RELAY_MX; } else { key.domain = mta_domain(e->dest.domain, 0); @@ -1870,7 +1869,7 @@ mta_relay_to_text(struct mta_relay *relay) (void)strlcat(buf, relay->pki_name, sizeof buf); } - if (relay->flags & RELAY_MX) { + if (relay->domain->as_host) { (void)strlcat(buf, sep, sizeof buf); (void)strlcat(buf, "mx", sizeof buf); } @@ -2138,18 +2137,18 @@ mta_host_cmp(const struct mta_host *a, const struct mta_host *b) SPLAY_GENERATE(mta_host_tree, mta_host, entry, mta_host_cmp); static struct mta_domain * -mta_domain(char *name, int flags) +mta_domain(char *name, int as_host) { struct mta_domain key, *d; key.name = name; - key.flags = flags; + key.as_host = as_host; d = SPLAY_FIND(mta_domain_tree, &domains, &key); if (d == NULL) { d = xcalloc(1, sizeof(*d)); d->name = xstrdup(name); - d->flags = flags; + d->as_host = as_host; TAILQ_INIT(&d->mxs); SPLAY_INSERT(mta_domain_tree, &domains, d); stat_increment("mta.domain", 1); @@ -2190,9 +2189,9 @@ mta_domain_unref(struct mta_domain *d) static int mta_domain_cmp(const struct mta_domain *a, const struct mta_domain *b) { - if (a->flags < b->flags) + if (a->as_host < b->as_host) return (-1); - if (a->flags > b->flags) + if (a->as_host > b->as_host) return (1); return (strcasecmp(a->name, b->name)); } diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 4e03177a45b..baa224a0a80 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.560 2018/09/17 12:16:27 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.561 2018/09/19 05:31:12 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -90,7 +90,6 @@ #define RELAY_TLS_NO 3 #define RELAY_AUTH 0x08 -#define RELAY_MX 0x20 #define RELAY_LMTP 0x80 #define RELAY_TLS_VERIFY 0x200 @@ -627,7 +626,7 @@ struct mta_mx { struct mta_domain { SPLAY_ENTRY(mta_domain) entry; char *name; - int flags; + int as_host; TAILQ_HEAD(, mta_mx) mxs; int mxstatus; int refcount;