summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-12-23 14:15:16 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2011-12-23 14:16:47 +0100
commit811e804c7a403783b0c4cc5eb75f24da809081d8 (patch)
treeebdbbe87f471ba4cd42d85398dd934400d9ffe49
parent3fb4bfcafbcaff3522e7bab48ff03460fec99023 (diff)
downloaduClibc-alpine-811e804c7a403783b0c4cc5eb75f24da809081d8.tar.bz2
uClibc-alpine-811e804c7a403783b0c4cc5eb75f24da809081d8.tar.xz
resolv: res_query for CNAMEs
From: http://lists.busybox.net/pipermail/uclibc/2009-June/042583.html I had postfix failing for domains with MX->CNAME->A chain. In glibc it works. I tracked it to be a problem in uclibc res_query. It returns bogus data for CNAME entries, apparently intentionally, which is wrong. glibc return CNAME entries even for CNAME queries and most applications rely on this. So we should do the same in uclibc. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
-rw-r--r--libc/inet/resolv.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 021d5bf5d..2371fb952 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -3099,11 +3099,9 @@ int res_query(const char *dname, int class, int type,
free(a.dotted);
- if (a.atype == type) { /* CNAME */
- if (i > anslen)
- i = anslen;
- memcpy(answer, packet, i);
- }
+ i = MIN(anslen, i);
+ memcpy(answer, packet, i);
+
free(packet);
return i;
}