mirror of
https://abf.rosa.ru/djam/glibc.git
synced 2025-02-23 15:02:47 +00:00
Rediff patch
This commit is contained in:
parent
1b06f41956
commit
7b58e91d6f
1 changed files with 61 additions and 66 deletions
|
@ -1,8 +1,7 @@
|
|||
Index: b/resolv/nss_dns/dns-host.c
|
||||
===================================================================
|
||||
--- a/resolv/nss_dns/dns-host.c
|
||||
+++ b/resolv/nss_dns/dns-host.c
|
||||
@@ -1051,7 +1051,10 @@ gaih_getanswer_slice (const querybuf *an
|
||||
diff -Naur glibc-2.15-a316c1f.orig/resolv/nss_dns/dns-host.c glibc-2.15-a316c1f/resolv/nss_dns/dns-host.c
|
||||
--- glibc-2.15-a316c1f.orig/resolv/nss_dns/dns-host.c 2016-02-19 16:09:38.070805200 +0300
|
||||
+++ glibc-2.15-a316c1f/resolv/nss_dns/dns-host.c 2016-02-19 16:09:38.072805201 +0300
|
||||
@@ -1030,7 +1030,10 @@
|
||||
int h_namelen = 0;
|
||||
|
||||
if (ancount == 0)
|
||||
|
@ -14,7 +13,7 @@ Index: b/resolv/nss_dns/dns-host.c
|
|||
|
||||
while (ancount-- > 0 && cp < end_of_message && had_error == 0)
|
||||
{
|
||||
@@ -1228,7 +1231,14 @@ gaih_getanswer_slice (const querybuf *an
|
||||
@@ -1199,7 +1202,14 @@
|
||||
/* Special case here: if the resolver sent a result but it only
|
||||
contains a CNAME while we are looking for a T_A or T_AAAA record,
|
||||
we fail with NOTFOUND instead of TRYAGAIN. */
|
||||
|
@ -30,7 +29,7 @@ Index: b/resolv/nss_dns/dns-host.c
|
|||
}
|
||||
|
||||
|
||||
@@ -1242,11 +1252,101 @@ gaih_getanswer (const querybuf *answer1,
|
||||
@@ -1213,11 +1223,101 @@
|
||||
|
||||
enum nss_status status = NSS_STATUS_NOTFOUND;
|
||||
|
||||
|
@ -131,8 +130,8 @@ Index: b/resolv/nss_dns/dns-host.c
|
|||
+
|
||||
if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
|
||||
|| (status == NSS_STATUS_TRYAGAIN
|
||||
/* We want to look at the second answer in case of an
|
||||
@@ -1262,8 +1362,15 @@ gaih_getanswer (const querybuf *answer1,
|
||||
&& (errno != ERANGE || *h_errnop != NO_RECOVERY)))
|
||||
@@ -1227,8 +1327,15 @@
|
||||
&pat, &buffer, &buflen,
|
||||
errnop, h_errnop, ttlp,
|
||||
&first);
|
||||
|
@ -148,38 +147,36 @@ Index: b/resolv/nss_dns/dns-host.c
|
|||
}
|
||||
|
||||
return status;
|
||||
Index: b/resolv/res_query.c
|
||||
===================================================================
|
||||
--- a/resolv/res_query.c
|
||||
+++ b/resolv/res_query.c
|
||||
@@ -396,6 +396,7 @@ __libc_res_nsearch(res_state statp,
|
||||
diff -Naur glibc-2.15-a316c1f.orig/resolv/res_query.c glibc-2.15-a316c1f/resolv/res_query.c
|
||||
--- glibc-2.15-a316c1f.orig/resolv/res_query.c 2016-02-19 16:09:38.070805200 +0300
|
||||
+++ glibc-2.15-a316c1f/resolv/res_query.c 2016-02-19 16:10:13.893807618 +0300
|
||||
@@ -391,6 +391,7 @@
|
||||
{
|
||||
free (*answerp2);
|
||||
*answerp2 = NULL;
|
||||
+ *nanswerp2 = 0;
|
||||
*answerp2_malloced = 0;
|
||||
}
|
||||
}
|
||||
@@ -436,6 +437,7 @@ __libc_res_nsearch(res_state statp,
|
||||
|
||||
@@ -431,6 +432,7 @@
|
||||
{
|
||||
free (*answerp2);
|
||||
*answerp2 = NULL;
|
||||
+ *nanswerp2 = 0;
|
||||
*answerp2_malloced = 0;
|
||||
}
|
||||
|
||||
@@ -510,6 +512,7 @@ __libc_res_nsearch(res_state statp,
|
||||
/*
|
||||
@@ -502,6 +504,7 @@
|
||||
{
|
||||
free (*answerp2);
|
||||
*answerp2 = NULL;
|
||||
+ *nanswerp2 = 0;
|
||||
*answerp2_malloced = 0;
|
||||
}
|
||||
if (saved_herrno != -1)
|
||||
Index: b/resolv/res_send.c
|
||||
===================================================================
|
||||
--- a/resolv/res_send.c
|
||||
+++ b/resolv/res_send.c
|
||||
RES_SET_H_ERRNO(statp, saved_herrno);
|
||||
diff -Naur glibc-2.15-a316c1f.orig/resolv/res_send.c glibc-2.15-a316c1f/resolv/res_send.c
|
||||
--- glibc-2.15-a316c1f.orig/resolv/res_send.c 2016-02-19 16:09:38.069805200 +0300
|
||||
+++ glibc-2.15-a316c1f/resolv/res_send.c 2016-02-19 16:12:07.213815266 +0300
|
||||
@@ -1,3 +1,20 @@
|
||||
+/* Copyright (C) 2016 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
|
@ -201,7 +198,7 @@ Index: b/resolv/res_send.c
|
|||
/*
|
||||
* Copyright (c) 1985, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@@ -360,6 +377,8 @@ __libc_res_nsend(res_state statp, const
|
||||
@@ -360,6 +377,8 @@
|
||||
#ifdef USE_HOOKS
|
||||
if (__builtin_expect (statp->qhook || statp->rhook, 0)) {
|
||||
if (anssiz < MAXPACKET && ansp) {
|
||||
|
@ -210,7 +207,7 @@ Index: b/resolv/res_send.c
|
|||
u_char *buf = malloc (MAXPACKET);
|
||||
if (buf == NULL)
|
||||
return (-1);
|
||||
@@ -653,6 +672,77 @@ libresolv_hidden_def (res_nsend)
|
||||
@@ -652,6 +671,77 @@
|
||||
|
||||
/* Private */
|
||||
|
||||
|
@ -288,7 +285,7 @@ Index: b/resolv/res_send.c
|
|||
static int
|
||||
send_vc(res_state statp,
|
||||
const u_char *buf, int buflen, const u_char *buf2, int buflen2,
|
||||
@@ -662,11 +752,7 @@ send_vc(res_state statp,
|
||||
@@ -661,11 +751,7 @@
|
||||
{
|
||||
const HEADER *hp = (HEADER *) buf;
|
||||
const HEADER *hp2 = (HEADER *) buf2;
|
||||
|
@ -301,7 +298,7 @@ Index: b/resolv/res_send.c
|
|||
struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
|
||||
int truncating, connreset, resplen, n;
|
||||
struct iovec iov[4];
|
||||
@@ -742,6 +828,8 @@ send_vc(res_state statp,
|
||||
@@ -741,6 +827,8 @@
|
||||
* Receive length & response
|
||||
*/
|
||||
int recvresp1 = 0;
|
||||
|
@ -310,7 +307,7 @@ Index: b/resolv/res_send.c
|
|||
int recvresp2 = buf2 == NULL;
|
||||
uint16_t rlen16;
|
||||
read_len:
|
||||
@@ -778,33 +866,14 @@ send_vc(res_state statp,
|
||||
@@ -777,33 +865,14 @@
|
||||
u_char **thisansp;
|
||||
int *thisresplenp;
|
||||
if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
|
||||
|
@ -347,7 +344,7 @@ Index: b/resolv/res_send.c
|
|||
thisanssizp = anssizp2;
|
||||
thisansp = ansp2;
|
||||
thisresplenp = resplen2;
|
||||
@@ -812,10 +881,14 @@ send_vc(res_state statp,
|
||||
@@ -811,10 +880,14 @@
|
||||
anhp = (HEADER *) *thisansp;
|
||||
|
||||
*thisresplenp = rlen;
|
||||
|
@ -366,9 +363,9 @@ Index: b/resolv/res_send.c
|
|||
u_char *newp = malloc (MAXPACKET);
|
||||
if (newp == NULL) {
|
||||
*terrno = ENOMEM;
|
||||
@@ -827,6 +900,9 @@ send_vc(res_state statp,
|
||||
if (thisansp == ansp2)
|
||||
*ansp2_malloced = 1;
|
||||
@@ -824,6 +897,9 @@
|
||||
*thisanssizp = MAXPACKET;
|
||||
*thisansp = newp;
|
||||
anhp = (HEADER *) newp;
|
||||
+ /* A uint16_t can't be larger than MAXPACKET
|
||||
+ thus it's safe to allocate MAXPACKET but
|
||||
|
@ -376,7 +373,7 @@ Index: b/resolv/res_send.c
|
|||
len = rlen;
|
||||
} else {
|
||||
Dprint(statp->options & RES_DEBUG,
|
||||
@@ -990,6 +1066,66 @@ reopen (res_state statp, int *terrno, in
|
||||
@@ -987,6 +1063,66 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -443,7 +440,7 @@ Index: b/resolv/res_send.c
|
|||
static int
|
||||
send_dg(res_state statp,
|
||||
const u_char *buf, int buflen, const u_char *buf2, int buflen2,
|
||||
@@ -999,8 +1135,6 @@ send_dg(res_state statp,
|
||||
@@ -996,8 +1132,6 @@
|
||||
{
|
||||
const HEADER *hp = (HEADER *) buf;
|
||||
const HEADER *hp2 = (HEADER *) buf2;
|
||||
|
@ -452,7 +449,7 @@ Index: b/resolv/res_send.c
|
|||
struct timespec now, timeout, finish;
|
||||
struct pollfd pfd[1];
|
||||
int ptimeout;
|
||||
@@ -1033,6 +1167,8 @@ send_dg(res_state statp,
|
||||
@@ -1029,6 +1163,8 @@
|
||||
int need_recompute = 0;
|
||||
int nwritten = 0;
|
||||
int recvresp1 = 0;
|
||||
|
@ -461,13 +458,13 @@ Index: b/resolv/res_send.c
|
|||
int recvresp2 = buf2 == NULL;
|
||||
pfd[0].fd = EXT(statp).nssocks[ns];
|
||||
pfd[0].events = POLLOUT;
|
||||
@@ -1196,52 +1332,54 @@ send_dg(res_state statp,
|
||||
@@ -1125,50 +1261,52 @@
|
||||
int *thisresplenp;
|
||||
|
||||
if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
|
||||
+ /* We have not received any responses
|
||||
+ yet or we only have one response to
|
||||
+ receive. */
|
||||
+ /* We have not received any responses
|
||||
+ yet or we only have one response to
|
||||
+ receive. */
|
||||
thisanssizp = anssizp;
|
||||
thisansp = anscp ?: ansp;
|
||||
assert (anscp != NULL || ansp2 == NULL);
|
||||
|
@ -504,42 +501,40 @@ Index: b/resolv/res_send.c
|
|||
- /* Yes, we test ANSCP here. If we have two buffers
|
||||
- both will be allocatable. */
|
||||
- && anscp
|
||||
+ /* If the current buffer is non-NULL and it's not
|
||||
+ pointing at the static user-supplied buffer then
|
||||
+ we can reallocate it. */
|
||||
+ && (thisansp != NULL && thisansp != ansp)
|
||||
+ /* Is the size too small? */
|
||||
+ /* If the current buffer is non-NULL and it's not
|
||||
+ pointing at the static user-supplied buffer then
|
||||
+ we can reallocate it. */
|
||||
+ && (thisansp != NULL && thisansp != ansp)
|
||||
+ /* Is the size too small? */
|
||||
&& (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0
|
||||
- || *thisanssizp < *thisresplenp)) {
|
||||
+ || *thisanssizp < *thisresplenp)
|
||||
+ ) {
|
||||
+ /* Always allocate MAXPACKET, callers expect
|
||||
+ this specific size. */
|
||||
+ ) {
|
||||
+ /* Always allocate MAXPACKET, callers expect
|
||||
+ this specific size. */
|
||||
u_char *newp = malloc (MAXPACKET);
|
||||
if (newp != NULL) {
|
||||
- *anssizp = MAXPACKET;
|
||||
- *thisansp = ans = newp;
|
||||
+ *thisanssizp = MAXPACKET;
|
||||
+ *thisansp = newp;
|
||||
if (thisansp == ansp2)
|
||||
*ansp2_malloced = 1;
|
||||
+ *thisanssizp = MAXPACKET;
|
||||
+ *thisansp = newp;
|
||||
}
|
||||
}
|
||||
+ /* We could end up with truncation if anscp was NULL
|
||||
+ (not allowed to change caller's buffer) and the
|
||||
+ response buffer size is too small. This isn't a
|
||||
+ reliable way to detect truncation because the ioctl
|
||||
+ may be an inaccurate report of the UDP message size.
|
||||
+ Therefore we use this only to issue debug output.
|
||||
+ To do truncation accurately with UDP we need
|
||||
+ MSG_TRUNC which is only available on Linux. We
|
||||
+ can abstract out the Linux-specific feature in the
|
||||
+ future to detect truncation. */
|
||||
+ if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
|
||||
+ Dprint(statp->options & RES_DEBUG,
|
||||
+ (stdout, ";; response may be truncated (UDP)\n")
|
||||
+ );
|
||||
+ }
|
||||
+ /* We could end up with truncation if anscp was NULL
|
||||
+ (not allowed to change caller's buffer) and the
|
||||
+ response buffer size is too small. This isn't a
|
||||
+ reliable way to detect truncation because the ioctl
|
||||
+ may be an inaccurate report of the UDP message size.
|
||||
+ Therefore we use this only to issue debug output.
|
||||
+ To do truncation accurately with UDP we need
|
||||
+ MSG_TRUNC which is only available on Linux. We
|
||||
+ can abstract out the Linux-specific feature in the
|
||||
+ future to detect truncation. */
|
||||
+ if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
|
||||
+ Dprint(statp->options & RES_DEBUG,
|
||||
+ (stdout, ";; response may be truncated (UDP)\n")
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
HEADER *anhp = (HEADER *) *thisansp;
|
||||
socklen_t fromlen = sizeof(struct sockaddr_in6);
|
||||
|
|
Loading…
Add table
Reference in a new issue