*** main/dns.c.ORIG 2011-06-02 09:56:09.000000000 +0300 --- main/dns.c 2011-06-02 09:56:30.000000000 +0300 *************** *** 183,188 **** --- 183,189 ---- dns_HEADER *h; int res; int x; + int lastres; h = (dns_HEADER *)answer; answer += sizeof(dns_HEADER); *************** *** 202,207 **** --- 203,209 ---- } for (x = 0; x < ntohs(h->ancount); x++) { + if ((res = skip_name(answer, len)) < 0) { ast_log(LOG_WARNING, "Failed skipping name\n"); return -1; *************** *** 226,238 **** ast_log(LOG_WARNING, "Failed to parse result\n"); return -1; } ! if (res > 0) ! return 1; } } answer += ntohs(ans->size); len -= ntohs(ans->size); } return 0; } --- 228,244 ---- ast_log(LOG_WARNING, "Failed to parse result\n"); return -1; } ! lastres=res; ! /* if (res > 0) what happens with multiple entries ya block? ! return 1; */ } } answer += ntohs(ans->size); len -= ntohs(ans->size); } + if ( (callback) && (lastres > 0 ) ) { /* you made it this far dude */ + return 1; + } return 0; }