$NetBSD$

--- sendmail/deliver.c.orig	2020-06-03 07:48:46.000000000 +0200
+++ sendmail/deliver.c	2021-03-18 14:27:55.765646882 +0100
@@ -28,8 +28,12 @@
 # include "sfsasl.h"
 # include "tls.h"
 #endif
 
+#if NAMED_BIND
+extern struct __res_state sm_res;
+#endif
+
 static int	deliver __P((ENVELOPE *, ADDRESS *));
 static void	dup_queue_file __P((ENVELOPE *, ENVELOPE *, int));
 static void	mailfiletimeout __P((int));
 static void	endwaittimeout __P((int));
@@ -1908,9 +1912,9 @@
 		ctladdr = &e->e_from;
 
 #if NAMED_BIND
 	if (ConfigLevel < 2)
-		_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
+		sm_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
 #endif
 
 	if (tTd(11, 1))
 	{
@@ -3620,9 +3624,9 @@
 		}
 	}
 #if NAMED_BIND
 	if (ConfigLevel < 2)
-		_res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
+		sm_res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
 #endif
 
 	if (tTd(62, 1))
 		checkfds("after delivery");
@@ -6016,9 +6020,9 @@
 	int nmx;
 	int hl;
 	char *hp;
 	char *endp;
-	int oldoptions = _res.options;
+	int oldoptions = sm_res.options;
 	char *mxhosts[MAXMXHOSTS + 1];
 	unsigned short mxprefs[MAXMXHOSTS + 1];
 #endif /* NAMED_BIND */
 
@@ -6086,9 +6090,9 @@
 	*/
 
 #if NAMED_BIND
 	if (ConfigLevel < 2)
-		_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
+		sm_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
 
 	for (hp = host; hp != NULL; hp = endp)
 	{
 # if NETINET6
@@ -6219,9 +6223,9 @@
 		prevsep = sep;
 	}
 	makelower(s->s_hostsig.hs_sig);
 	if (ConfigLevel < 2)
-		_res.options = oldoptions;
+		sm_res.options = oldoptions;
 #else /* NAMED_BIND */
 	/* not using BIND -- the signature is just the host name */
 	/*
 	**  'host' points to storage that will be freed after we are
