Changeset 3346 for pjproject/trunk
- Timestamp:
- Oct 14, 2010 10:56:02 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c
r3344 r3346 843 843 { 844 844 enum { MAX_SEARCH = 20 }; 845 pj_str_t hostname, alias = {NULL, 0} ;845 pj_str_t hostname, alias = {NULL, 0}, *resname; 846 846 unsigned bufstart = 0; 847 847 unsigned bufleft = sizeof(rec->buf_); … … 889 889 return PJLIB_UTIL_EDNSNOANSWERREC; 890 890 891 resname = &hostname; 892 891 893 /* Keep following CNAME records. */ 892 894 while (pkt->ans[ansidx].type == PJ_DNS_TYPE_CNAME && 893 895 search_cnt++ < MAX_SEARCH) 894 896 { 897 resname = &pkt->ans[ansidx].rdata.cname.name; 898 895 899 if (!alias.slen) 896 alias = pkt->ans[ansidx].rdata.cname.name; 897 898 for (i=ansidx+1; i < pkt->hdr.anscount; ++i) { 899 if (pj_stricmp(&pkt->ans[ansidx].rdata.cname.name, 900 &pkt->ans[i].name)==0) 901 { 900 alias = *resname; 901 902 for (i=0; i < pkt->hdr.anscount; ++i) { 903 if (pj_stricmp(resname, &pkt->ans[i].name)==0) { 902 904 break; 903 905 } … … 905 907 906 908 if (i==pkt->hdr.anscount) 907 return PJLIB_UTIL_EDNS INANSWER;909 return PJLIB_UTIL_EDNSNOANSWERREC; 908 910 909 911 ansidx = i; … … 929 931 } 930 932 931 /* Retrieve the IP address. */ 932 if (rec->addr_count < PJ_DNS_MAX_IP_IN_A_REC) { 933 rec->addr[rec->addr_count++].s_addr = 934 pkt->ans[i].rdata.a.ip_addr.s_addr; 933 /* Get the IP addresses. */ 934 for (i=0; i < pkt->hdr.anscount; ++i) { 935 if (pkt->ans[i].type == PJ_DNS_TYPE_A && 936 pj_stricmp(&pkt->ans[i].name, resname)==0 && 937 rec->addr_count < PJ_DNS_MAX_IP_IN_A_REC) 938 { 939 rec->addr[rec->addr_count++].s_addr = 940 pkt->ans[i].rdata.a.ip_addr.s_addr; 941 } 935 942 } 936 943
Note: See TracChangeset
for help on using the changeset viewer.