]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Handle DNS server failures in case of AF_UNSPEC lookups correctly
authorUlrich Drepper <drepper@gmail.com>
Tue, 31 May 2011 02:48:47 +0000 (22:48 -0400)
committerUlrich Drepper <drepper@gmail.com>
Tue, 31 May 2011 02:48:47 +0000 (22:48 -0400)
ChangeLog
NEWS
resolv/res_send.c

index 31719ab503e78cabf4ccdc0e874c449618e1c6a6..dd4ad9ed1bdd4184a93200a7acb9438a8d0c1022 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-05-30  Ulrich Drepper  <drepper@gmail.com>
 
+       [BZ #12684]
+       * resolv/res_send.c (__libc_res_nsend): Only go to the next name server
+       if both request failed.
+       (send_dg): In case of server errors clear resplen or *resplen2.
+
        [BZ #12454]
        * elf/dl-deps.c (_dl_map_object_deps): Run initializer sorting only
        when there are multiple maps.
diff --git a/NEWS b/NEWS
index b3d8005c7c4766db461a1bec0ae9bf16ed23935d..1ca96738d5683da7b8f5ec1b658969008fbd791e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,9 +16,9 @@ Version 2.14
   12393, 12420, 12432, 12445, 12449, 12453, 12454, 12460, 12469, 12489,
   12509, 12510, 12511, 12518, 12527, 12541, 12545, 12551, 12582, 12583,
   12587, 12597, 12601, 12611, 12625, 12626, 12631, 12650, 12653, 12655,
-  12660, 12671, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12724,
-  12734, 12738, 12746, 12766, 12775, 12777, 12782, 12788, 12792, 12795,
-  12811, 12813, 12814
+  12660, 12671, 12681, 12684, 12685, 12711, 12713, 12714, 12717, 12723,
+  12724, 12734, 12738, 12746, 12766, 12775, 12777, 12782, 12788, 12792,
+  12795, 12811, 12813, 12814
 
 * The RPC implementation in libc is obsoleted.  Old programs keep working
   but new programs cannot be linked with the routines in libc anymore.
index 845b658e368a310b5faeb4cf323a9ec88d335164..97142b7dd05c231b62ac779e954d95f94f573504 100644 (file)
@@ -549,7 +549,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
                                    ns, ansp, ansp2, nansp2, resplen2);
                        if (n < 0)
                                return (-1);
-                       if (n == 0)
+                       if (n == 0 && (buf2 == NULL || resplen2 == 0))
                                goto next_ns;
                } else {
                        /* Use datagrams. */
@@ -559,7 +559,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
                                    ansp2, nansp2, resplen2);
                        if (n < 0)
                                return (-1);
-                       if (n == 0)
+                       if (n == 0 && (buf2 == NULL || resplen2 == 0))
                                goto next_ns;
                        if (v_circuit)
                          // XXX Check whether both requests failed or
@@ -1275,10 +1275,14 @@ send_dg(res_state statp,
                                (*thisresplenp > *thisanssizp)
                                ? *thisanssizp : *thisresplenp);
 
-                       if (recvresp1 || (buf2 != NULL && recvresp2))
+                       if (recvresp1 || (buf2 != NULL && recvresp2)) {
+                         *resplen2 = 0;
                          return resplen;
+                       }
                        if (buf2 != NULL)
                          {
+                           /* No data from the first reply.  */
+                           resplen = 0;
                            /* We are waiting for a possible second reply.  */
                            if (hp->id == anhp->id)
                              recvresp1 = 1;
@@ -1344,7 +1348,7 @@ send_dg(res_state statp,
                goto err_out;
        }
        else {
-               /* poll should not have returned > 0 in this case.  */
+               /* poll should not have returned > 0 in this case.  */
                abort ();
        }
 }