Upstream: gresolv: Do not update successful status with unsuccessful one
authorJaehyun Kim <jeik01.kim@samsung.com>
Sat, 6 Apr 2013 13:24:51 +0000 (22:24 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Sat, 6 Apr 2013 13:26:53 +0000 (22:26 +0900)
When performing a resolver lookup from timeserver or wpad, both perform
queries with an unspecified address family. This means that both A and
AAAA record queries are issued. In cases where a valid, successful A
response comes back but where the AAAA query results in a timeout, do
not smash the successful A status with the time out AAAA status;
otherwise, the timeserver or wpad will appear to fail to them when, in
fact, the A query was successful and more than satisfies its unspecified
address family requirement.

Partial fix for BMC#25486.

Change-Id: I9fae2d185a81bb5a91e8221207d087749f15009f

gweb/gresolv.c

index e3623cc..816a465 100644 (file)
@@ -486,10 +486,16 @@ static void sort_and_return_results(struct resolv_lookup *lookup)
 
        results[n++] = NULL;
 
-       status = lookup->ipv4_status;
-
-       if (status == G_RESOLV_RESULT_STATUS_SUCCESS)
+       if (lookup->resolv->result_family == AF_INET)
+               status = lookup->ipv4_status;
+       else if (lookup->resolv->result_family == AF_INET6)
                status = lookup->ipv6_status;
+       else {
+               if (lookup->ipv6_status == G_RESOLV_RESULT_STATUS_SUCCESS)
+                       status = lookup->ipv6_status;
+               else
+                       status = lookup->ipv4_status;
+       }
 
        g_queue_remove(lookup->resolv->lookup_queue, lookup);