Skip to content

Commit 3332218

Browse files
committed
resolv: Remove RES_INSECURE1, RES_INSECURE2
Always perform the associated security checks.
1 parent 3f8b44b commit 3332218

File tree

5 files changed

+25
-23
lines changed

5 files changed

+25
-23
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2019-04-08 Florian Weimer <[email protected]>
2+
3+
* resolv/resolv.h (RES_INSECURE1, RES_INSECURE2): Remove
4+
definitions.
5+
* resolv/res_send.c (send_dg): Always perform RES_INSECURE1 and
6+
RES_INSECURE2 security checks.
7+
* resolv/res_debug.c (p_option): Remove RES_INSECURE1 and
8+
RES_INSECURE2 handling.
9+
110
2019-04-08 Florian Weimer <[email protected]>
211

312
resolv: Remove support for RES_USE_INET6 and the inet6 option.

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Deprecated and removed features, and other changes affecting compatibility:
3838
* Support for the "inet6" option in /etc/resolv.conf and the RES_USE_INET6
3939
resolver flag (deprecated in glibc 2.25) have been removed.
4040

41+
* The obsolete RES_INSECURE1 and RES_INSECURE2 option flags for the DNS stub
42+
resolver have been removed from <resolv.h>.
43+
4144
Changes to build and runtime requirements:
4245

4346
* GCC 6.2 or later is required to build the GNU C Library.

resolv/res_debug.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,6 @@ p_option(u_long option) {
604604
case RES_DEFNAMES: return "defnam";
605605
case RES_STAYOPEN: return "styopn";
606606
case RES_DNSRCH: return "dnsrch";
607-
case RES_INSECURE1: return "insecure1";
608-
case RES_INSECURE2: return "insecure2";
609607
case RES_NOALIASES: return "noaliases";
610608
case RES_ROTATE: return "rotate";
611609
case RES_USE_EDNS0: return "edns0";

resolv/res_send.c

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,31 +1316,25 @@ send_dg(res_state statp,
13161316
*/
13171317
goto wait;
13181318
}
1319-
if (!(statp->options & RES_INSECURE1) &&
1320-
!res_ourserver_p(statp, &from)) {
1321-
/*
1322-
* response from wrong server? ignore it.
1323-
* XXX - potential security hazard could
1324-
* be detected here.
1325-
*/
1326-
goto wait;
1327-
}
1328-
if (!(statp->options & RES_INSECURE2)
1329-
&& (recvresp1 || !res_queriesmatch(buf, buf + buflen,
1319+
1320+
/* Paranoia check. Due to the connected UDP socket,
1321+
the kernel has already filtered invalid addresses
1322+
for us. */
1323+
if (!res_ourserver_p(statp, &from))
1324+
goto wait;
1325+
1326+
/* Check for the correct header layout and a matching
1327+
question. */
1328+
if ((recvresp1 || !res_queriesmatch(buf, buf + buflen,
13301329
*thisansp,
13311330
*thisansp
13321331
+ *thisanssizp))
13331332
&& (recvresp2 || !res_queriesmatch(buf2, buf2 + buflen2,
13341333
*thisansp,
13351334
*thisansp
1336-
+ *thisanssizp))) {
1337-
/*
1338-
* response contains wrong query? ignore it.
1339-
* XXX - potential security hazard could
1340-
* be detected here.
1341-
*/
1342-
goto wait;
1343-
}
1335+
+ *thisanssizp)))
1336+
goto wait;
1337+
13441338
if (anhp->rcode == SERVFAIL ||
13451339
anhp->rcode == NOTIMP ||
13461340
anhp->rcode == REFUSED) {

resolv/resolv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ struct res_sym {
115115
#define RES_DEFNAMES 0x00000080 /* use default domain name */
116116
#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
117117
#define RES_DNSRCH 0x00000200 /* search up local domain tree */
118-
#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
119-
#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
120118
#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
121119
#define RES_ROTATE 0x00004000 /* rotate ns list after each query */
122120
#define RES_NOCHECKNAME \

0 commit comments

Comments
 (0)