head 1.1; access; symbols pkgsrc-2026Q1:1.1.0.18 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.16 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.14 pkgsrc-2025Q3-base:1.1 pkgsrc-2025Q2:1.1.0.12 pkgsrc-2025Q2-base:1.1 pkgsrc-2025Q1:1.1.0.10 pkgsrc-2025Q1-base:1.1 pkgsrc-2024Q4:1.1.0.8 pkgsrc-2024Q4-base:1.1 pkgsrc-2024Q3:1.1.0.6 pkgsrc-2024Q3-base:1.1 pkgsrc-2024Q2:1.1.0.4 pkgsrc-2024Q2-base:1.1 pkgsrc-2024Q1:1.1.0.2 pkgsrc-2024Q1-base:1.1; locks; strict; comment @# @; 1.1 date 2024.01.15.04.50.56; author jnemeth; state Exp; branches; next ; commitid Nv1wagQpcgwUbvUE; desc @@ 1.1 log @mail/sendmail-snapshot: import sendmail-8.18.0.2 Sendmail acts as a unified "post office" to which all mail can be submitted. Address interpretation is controlled by a production system, which can parse both domain-based addressing and old-style "ad hoc" addresses. The production system is powerful enough to rewrite addresses in the message header to conform to the standards of a number of common target networks, including old (NCP/RFC733) Arpanet, new (TCP/RFC822) Arpanet, UUCP, and Phonenet. Sendmail also implements an SMTP server, message queueing, and aliasing. This package is for snapshot (alpha/beta) releases, which aren't considered to be release/production quality. It may be used to test new features. Some features / bug fixes may be backported to the regular sendmail package. @ text @$NetBSD$ --- sendmail/domain.c.orig 2023-07-24 18:49:57.000000000 +0000 +++ sendmail/domain.c @@@@ -23,6 +23,7 @@@@ SM_RCSID("@@(#)$Id: domain.c,v 8.205 2013 #include #if NAMED_BIND +extern struct __res_state sm_res; # include # include "sm_resolve.h" # if DANE @@@@ -51,7 +52,7 @@@@ static char MXHostBuf[MXHOSTBUFSIZE]; # endif # ifndef RES_DNSRCH_VARIABLE -# define RES_DNSRCH_VARIABLE _res.dnsrch +# define RES_DNSRCH_VARIABLE sm_res.dnsrch # endif # ifndef HFIXEDSZ @@@@ -909,9 +910,9 @@@@ getmxrr(host, mxhosts, mxprefs, flags, r # if DANE cname2mx = false; qname[0] = '\0'; - old_options = _res.options; + old_options = sm_res.options; if (ad) - _res.options |= SM_RES_DNSSEC; + sm_res.options |= SM_RES_DNSSEC; # endif if ((fallbackMX != NULL && (flags & DROPLOCALHOST) != 0 && @@@@ -1072,7 +1073,7 @@@@ getmxrr(host, mxhosts, mxprefs, flags, r # endif if (type != T_MX) { - if ((tTd(8, 8) || _res.options & RES_DEBUG) + if ((tTd(8, 8) || sm_res.options & RES_DEBUG) # if DANE && type != T_RRSIG # endif @@@@ -1410,13 +1411,13 @@@@ punt: } done: # if DANE - _res.options = old_options; + sm_res.options = old_options; # endif return nmx; error: # if DANE - _res.options = old_options; + sm_res.options = old_options; # endif return -1; } @@@@ -1486,7 +1487,7 @@@@ bestmx_map_lookup(map, name, av, statp) int *statp; { int nmx; - int saveopts = _res.options; + int saveopts = sm_res.options; int i; ssize_t len = 0; char *result; @@@@ -1498,9 +1499,9 @@@@ bestmx_map_lookup(map, name, av, statp) char buf[PSBUFSIZE / 2]; # endif - _res.options &= ~(RES_DNSRCH|RES_DEFNAMES); + sm_res.options &= ~(RES_DNSRCH|RES_DEFNAMES); nmx = getmxrr(name, mxhosts, NULL, 0, statp, NULL, -1, NULL); - _res.options = saveopts; + sm_res.options = saveopts; if (nmx <= 0) return NULL; if (bitset(MF_MATCHONLY, map->map_mflags)) @@@@ -1650,16 +1651,22 @@@@ dns_getcanonname(host, hbsize, trymx, st if (tTd(8, 2)) sm_dprintf("dns_getcanonname(%s, trymx=%d)\n", host, trymx); - if ((_res.options & RES_INIT) == 0 && res_init() == -1) - { - *statp = EX_UNAVAILABLE; - return HOST_NOTFOUND; + if ((sm_res.options & RES_INIT) == 0) { +# if NAMED_RESN + memset(&sm_res, 0, sizeof(sm_res)); + if (res_ninit(&sm_res) == -1) { +# else + if (res_init() == -1) { +# endif + *statp = EX_UNAVAILABLE; + return false; + } } # if DANE - old_options = _res.options; + old_options = sm_res.options; if (DANE_SECURE == Dane) - _res.options |= SM_RES_DNSSEC; + sm_res.options |= SM_RES_DNSSEC; # endif *statp = EX_OK; @@@@ -1709,7 +1716,7 @@@@ cnameloop: searchlist[sli++] = NameSearchList; } # endif - if (n >= 0 && *--cp != '.' && bitset(RES_DNSRCH, _res.options)) + if (n >= 0 && *--cp != '.' && bitset(RES_DNSRCH, sm_res.options)) { /* make sure there are less than MAXDNSRCH domains */ for (domain = RES_DNSRCH_VARIABLE, ret = 0; @@@@ -1717,10 +1724,10 @@@@ cnameloop: ret++) searchlist[sli++] = *domain++; } - else if (n == 0 && bitset(RES_DEFNAMES, _res.options)) + else if (n == 0 && bitset(RES_DEFNAMES, sm_res.options)) { SM_ASSERT(sli < SLSIZE); - searchlist[sli++] = _res.defdname; + searchlist[sli++] = sm_res.defdname; } else if (*cp == '.') { @@@@ -2026,13 +2033,13 @@@@ nexttype: if (ttl > 0 && pttl != NULL) *pttl = ttl; # if DANE - _res.options = old_options; + sm_res.options = old_options; # endif return ad ? HOST_SECURE : HOST_OK; error: # if DANE - _res.options = old_options; + sm_res.options = old_options; # endif return HOST_NOTFOUND; } @