php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch dns_check_record_patch_light for *Network Functions Bug #78008Patch version 2019-05-13 16:13 UTC Return to Bug #78008 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: a.suharevs@dyninno.lvdiff --git a/ext/standard/dns.c b/ext/standard/dns.c index 3f34ba67ee..f112e46ae1 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -352,7 +352,7 @@ PHP_FUNCTION(dns_check_record) #ifndef MAXPACKET #define MAXPACKET 8192 /* max packet size used internally by BIND */ #endif - u_char ans[MAXPACKET]; + querybuf answer; char *hostname, *rectype = NULL; size_t hostname_len, rectype_len = 0; int type = DNS_T_MX, i; @@ -411,12 +411,24 @@ PHP_FUNCTION(dns_check_record) #endif RETVAL_TRUE; - i = php_dns_search(handle, hostname, C_IN, type, ans, sizeof(ans)); + i = php_dns_search(handle, hostname, C_IN, type, answer.qb2, sizeof answer); if (i < 0) { RETVAL_FALSE; } +#if defined(HAVE_RES_SEARCH) + HEADER *hp; + int an; + + hp = (HEADER *)&answer; + an = ntohs(hp->ancount); + + if (an == 0) { + RETVAL_FALSE; + } +#endif + php_dns_free_handle(handle); } /* }}} */ |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Thu Nov 21 12:01:29 2024 UTC |