[PHP-CVS] cvs: php-src /ext/standard dns.c
kalle Wed May 20 08:16:56 2009 UTC Modified files: /php-src/ext/standard dns.c Log: Fix Windows build, dns_get_record is defined in dns_win32.c, not here http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.107r2=1.108diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.107 php-src/ext/standard/dns.c:1.108 --- php-src/ext/standard/dns.c:1.107Tue May 19 11:12:01 2009 +++ php-src/ext/standard/dns.c Wed May 20 08:16:56 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.107 2009/05/19 11:12:01 jani Exp $ */ +/* $Id: dns.c,v 1.108 2009/05/20 08:16:56 kalle Exp $ */ /* {{{ includes */ #include php.h @@ -278,7 +278,7 @@ #define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) #endif /* HAVE_DNS_FUNCS || defined(PHP_WIN32) */ -#if defined(PHP_WIN32) || (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) +#if !defined(PHP_WIN32) || (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) /* {{{ proto bool dns_check_record(string host [, string type]) U Check DNS records corresponding to a given Internet host name or IP address */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
janiWed May 20 12:15:36 2009 UTC Modified files: /php-src/ext/standard dns.c Log: - Fix non-windows builds too http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.108r2=1.109diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.108 php-src/ext/standard/dns.c:1.109 --- php-src/ext/standard/dns.c:1.108Wed May 20 08:16:56 2009 +++ php-src/ext/standard/dns.c Wed May 20 12:15:36 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.108 2009/05/20 08:16:56 kalle Exp $ */ +/* $Id: dns.c,v 1.109 2009/05/20 12:15:36 jani Exp $ */ /* {{{ includes */ #include php.h @@ -278,7 +278,8 @@ #define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) #endif /* HAVE_DNS_FUNCS || defined(PHP_WIN32) */ -#if !defined(PHP_WIN32) || (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) +/* Note: These functions are defined in ext/standard/dns_win32.c for Windows! */ +#if !defined(PHP_WIN32) (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) /* {{{ proto bool dns_check_record(string host [, string type]) U Check DNS records corresponding to a given Internet host name or IP address */ @@ -916,7 +917,7 @@ } /* }}} */ #endif /* HAVE_DN_SKIPNAME HAVE_DN_EXPAND */ -#endif /* defined(PHP_WIN32) || (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) */ +#endif /* !defined(PHP_WIN32) (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) */ #if HAVE_DNS_FUNCS || defined(PHP_WIN32) PHP_MINIT_FUNCTION(dns) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
janiTue May 19 11:12:01 2009 UTC Modified files: /php-src/ext/standard dns.c Log: - Unify the macros http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.106r2=1.107diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.106 php-src/ext/standard/dns.c:1.107 --- php-src/ext/standard/dns.c:1.106Tue Mar 10 23:39:39 2009 +++ php-src/ext/standard/dns.c Tue May 19 11:12:01 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.106 2009/03/10 23:39:39 helly Exp $ */ +/* $Id: dns.c,v 1.107 2009/05/19 11:12:01 jani Exp $ */ /* {{{ includes */ #include php.h @@ -278,7 +278,7 @@ #define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) #endif /* HAVE_DNS_FUNCS || defined(PHP_WIN32) */ -#if HAVE_RES_SEARCH !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE)) +#if defined(PHP_WIN32) || (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) /* {{{ proto bool dns_check_record(string host [, string type]) U Check DNS records corresponding to a given Internet host name or IP address */ @@ -916,8 +916,7 @@ } /* }}} */ #endif /* HAVE_DN_SKIPNAME HAVE_DN_EXPAND */ -#endif /* HAVE_RES_SEARCH !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE)) */ - +#endif /* defined(PHP_WIN32) || (HAVE_RES_SEARCH !(defined(__BEOS__) || defined(NETWARE))) */ #if HAVE_DNS_FUNCS || defined(PHP_WIN32) PHP_MINIT_FUNCTION(dns) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c dns_win32.c
felipe Mon Jan 12 14:53:03 2009 UTC Modified files: /php-src/ext/standard dns.c dns_win32.c Log: - Reverted my previous commit to avoid unnecessary BC. [DOC] Added new entry to the array returned by dns_get_record(), 'entries', which contains the separated value from TXT value. (so 'txt' kept the concatenated version) (Pierre) - Unicode++ (Felipe) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.104r2=1.105diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.104 php-src/ext/standard/dns.c:1.105 --- php-src/ext/standard/dns.c:1.104Sun Jan 11 23:47:52 2009 +++ php-src/ext/standard/dns.c Mon Jan 12 14:53:03 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.104 2009/01/11 23:47:52 scottmac Exp $ */ +/* $Id: dns.c,v 1.105 2009/01/12 14:53:03 felipe Exp $ */ /* {{{ includes */ #include php.h @@ -457,28 +457,26 @@ break; case DNS_T_TXT: { - zval *txtarray = NULL; int ll = 0; - char *txt = NULL; + zval *entries = NULL; add_ascii_assoc_rt_string(*subarray, type, TXT, ZSTR_DUPLICATE); tp = emalloc(dlen + 1); - - MAKE_STD_ZVAL(txtarray); - array_init(txtarray); + + MAKE_STD_ZVAL(entries); + array_init(entries); while (ll dlen) { - txt = tp + ll; n = cp[ll]; - memcpy(txt, cp + ll + 1, n); + memcpy(tp + ll, cp + ll + 1, n); + add_next_index_rt_stringl(entries, cp + ll + 1, n, ZSTR_DUPLICATE); ll = ll + n + 1; - tp[ll] = '\0'; - add_next_index_rt_stringl(txtarray, txt, n, ZSTR_DUPLICATE); } + tp[dlen] = '\0'; cp += dlen; - - add_rt_assoc_zval(*subarray, txt, txtarray); - efree(tp); + + add_ascii_assoc_rt_stringl(*subarray, txt, tp, dlen - 1, ZSTR_AUTOFREE); + add_ascii_assoc_zval(*subarray, entries, entries); } break; case DNS_T_SOA: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns_win32.c?r1=1.5r2=1.6diff_format=u Index: php-src/ext/standard/dns_win32.c diff -u php-src/ext/standard/dns_win32.c:1.5 php-src/ext/standard/dns_win32.c:1.6 --- php-src/ext/standard/dns_win32.c:1.5Sun Jan 11 18:38:00 2009 +++ php-src/ext/standard/dns_win32.cMon Jan 12 14:53:03 2009 @@ -153,38 +153,38 @@ ALLOC_INIT_ZVAL(*subarray); array_init(*subarray); - add_assoc_rt_string(*subarray, host, pRec-pName, ZSTR_DUPLICATE); + add_ascii_assoc_rt_string(*subarray, host, pRec-pName, ZSTR_DUPLICATE); switch (type) { case DNS_TYPE_A: { IN_ADDR ipaddr; ipaddr.S_un.S_addr = (pRec-Data.A.IpAddress); - add_assoc_rt_string(*subarray, type, A, ZSTR_DUPLICATE); - add_assoc_rt_string(*subarray, ip, inet_ntoa(ipaddr), ZSTR_DUPLICATE); + add_ascii_assoc_rt_string(*subarray, type, A, ZSTR_DUPLICATE); + add_ascii_assoc_rt_string(*subarray, ip, inet_ntoa(ipaddr), ZSTR_DUPLICATE); break; } case DNS_TYPE_MX: - add_assoc_rt_string(*subarray, type, MX, ZSTR_DUPLICATE); - add_assoc_long(*subarray, pri, pRec-Data.Srv.wPriority); + add_ascii_assoc_rt_string(*subarray, type, MX, ZSTR_DUPLICATE); + add_ascii_assoc_long(*subarray, pri, pRec-Data.Srv.wPriority); /* no break; */ case DNS_TYPE_CNAME: if (type == DNS_TYPE_CNAME) { - add_assoc_rt_string(*subarray, type, CNAME, ZSTR_DUPLICATE); + add_ascii_assoc_rt_string(*subarray, type, CNAME, ZSTR_DUPLICATE); } /* no break; */ case DNS_TYPE_NS: if (type == DNS_TYPE_NS) { -
[PHP-CVS] cvs: php-src /ext/standard dns.c dns_win32.c
felipe Sun Jan 11 18:38:00 2009 UTC Modified files: /php-src/ext/standard dns.c dns_win32.c Log: - Improved fix for #47035 (win32 part by Henrique M. Decaria) [DOC] The TXT part needs be returned as an array of strings. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.102r2=1.103diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.102 php-src/ext/standard/dns.c:1.103 --- php-src/ext/standard/dns.c:1.102Thu Jan 8 17:19:08 2009 +++ php-src/ext/standard/dns.c Sun Jan 11 18:38:00 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.102 2009/01/08 17:19:08 felipe Exp $ */ +/* $Id: dns.c,v 1.103 2009/01/11 18:38:00 felipe Exp $ */ /* {{{ includes */ #include php.h @@ -409,16 +409,16 @@ ALLOC_INIT_ZVAL(*subarray); array_init(*subarray); - add_ascii_assoc_string(*subarray, host, name, 1); + add_ascii_assoc_rt_string(*subarray, host, name, ZSTR_DUPLICATE); switch (type) { case DNS_T_A: - add_ascii_assoc_string(*subarray, type, A, 1); + add_ascii_assoc_rt_string(*subarray, type, A, ZSTR_DUPLICATE); snprintf(name, sizeof(name), %d.%d.%d.%d, cp[0], cp[1], cp[2], cp[3]); add_ascii_assoc_rt_string(*subarray, ip, name, ZSTR_DUPLICATE); cp += dlen; break; case DNS_T_MX: - add_ascii_assoc_string(*subarray, type, MX, ZSTR_DUPLICATE); + add_ascii_assoc_rt_string(*subarray, type, MX, ZSTR_DUPLICATE); GETSHORT(n, cp); add_ascii_assoc_long(*subarray, pri, n); /* no break; */ @@ -457,20 +457,28 @@ break; case DNS_T_TXT: { + zval *txtarray = NULL; int ll = 0; + char *txt = NULL; add_ascii_assoc_rt_string(*subarray, type, TXT, ZSTR_DUPLICATE); tp = emalloc(dlen + 1); + MAKE_STD_ZVAL(txtarray); + array_init(txtarray); + while (ll dlen) { + txt = tp + ll; n = cp[ll]; - memcpy(tp + ll , cp + ll + 1, n); + memcpy(txt, cp + ll + 1, n); ll = ll + n + 1; + tp[ll] = '\0'; + add_next_index_rt_stringl(txtarray, txt, n, ZSTR_DUPLICATE); } - tp[dlen] = '\0'; cp += dlen; - add_ascii_assoc_rt_stringl(*subarray, txt, tp, dlen - 1, ZSTR_AUTOFREE); + add_rt_assoc_zval(*subarray, txt, txtarray); + efree(tp); } break; case DNS_T_SOA: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns_win32.c?r1=1.4r2=1.5diff_format=u Index: php-src/ext/standard/dns_win32.c diff -u php-src/ext/standard/dns_win32.c:1.4 php-src/ext/standard/dns_win32.c:1.5 --- php-src/ext/standard/dns_win32.c:1.4Wed Jan 7 12:59:17 2009 +++ php-src/ext/standard/dns_win32.cSun Jan 11 18:38:00 2009 @@ -75,7 +75,7 @@ continue; } - add_next_index_string(mx_list, pRec-Data.MX.pNameExchange, 1); + add_next_index_rt_string(mx_list, pRec-Data.MX.pNameExchange, ZSTR_DUPLICATE); if (weight_list) { add_next_index_long(weight_list, srv-wPriority); } @@ -134,7 +134,7 @@ #if 1 /* {{{ php_parserr */ -static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, zval **subarray) +static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, zval **subarray TSRMLS_DC) { int type; u_long ttl; @@ -153,38 +153,38 @@ ALLOC_INIT_ZVAL(*subarray); array_init(*subarray); - add_assoc_string(*subarray, host, pRec-pName, 1); + add_assoc_rt_string(*subarray, host, pRec-pName, ZSTR_DUPLICATE); switch (type) { case DNS_TYPE_A: { IN_ADDR ipaddr; ipaddr.S_un.S_addr = (pRec-Data.A.IpAddress); - add_assoc_string(*subarray, type, A, 1); - add_assoc_string(*subarray, ip, inet_ntoa(ipaddr), 1); +
[PHP-CVS] cvs: php-src /ext/standard dns.c
felipe Thu Jan 8 17:19:08 2009 UTC Modified files: /php-src/ext/standard dns.c Log: - Fixed bug #47035 (dns_get_record returns a garbage byte at the end of a TXT record) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.101r2=1.102diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.101 php-src/ext/standard/dns.c:1.102 --- php-src/ext/standard/dns.c:1.101Tue Jan 6 23:51:03 2009 +++ php-src/ext/standard/dns.c Thu Jan 8 17:19:08 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.101 2009/01/06 23:51:03 pajoye Exp $ */ +/* $Id: dns.c,v 1.102 2009/01/08 17:19:08 felipe Exp $ */ /* {{{ includes */ #include php.h @@ -470,7 +470,7 @@ tp[dlen] = '\0'; cp += dlen; - add_ascii_assoc_rt_stringl(*subarray, txt, tp, dlen, ZSTR_AUTOFREE); + add_ascii_assoc_rt_stringl(*subarray, txt, tp, dlen - 1, ZSTR_AUTOFREE); } break; case DNS_T_SOA: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
pajoye Tue Jan 6 22:00:23 2009 UTC Modified files: /php-src/ext/standard dns.c Log: - MFB: fix build http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.99r2=1.100diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.99 php-src/ext/standard/dns.c:1.100 --- php-src/ext/standard/dns.c:1.99 Tue Jan 6 20:44:56 2009 +++ php-src/ext/standard/dns.c Tue Jan 6 22:00:23 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.99 2009/01/06 20:44:56 pajoye Exp $ */ +/* $Id: dns.c,v 1.100 2009/01/06 22:00:23 pajoye Exp $ */ /* {{{ includes */ #include php.h @@ -310,6 +310,24 @@ RETURN_TRUE; } /* }}} */ +#if HAVE_DNS_FUNCS || defined(PHP_WIN32) +#define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ + +#define PHP_DNS_A 0x0001 +#define PHP_DNS_NS 0x0002 +#define PHP_DNS_CNAME 0x0010 +#define PHP_DNS_SOA0x0020 +#define PHP_DNS_PTR0x0800 +#define PHP_DNS_HINFO 0x1000 +#define PHP_DNS_MX 0x4000 +#define PHP_DNS_TXT0x8000 +#define PHP_DNS_A6 0x0100 +#define PHP_DNS_SRV0x0200 +#define PHP_DNS_NAPTR 0x0400 +#define PHP_DNS_ 0x0800 +#define PHP_DNS_ANY0x1000 +#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) +#endif /* HAVE_DNS_FUNCS || defined(PHP_WIN32) */ #if HAVE_DNS_FUNCS @@ -890,23 +908,6 @@ #if HAVE_DNS_FUNCS || defined(PHP_WIN32) -#define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ - -#define PHP_DNS_A 0x0001 -#define PHP_DNS_NS 0x0002 -#define PHP_DNS_CNAME 0x0010 -#define PHP_DNS_SOA0x0020 -#define PHP_DNS_PTR0x0800 -#define PHP_DNS_HINFO 0x1000 -#define PHP_DNS_MX 0x4000 -#define PHP_DNS_TXT0x8000 -#define PHP_DNS_A6 0x0100 -#define PHP_DNS_SRV0x0200 -#define PHP_DNS_NAPTR 0x0400 -#define PHP_DNS_ 0x0800 -#define PHP_DNS_ANY0x1000 -#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) - PHP_MINIT_FUNCTION(dns) { REGISTER_LONG_CONSTANT(DNS_A, PHP_DNS_A, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(DNS_NS,PHP_DNS_NS,CONST_CS | CONST_PERSISTENT); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
pajoye Tue Jan 6 23:51:03 2009 UTC Modified files: /php-src/ext/standard dns.c Log: - MFB: fix build for win http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.100r2=1.101diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.100 php-src/ext/standard/dns.c:1.101 --- php-src/ext/standard/dns.c:1.100Tue Jan 6 22:00:23 2009 +++ php-src/ext/standard/dns.c Tue Jan 6 23:51:03 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.100 2009/01/06 22:00:23 pajoye Exp $ */ +/* $Id: dns.c,v 1.101 2009/01/06 23:51:03 pajoye Exp $ */ /* {{{ includes */ #include php.h @@ -259,6 +259,25 @@ } /* }}} */ +#if HAVE_DNS_FUNCS || defined(PHP_WIN32) +#define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ + +#define PHP_DNS_A 0x0001 +#define PHP_DNS_NS 0x0002 +#define PHP_DNS_CNAME 0x0010 +#define PHP_DNS_SOA0x0020 +#define PHP_DNS_PTR0x0800 +#define PHP_DNS_HINFO 0x1000 +#define PHP_DNS_MX 0x4000 +#define PHP_DNS_TXT0x8000 +#define PHP_DNS_A6 0x0100 +#define PHP_DNS_SRV0x0200 +#define PHP_DNS_NAPTR 0x0400 +#define PHP_DNS_ 0x0800 +#define PHP_DNS_ANY0x1000 +#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) +#endif /* HAVE_DNS_FUNCS || defined(PHP_WIN32) */ + #if HAVE_RES_SEARCH !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE)) /* {{{ proto bool dns_check_record(string host [, string type]) U @@ -310,24 +329,6 @@ RETURN_TRUE; } /* }}} */ -#if HAVE_DNS_FUNCS || defined(PHP_WIN32) -#define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ - -#define PHP_DNS_A 0x0001 -#define PHP_DNS_NS 0x0002 -#define PHP_DNS_CNAME 0x0010 -#define PHP_DNS_SOA0x0020 -#define PHP_DNS_PTR0x0800 -#define PHP_DNS_HINFO 0x1000 -#define PHP_DNS_MX 0x4000 -#define PHP_DNS_TXT0x8000 -#define PHP_DNS_A6 0x0100 -#define PHP_DNS_SRV0x0200 -#define PHP_DNS_NAPTR 0x0400 -#define PHP_DNS_ 0x0800 -#define PHP_DNS_ANY0x1000 -#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) -#endif /* HAVE_DNS_FUNCS || defined(PHP_WIN32) */ #if HAVE_DNS_FUNCS -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
tony2001Wed Dec 31 15:48:06 2008 UTC Modified files: /php-src/ext/standard dns.c Log: don't use WRONG_PARAM_COUNT with new param parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.97r2=1.98diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.97 php-src/ext/standard/dns.c:1.98 --- php-src/ext/standard/dns.c:1.97 Wed Dec 31 14:33:41 2008 +++ php-src/ext/standard/dns.c Wed Dec 31 15:48:06 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.97 2008/12/31 14:33:41 iliaa Exp $ */ +/* $Id: dns.c,v 1.98 2008/12/31 15:48:06 tony2001 Exp $ */ /* {{{ includes */ #include php.h @@ -115,7 +115,7 @@ char buf[4096]; if (zend_parse_parameters_none() == FAILURE) { - WRONG_PARAM_COUNT; + return; } if (gethostname(buf, sizeof(buf) - 1)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
felipe Mon Nov 3 11:33:32 2008 UTC Modified files: /php-src/ext/standard dns.c Log: - Fixed bug #42855 (dns_get_record() doesn't return all text from TXT record) patch by: misc at e2007 dot cynergi dot com http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.94r2=1.95diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.94 php-src/ext/standard/dns.c:1.95 --- php-src/ext/standard/dns.c:1.94 Thu Aug 21 23:37:40 2008 +++ php-src/ext/standard/dns.c Mon Nov 3 11:33:32 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.94 2008/08/21 23:37:40 pajoye Exp $ */ +/* $Id: dns.c,v 1.95 2008/11/03 11:33:32 felipe Exp $ */ /* {{{ includes */ #include php.h @@ -446,13 +446,22 @@ cp += n; break; case DNS_T_TXT: - add_ascii_assoc_rt_string(*subarray, type, TXT, ZSTR_DUPLICATE); - n = cp[0]; - tp = emalloc(n + 1); - memcpy(tp, cp + 1, n); - tp[n] = '\0'; - cp += dlen; - add_ascii_assoc_rt_stringl(*subarray, txt, (char*)tp, n, ZSTR_AUTOFREE); + { + int ll = 0; + + add_ascii_assoc_rt_string(*subarray, type, TXT, ZSTR_DUPLICATE); + tp = emalloc(dlen + 1); + + while (ll dlen) { + n = cp[ll]; + memcpy(tp + ll , cp + ll + 1, n); + ll = ll + n + 1; + } + tp[dlen] = '\0'; + cp += dlen; + + add_ascii_assoc_rt_stringl(*subarray, txt, tp, dlen, ZSTR_AUTOFREE); + } break; case DNS_T_SOA: add_ascii_assoc_rt_string(*subarray, type, SOA, ZSTR_DUPLICATE); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
mattwil Fri May 23 09:40:19 2008 UTC Modified files: /php-src/ext/standard dns.c Log: Fixed Windows build now that HAVE_INET_PTON is defined http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.92r2=1.93diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.92 php-src/ext/standard/dns.c:1.93 --- php-src/ext/standard/dns.c:1.92 Mon Apr 14 16:49:30 2008 +++ php-src/ext/standard/dns.c Fri May 23 09:40:19 2008 @@ -18,10 +18,11 @@ +--+ */ -/* $Id: dns.c,v 1.92 2008/04/14 16:49:30 colder Exp $ */ +/* $Id: dns.c,v 1.93 2008/05/23 09:40:19 mattwil Exp $ */ /* {{{ includes */ #include php.h +#include php_network.h #if HAVE_SYS_SOCKET_H #include sys/socket.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
colder Mon Apr 14 16:49:30 2008 UTC Modified files: /php-src/ext/standard dns.c Log: Fix dns_check_proto (related to #44723) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.91r2=1.92diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.91 php-src/ext/standard/dns.c:1.92 --- php-src/ext/standard/dns.c:1.91 Thu Jan 17 14:12:36 2008 +++ php-src/ext/standard/dns.c Mon Apr 14 16:49:30 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.91 2008/01/17 14:12:36 iliaa Exp $ */ +/* $Id: dns.c,v 1.92 2008/04/14 16:49:30 colder Exp $ */ /* {{{ includes */ #include php.h @@ -247,7 +247,7 @@ #if HAVE_RES_SEARCH !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE)) -/* {{{ proto int dns_check_record(string host [, string type]) U +/* {{{ proto bool dns_check_record(string host [, string type]) U Check DNS records corresponding to a given Internet host name or IP address */ PHP_FUNCTION(dns_check_record) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
iliaa Thu Jan 17 14:12:36 2008 UTC Modified files: /php-src/ext/standard dns.c Log: MFB: Fixed bug #43871 (crash inside dns_get_record) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.90r2=1.91diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.90 php-src/ext/standard/dns.c:1.91 --- php-src/ext/standard/dns.c:1.90 Mon Dec 31 07:12:15 2007 +++ php-src/ext/standard/dns.c Thu Jan 17 14:12:36 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.90 2007/12/31 07:12:15 sebastian Exp $ */ +/* $Id: dns.c,v 1.91 2008/01/17 14:12:36 iliaa Exp $ */ /* {{{ includes */ #include php.h @@ -654,7 +654,7 @@ char *hostname; int hostname_len; long type_param = PHP_DNS_ANY; - zval *authns, *addtl; + zval *authns = NULL, *addtl = NULL; int addtl_recs = 0; int type_to_fetch; struct __res_state res; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c /ext/standard/tests/network getmxrr.phpt
derick Thu Nov 22 10:18:30 2007 UTC Added files: /php-src/ext/standard/tests/network getmxrr.phpt Modified files: /php-src/ext/standard dns.c Log: - Fixed weights array, which was broken with: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.80r2=1.81 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.88r2=1.89diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.88 php-src/ext/standard/dns.c:1.89 --- php-src/ext/standard/dns.c:1.88 Mon Nov 5 13:42:16 2007 +++ php-src/ext/standard/dns.c Thu Nov 22 10:18:30 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.88 2007/11/05 13:42:16 jani Exp $ */ +/* $Id: dns.c,v 1.89 2007/11/22 10:18:30 derick Exp $ */ /* {{{ includes */ #include php.h @@ -836,7 +836,6 @@ char *hostname; int hostname_len; zval *mx_list, *weight_list = NULL; - int need_weight = 0; int count, qdc; u_short type, weight; u_char ans[MAXPACKET]; @@ -891,7 +890,7 @@ } cp += i; add_next_index_rt_string(mx_list, buf, ZSTR_DUPLICATE); - if (need_weight) { + if (weight_list) { add_next_index_long(weight_list, weight); } } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/network/getmxrr.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/network/getmxrr.phpt +++ php-src/ext/standard/tests/network/getmxrr.phpt --TEST-- dns_check_record() segfault with empty host --FILE-- ?php $domains = array( 'php.net', 'ez.no' ); foreach ( $domains as $domain ) { if ( getmxrr( $domain, $hosts, $weights ) ) { echo Hosts: . count( $hosts ) . , weights: . count( $weights ) . \n; } } ? --EXPECT-- Hosts: 2, weights: 2 Hosts: 1, weights: 1 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
janiMon Nov 5 13:40:36 2007 UTC Modified files: /php-src/ext/standard dns.c Log: ws http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.86r2=1.87diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.86 php-src/ext/standard/dns.c:1.87 --- php-src/ext/standard/dns.c:1.86 Tue Jun 26 11:03:42 2007 +++ php-src/ext/standard/dns.c Mon Nov 5 13:40:36 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.86 2007/06/26 11:03:42 tony2001 Exp $ */ +/* $Id: dns.c,v 1.87 2007/11/05 13:40:36 jani Exp $ */ /* {{{ includes */ #include php.h @@ -33,7 +33,7 @@ #define WINNT 1 #endif /* located in www.php.net/extra/bindlib.zip */ -#if HAVE_ARPA_INET_H +#if HAVE_ARPA_INET_H #include arpa/inet.h #endif #include netdb.h @@ -125,12 +125,12 @@ { char *addr; int addr_len; - char *hostname; + char *hostname; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, addr, addr_len) == FAILURE) { return; } - + hostname = php_gethostbyaddr(addr); if (hostname == NULL) { @@ -258,13 +258,12 @@ char *hostname, *rectype = NULL; int hostname_len, rectype_len = 0; int type = T_MX, i; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|s, hostname, hostname_len, rectype, rectype_len) == FAILURE) { return; } - if (hostname_len == 0) - { + if (hostname_len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Host cannot be empty); RETURN_FALSE; } @@ -272,7 +271,7 @@ if (rectype) { if (!strcasecmp(A, rectype)) type = T_A; else if (!strcasecmp(NS,rectype)) type = DNS_T_NS; - else if (!strcasecmp(MX,rectype)) type = DNS_T_MX; + else if (!strcasecmp(MX,rectype)) type = DNS_T_MX; else if (!strcasecmp(PTR, rectype)) type = DNS_T_PTR; else if (!strcasecmp(ANY, rectype)) type = DNS_T_ANY; else if (!strcasecmp(SOA, rectype)) type = DNS_T_SOA; @@ -312,7 +311,7 @@ #define PHP_DNS_TXT0x8000 #define PHP_DNS_A6 0x0100 #define PHP_DNS_SRV0x0200 -#define PHP_DNS_NAPTR 0x0400 +#define PHP_DNS_NAPTR 0x0400 #define PHP_DNS_ 0x0800 #define PHP_DNS_ANY0x1000 #define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) @@ -355,10 +354,10 @@ u_char qb2[65536]; } querybuf; -/* just a hack to free resources allocated by glibc in __res_nsend() - * See also: - * res_thread_freeres() in glibc/resolv/res_init.c - * __libc_res_nsend() in resolv/res_send.c +/* just a hack to free resources allocated by glibc in __res_nsend() + * See also: + * res_thread_freeres() in glibc/resolv/res_init.c + * __libc_res_nsend() in resolv/res_send.c * */ #ifdef __GLIBC__ @@ -394,7 +393,7 @@ return NULL; } cp += n; - + GETSHORT(type, cp); GETSHORT(class, cp); GETLONG(ttl, cp); @@ -524,7 +523,7 @@ tp[0] = '\0'; add_ascii_assoc_rt_string(*subarray, type, , ZSTR_DUPLICATE); add_ascii_assoc_rt_string(*subarray, ipv6, name, ZSTR_DUPLICATE); - break; + break; case DNS_T_A6: p = cp; add_ascii_assoc_rt_string(*subarray, type, A6, ZSTR_DUPLICATE); @@ -562,7 +561,7 @@ } cp++; } - for(i = (n+8)/16; i 8; i++) { + for (i = (n + 8) / 16; i 8; i++) { GETSHORT(s, cp); if (s != 0) { if (tp (u_char *)name) { @@ -692,32 +691,34 @@ * NUMTYPES+1 when results were already fetched. * - In case of PHP_DNS_ANY we use the directly fetch DNS_T_ANY. (step NUMTYPES+1 ) */ - for(type = (type_param==PHP_DNS_ANY ? (PHP_DNS_NUM_TYPES + 1) : 0); type (addtl_recs ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query; type++) - { + for (type = (type_param == PHP_DNS_ANY ? (PHP_DNS_NUM_TYPES + 1) : 0); + type (addtl_recs ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query; + type++ + ) { first_query = 0; switch (type) { - case 0: + case 0: type_to_fetch = type_paramPHP_DNS_A
[PHP-CVS] cvs: php-src /ext/standard dns.c
janiMon Nov 5 13:42:16 2007 UTC Modified files: /php-src/ext/standard dns.c Log: nuke compile warning http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.87r2=1.88diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.87 php-src/ext/standard/dns.c:1.88 --- php-src/ext/standard/dns.c:1.87 Mon Nov 5 13:40:36 2007 +++ php-src/ext/standard/dns.c Mon Nov 5 13:42:16 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.87 2007/11/05 13:40:36 jani Exp $ */ +/* $Id: dns.c,v 1.88 2007/11/05 13:42:16 jani Exp $ */ /* {{{ includes */ #include php.h @@ -678,7 +678,7 @@ } if (type_param ~PHP_DNS_ALL type_param != PHP_DNS_ANY) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Type '%d' not supported, type_param); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Type '%ld' not supported, type_param); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
tony2001Tue Jun 26 11:03:42 2007 UTC Modified files: /php-src/ext/standard dns.c Log: fix #41795 (checkdnsrr does not support DNS_TXT type) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.85r2=1.86diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.85 php-src/ext/standard/dns.c:1.86 --- php-src/ext/standard/dns.c:1.85 Mon May 14 14:38:29 2007 +++ php-src/ext/standard/dns.c Tue Jun 26 11:03:42 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.85 2007/05/14 14:38:29 scottmac Exp $ */ +/* $Id: dns.c,v 1.86 2007/06/26 11:03:42 tony2001 Exp $ */ /* {{{ includes */ #include php.h @@ -276,6 +276,7 @@ else if (!strcasecmp(PTR, rectype)) type = DNS_T_PTR; else if (!strcasecmp(ANY, rectype)) type = DNS_T_ANY; else if (!strcasecmp(SOA, rectype)) type = DNS_T_SOA; + else if (!strcasecmp(TXT, rectype)) type = DNS_T_TXT; else if (!strcasecmp(CNAME, rectype)) type = DNS_T_CNAME; else if (!strcasecmp(, rectype)) type = DNS_T_; else if (!strcasecmp(SRV, rectype)) type = DNS_T_SRV; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c /ext/standard/tests/network bug41347.phpt
scottmacMon May 14 14:38:29 2007 UTC Modified files: /php-src/ext/standard dns.c /php-src/ext/standard/tests/network bug41347.phpt Log: MFB: Fixed bug #41347 (checkdnsrr() segfaults on empty hostname). http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.84r2=1.85diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.84 php-src/ext/standard/dns.c:1.85 --- php-src/ext/standard/dns.c:1.84 Sat Feb 24 16:25:55 2007 +++ php-src/ext/standard/dns.c Mon May 14 14:38:29 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.84 2007/02/24 16:25:55 helly Exp $ */ +/* $Id: dns.c,v 1.85 2007/05/14 14:38:29 scottmac Exp $ */ /* {{{ includes */ #include php.h @@ -263,6 +263,12 @@ return; } + if (hostname_len == 0) + { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Host cannot be empty); + RETURN_FALSE; + } + if (rectype) { if (!strcasecmp(A, rectype)) type = T_A; else if (!strcasecmp(NS,rectype)) type = DNS_T_NS; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/network/bug41347.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/standard/tests/network/bug41347.phpt diff -u /dev/null php-src/ext/standard/tests/network/bug41347.phpt:1.2 --- /dev/null Mon May 14 14:38:29 2007 +++ php-src/ext/standard/tests/network/bug41347.phptMon May 14 14:38:29 2007 @@ -0,0 +1,15 @@ +--TEST-- +dns_check_record() segfault with empty host +--SKIPIF-- +?php +if (substr(PHP_OS, 0, 3) == 'WIN') { +die('No windows support'); +} +? +--FILE-- +?php +var_dump(dns_check_record('')); +? +--EXPECTF-- +Warning: dns_check_record(): Host cannot be empty in %s on line %d +bool(false) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c math.c
dmitry Mon Sep 25 06:59:02 2006 UTC Modified files: /php-src/ext/standard dns.c math.c Log: ZTS fix http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.81r2=1.82diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.81 php-src/ext/standard/dns.c:1.82 --- php-src/ext/standard/dns.c:1.81 Mon Sep 25 02:27:24 2006 +++ php-src/ext/standard/dns.c Mon Sep 25 06:59:02 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.81 2006/09/25 02:27:24 pollita Exp $ */ +/* $Id: dns.c,v 1.82 2006/09/25 06:59:02 dmitry Exp $ */ /* {{{ includes */ #include php.h @@ -370,7 +370,7 @@ #endif /* {{{ php_parserr */ -static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray) +static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray TSRMLS_DC) { u_short type, class, dlen; u_long ttl; @@ -781,7 +781,7 @@ while (an-- cp cp end) { zval *retval; - cp = php_parserr(cp, answer, type_to_fetch, store_results, retval); + cp = php_parserr(cp, answer, type_to_fetch, store_results, retval TSRMLS_CC); if (retval != NULL store_results) { add_next_index_zval(return_value, retval); } @@ -798,7 +798,7 @@ while (ns-- 0 cp cp end) { zval *retval = NULL; - cp = php_parserr(cp, answer, DNS_T_ANY, authns != NULL, retval); + cp = php_parserr(cp, answer, DNS_T_ANY, authns != NULL, retval TSRMLS_CC); if (retval != NULL) { add_next_index_zval(authns, retval); } @@ -810,7 +810,7 @@ while (ar-- 0 cp cp end) { zval *retval = NULL; - cp = php_parserr(cp, answer, DNS_T_ANY, 1, retval); + cp = php_parserr(cp, answer, DNS_T_ANY, 1, retval TSRMLS_CC); if (retval != NULL) { add_next_index_zval(addtl, retval); } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.137r2=1.138diff_format=u Index: php-src/ext/standard/math.c diff -u php-src/ext/standard/math.c:1.137 php-src/ext/standard/math.c:1.138 --- php-src/ext/standard/math.c:1.137 Sun Sep 24 17:59:40 2006 +++ php-src/ext/standard/math.c Mon Sep 25 06:59:02 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: math.c,v 1.137 2006/09/24 17:59:40 pollita Exp $ */ +/* $Id: math.c,v 1.138 2006/09/25 06:59:02 dmitry Exp $ */ #include php.h #include php_math.h @@ -59,7 +59,7 @@ return; } - convert_scalar_to_number(value); + convert_scalar_to_number(value TSRMLS_CC); if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(fabs(Z_DVAL_P(value))); @@ -84,7 +84,7 @@ return; } - convert_scalar_to_number(value); + convert_scalar_to_number(value TSRMLS_CC); if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(ceil(Z_DVAL_P(value))); @@ -106,7 +106,7 @@ return; } - convert_scalar_to_number(value); + convert_scalar_to_number(value TSRMLS_CC); if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(floor(Z_DVAL_P(value))); @@ -130,7 +130,7 @@ return; } - convert_scalar_to_number(value); + convert_scalar_to_number(value TSRMLS_CC); switch (Z_TYPE_P(value)) { case IS_LONG: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
pollita Mon Sep 25 02:27:24 2006 UTC Modified files: /php-src/ext/standard dns.c Log: PHP6 Updates and some very minor feature add in dns_get_record() http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.80r2=1.81diff_format=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.80 php-src/ext/standard/dns.c:1.81 --- php-src/ext/standard/dns.c:1.80 Tue Sep 19 10:38:31 2006 +++ php-src/ext/standard/dns.c Mon Sep 25 02:27:24 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.80 2006/09/19 10:38:31 dmitry Exp $ */ +/* $Id: dns.c,v 1.81 2006/09/25 02:27:24 pollita Exp $ */ /* {{{ includes */ #include php.h @@ -119,22 +119,21 @@ static char *php_gethostbyaddr(char *ip); static char *php_gethostbyname(char *name); -/* {{{ proto string gethostbyaddr(string ip_address) +/* {{{ proto string gethostbyaddr(string ip_address) U Get the Internet host name corresponding to a given IP address */ PHP_FUNCTION(gethostbyaddr) { - zval **arg; - char *addr; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); - } + char *addr; + int addr_len; + char *hostname; - convert_to_string_ex(arg); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, addr, addr_len) == FAILURE) { + return; + } - addr = php_gethostbyaddr(Z_STRVAL_PP(arg)); + hostname = php_gethostbyaddr(addr); - if (addr == NULL) { + if (hostname == NULL) { #if HAVE_IPV6 HAVE_INET_PTON php_error_docref(NULL TSRMLS_CC, E_WARNING, Address is not a valid IPv4 or IPv6 address); #else @@ -142,10 +141,7 @@ #endif RETVAL_FALSE; } else { - RETVAL_RT_STRING(addr, 0); - if (UG(unicode)) { - efree(addr); - } + RETVAL_RT_STRING(hostname, ZSTR_AUTOFREE); } } /* }}} */ @@ -185,42 +181,39 @@ } /* }}} */ -/* {{{ proto string gethostbyname(string hostname) +/* {{{ proto string gethostbyname(string hostname) U Get the IP address corresponding to a given Internet host name */ PHP_FUNCTION(gethostbyname) { - zval **arg; - char *tmp; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + char *hostname; + int hostname_len; + char *addr; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, hostname, hostname_len) == FAILURE) { + return; } - convert_to_string_ex(arg); + addr = php_gethostbyname(hostname); - tmp = php_gethostbyname(Z_STRVAL_PP(arg)); - RETVAL_RT_STRING(tmp, 0); - if (UG(unicode)) { - efree(tmp); - } + RETVAL_RT_STRING(addr, ZSTR_AUTOFREE); } /* }}} */ -/* {{{ proto array gethostbynamel(string hostname) +/* {{{ proto array gethostbynamel(string hostname) U Return a list of IP addresses that a given hostname resolves to. */ PHP_FUNCTION(gethostbynamel) { - zval **arg; + char *hostname; + int hostname_len; struct hostent *hp; struct in_addr in; int i; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, hostname, hostname_len) == FAILURE) { + return; } - convert_to_string_ex(arg); - hp = gethostbyname(Z_STRVAL_PP(arg)); + hp = gethostbyname(hostname); if (hp == NULL || hp-h_addr_list == NULL) { RETURN_FALSE; } @@ -229,7 +222,7 @@ for (i = 0 ; hp-h_addr_list[i] != 0 ; i++) { in = *(struct in_addr *) hp-h_addr_list[i]; - add_next_index_rt_string(return_value, inet_ntoa(in), 1); + add_next_index_rt_string(return_value, inet_ntoa(in), ZSTR_DUPLICATE); } } /* }}} */ @@ -254,55 +247,41 @@ #if HAVE_RES_SEARCH !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE)) -/* {{{ proto int dns_check_record(string host [, string type]) +/* {{{ proto int dns_check_record(string host [, string type]) U Check DNS records corresponding to a given Internet host name or IP address */ PHP_FUNCTION(dns_check_record) { - zval **arg1, **arg2; - int type, i; #ifndef MAXPACKET #define MAXPACKET 8192 /* max packet size used internally by BIND */ #endif u_char ans[MAXPACKET]; + char *hostname, *rectype = NULL; + int hostname_len, rectype_len = 0; + int type = T_MX, i; - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1, arg1) == FAILURE) { -
[PHP-CVS] cvs: php-src /ext/standard dns.c
sniper Mon Dec 5 17:16:44 2005 EDT Modified files: /php-src/ext/standard dns.c Log: - Nuke php3 legacy http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.76r2=1.77ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.76 php-src/ext/standard/dns.c:1.77 --- php-src/ext/standard/dns.c:1.76 Tue Oct 25 10:56:48 2005 +++ php-src/ext/standard/dns.c Mon Dec 5 17:16:42 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.76 2005/10/25 14:56:48 tony2001 Exp $ */ +/* $Id: dns.c,v 1.77 2005/12/05 22:16:42 sniper Exp $ */ /* {{{ includes */ #include php.h @@ -663,7 +663,7 @@ Get any Resource Record corresponding to a given Internet host name */ PHP_FUNCTION(dns_get_record) { - pval *addtl, *host, *authns, *fetch_type; + zval *addtl, *host, *authns, *fetch_type; int addtl_recs = 0; int type_to_fetch, type_param = PHP_DNS_ANY; struct __res_state res; @@ -692,10 +692,10 @@ } convert_to_long(fetch_type); type_param = Z_LVAL_P(fetch_type); - pval_destructor(authns); + zval_dtor(authns); addtl_recs = 1; /* We want the additional Records */ array_init(authns); - pval_destructor(addtl); + zval_dtor(addtl); array_init(addtl); break; default: @@ -853,7 +853,7 @@ Get MX records corresponding to a given Internet host name */ PHP_FUNCTION(dns_get_mx) { - pval *host, *mx_list, *weight_list; + zval *host, *mx_list, *weight_list; int need_weight = 0; int count, qdc; u_short type, weight; @@ -875,7 +875,7 @@ WRONG_PARAM_COUNT; } need_weight = 1; - pval_destructor(weight_list); /* start with clean array */ + zval_dtor(weight_list); /* start with clean array */ array_init(weight_list); break; @@ -884,7 +884,7 @@ } convert_to_string(host); - pval_destructor(mx_list); /* start with clean array */ + zval_dtor(mx_list); /* start with clean array */ array_init(mx_list); /* Go! */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
tony2001Tue Oct 25 04:19:12 2005 EDT Modified files: /php-src/ext/standard dns.c Log: fix problem with garbage appearing in hostnames http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.74r2=1.75ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.74 php-src/ext/standard/dns.c:1.75 --- php-src/ext/standard/dns.c:1.74 Sun Oct 23 14:31:36 2005 +++ php-src/ext/standard/dns.c Tue Oct 25 04:19:11 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.74 2005/10/23 18:31:36 tony2001 Exp $ */ +/* $Id: dns.c,v 1.75 2005/10/25 08:19:11 tony2001 Exp $ */ /* {{{ includes */ #include php.h @@ -387,7 +387,7 @@ /* {{{ php_parserr */ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray) { - u_short type, dlen; + u_short type, class, dlen; u_long ttl; long n, i; u_short s; @@ -404,6 +404,7 @@ cp += n; GETSHORT(type, cp); + GETSHORT(class, cp); GETLONG(ttl, cp); GETSHORT(dlen, cp); if (type_to_fetch != T_ANY type != type_to_fetch) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
iliaa Sun Oct 23 11:29:38 2005 EDT Modified files: /php-src/ext/standard dns.c Log: MFB51: Fixed memory leak on error. http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.72r2=1.73ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.72 php-src/ext/standard/dns.c:1.73 --- php-src/ext/standard/dns.c:1.72 Fri Oct 21 09:48:07 2005 +++ php-src/ext/standard/dns.c Sun Oct 23 11:29:38 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.72 2005/10/21 13:48:07 tony2001 Exp $ */ +/* $Id: dns.c,v 1.73 2005/10/23 15:29:38 iliaa Exp $ */ /* {{{ includes */ #include php.h @@ -358,7 +358,7 @@ #endif /* QFIXEDSZ */ #ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 +#define MAXHOSTNAMELEN 1024 #endif /* MAXHOSTNAMELEN */ #ifndef MAXRESOURCERECORDS @@ -755,12 +755,14 @@ if (n0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, res_nmkquery() failed); zval_dtor(return_value); + res_nclose(res); RETURN_FALSE; } n = res_nsend(res, buf.qb2, n, answer.qb2, sizeof answer); if (n0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, res_nsend() failed); zval_dtor(return_value); + res_nclose(res); RETURN_FALSE; } @@ -778,6 +780,7 @@ if (n 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to parse DNS data received); zval_dtor(return_value); + res_nclose(res); RETURN_FALSE; } cp += n + QFIXEDSZ; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
tony2001Sun Oct 23 14:31:40 2005 EDT Modified files: /php-src/ext/standard dns.c Log: fix #34938 (dns_get_record() doesn't resolve long hostnames and leaks) http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.73r2=1.74ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.73 php-src/ext/standard/dns.c:1.74 --- php-src/ext/standard/dns.c:1.73 Sun Oct 23 11:29:38 2005 +++ php-src/ext/standard/dns.c Sun Oct 23 14:31:36 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.73 2005/10/23 15:29:38 iliaa Exp $ */ +/* $Id: dns.c,v 1.74 2005/10/23 18:31:36 tony2001 Exp $ */ /* {{{ includes */ #include php.h @@ -357,9 +357,8 @@ #define QFIXEDSZ4 /* fixed data in query arpa/nameser.h */ #endif /* QFIXEDSZ */ -#ifndef MAXHOSTNAMELEN +#undef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 1024 -#endif /* MAXHOSTNAMELEN */ #ifndef MAXRESOURCERECORDS #define MAXRESOURCERECORDS 64 @@ -370,10 +369,25 @@ u_char qb2[65536]; } querybuf; +/* just a hack to free resources allocated by glibc in __res_nsend() + * See also: + * res_thread_freeres() in glibc/resolv/res_init.c + * __libc_res_nsend() in resolv/res_send.c + * */ +static void _php_dns_free_res(struct __res_state res) { /* {{{ */ + int ns; + for (ns = 0; ns MAXNS; ns++) { + if (res._u._ext.nsaddrs[ns] != NULL) { + free (res._u._ext.nsaddrs[ns]); + res._u._ext.nsaddrs[ns] = NULL; + } + } +} /* }}} */ + /* {{{ php_parserr */ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray) { - u_short type, class, dlen; + u_short type, dlen; u_long ttl; long n, i; u_short s; @@ -383,14 +397,13 @@ *subarray = NULL; - n = dn_expand(answer-qb2, answer-qb2+65536, cp, name, (sizeof(name)) - 2); + n = dn_expand(answer-qb2, answer-qb2+65536, cp, name, sizeof(name) - 2); if (n 0) { return NULL; } cp += n; GETSHORT(type, cp); - GETSHORT(class, cp); GETLONG(ttl, cp); GETSHORT(dlen, cp); if (type_to_fetch != T_ANY type != type_to_fetch) { @@ -650,7 +663,7 @@ HEADER *hp; querybuf buf, answer; u_char *cp = NULL, *end = NULL; - long n, qd, an, ns = 0, ar = 0; + int n, qd, an, ns = 0, ar = 0; int type, first_query = 1, store_results = 1; switch (ZEND_NUM_ARGS()) { @@ -747,6 +760,7 @@ break; } if (type_to_fetch) { + memset(res, 0, sizeof(res)); res_ninit(res); res.retrans = 5; res.options = ~RES_DEFNAMES; @@ -756,6 +770,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, res_nmkquery() failed); zval_dtor(return_value); res_nclose(res); + _php_dns_free_res(res); RETURN_FALSE; } n = res_nsend(res, buf.qb2, n, answer.qb2, sizeof answer); @@ -763,6 +778,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, res_nsend() failed); zval_dtor(return_value); res_nclose(res); + _php_dns_free_res(res); RETURN_FALSE; } @@ -781,6 +797,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to parse DNS data received); zval_dtor(return_value); res_nclose(res); + _php_dns_free_res(res); RETURN_FALSE; } cp += n + QFIXEDSZ; @@ -796,6 +813,7 @@ } } res_nclose(res); + _php_dns_free_res(res); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
tony2001Fri Oct 21 09:48:11 2005 EDT Modified files: /php-src/ext/standard dns.c Log: fix possible crash in dns_get_record() cleanup code a bit (partly fixes #34938) http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.71r2=1.72ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.71 php-src/ext/standard/dns.c:1.72 --- php-src/ext/standard/dns.c:1.71 Tue Aug 23 08:53:22 2005 +++ php-src/ext/standard/dns.c Fri Oct 21 09:48:07 2005 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.71 2005/08/23 12:53:22 dmitry Exp $ */ +/* $Id: dns.c,v 1.72 2005/10/21 13:48:07 tony2001 Exp $ */ /* {{{ includes */ #include php.h @@ -381,6 +381,8 @@ char name[MAXHOSTNAMELEN]; int have_v6_break = 0, in_v6_break = 0; + *subarray = NULL; + n = dn_expand(answer-qb2, answer-qb2+65536, cp, name, (sizeof(name)) - 2); if (n 0) { return NULL; @@ -392,13 +394,11 @@ GETLONG(ttl, cp); GETSHORT(dlen, cp); if (type_to_fetch != T_ANY type != type_to_fetch) { - *subarray = NULL; cp += dlen; return cp; } if (!store) { - *subarray = NULL; cp += dlen; return cp; } @@ -648,7 +648,7 @@ int type_to_fetch, type_param = PHP_DNS_ANY; struct __res_state res; HEADER *hp; - querybuf buf, answer, *ans; + querybuf buf, answer; u_char *cp = NULL, *end = NULL; long n, qd, an, ns = 0, ar = 0; int type, first_query = 1, store_results = 1; @@ -663,12 +663,14 @@ if (zend_get_parameters(ht, 2, host, fetch_type) == FAILURE) { WRONG_PARAM_COUNT; } + convert_to_long(fetch_type); type_param = Z_LVAL_P(fetch_type); break; case 4: if (zend_get_parameters(ht, 4, host, fetch_type, authns, addtl) == FAILURE) { WRONG_PARAM_COUNT; } + convert_to_long(fetch_type); type_param = Z_LVAL_P(fetch_type); pval_destructor(authns); addtl_recs = 1; /* We want the additional Records */ @@ -764,13 +766,12 @@ cp = answer.qb2 + HFIXEDSZ; end = answer.qb2 + n; - ans = answer; - hp = (HEADER *)ans; + hp = (HEADER *)answer; qd = ntohs(hp-qdcount); an = ntohs(hp-ancount); ns = ntohs(hp-nscount); ar = ntohs(hp-arcount); - + /* Skip QD entries, they're only used by dn_expand later on */ while (qd-- 0) { n = dn_skipname(cp, end); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
pollita Fri Aug 6 14:38:36 2004 EDT Modified files: /php-src/ext/standard dns.c Log: Add A6 support, fix IPv6 address parsing, and improve define compatability http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.68r2=1.69ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.68 php-src/ext/standard/dns.c:1.69 --- php-src/ext/standard/dns.c:1.68 Fri Mar 19 17:21:53 2004 +++ php-src/ext/standard/dns.c Fri Aug 6 14:38:35 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.68 2004/03/19 22:21:53 pollita Exp $ */ +/* $Id: dns.c,v 1.69 2004/08/06 18:38:35 pollita Exp $ */ /* {{{ includes */ #include php.h @@ -69,6 +69,51 @@ #endif #include dns.h + +/* type compat */ +#ifndef DNS_T_A +#define DNS_T_A1 +#endif +#ifndef DNS_T_NS +#define DNS_T_NS 2 +#endif +#ifndef DNS_T_CNAME +#define DNS_T_CNAME5 +#endif +#ifndef DNS_T_SOA +#define DNS_T_SOA 6 +#endif +#ifndef DNS_T_PTR +#define DNS_T_PTR 12 +#endif +#ifndef DNS_T_HINFO +#define DNS_T_HINFO13 +#endif +#ifndef DNS_T_MINFO +#define DNS_T_MINFO14 +#endif +#ifndef DNS_T_MX +#define DNS_T_MX 15 +#endif +#ifndef DNS_T_TXT +#define DNS_T_TXT 16 +#endif +#ifndef DNS_T_ +#define DNS_T_ 28 +#endif +#ifndef DNS_T_SRV +#define DNS_T_SRV 33 +#endif +#ifndef DNS_T_NAPTR +#define DNS_T_NAPTR35 +#endif +#ifndef DNS_T_A6 +#define DNS_T_A6 38 +#endif + +#ifndef DNS_T_ANY +#define DNS_T_ANY 255 +#endif /* }}} */ static char *php_gethostbyaddr(char *ip); @@ -229,21 +274,16 @@ convert_to_string_ex(arg2); if (!strcasecmp(A, Z_STRVAL_PP(arg2))) type = T_A; - else if (!strcasecmp(NS,Z_STRVAL_PP(arg2))) type = T_NS; - else if (!strcasecmp(MX,Z_STRVAL_PP(arg2))) type = T_MX; - else if (!strcasecmp(PTR, Z_STRVAL_PP(arg2))) type = T_PTR; - else if (!strcasecmp(ANY, Z_STRVAL_PP(arg2))) type = T_ANY; - else if (!strcasecmp(SOA, Z_STRVAL_PP(arg2))) type = T_SOA; - else if (!strcasecmp(CNAME, Z_STRVAL_PP(arg2))) type = T_CNAME; -#ifdef T_ - else if (!strcasecmp(, Z_STRVAL_PP(arg2))) type = T_; -#endif -#ifdef T_SRV - else if (!strcasecmp(SRV, Z_STRVAL_PP(arg2))) type = T_SRV; -#endif -#ifdef T_NAPTR - else if (!strcasecmp(NAPTR, Z_STRVAL_PP(arg2))) type = T_NAPTR; -#endif + else if (!strcasecmp(NS,Z_STRVAL_PP(arg2))) type = DNS_T_NS; + else if (!strcasecmp(MX,Z_STRVAL_PP(arg2))) type = DNS_T_MX; + else if (!strcasecmp(PTR, Z_STRVAL_PP(arg2))) type = DNS_T_PTR; + else if (!strcasecmp(ANY, Z_STRVAL_PP(arg2))) type = DNS_T_ANY; + else if (!strcasecmp(SOA, Z_STRVAL_PP(arg2))) type = DNS_T_SOA; + else if (!strcasecmp(CNAME, Z_STRVAL_PP(arg2))) type = DNS_T_CNAME; + else if (!strcasecmp(, Z_STRVAL_PP(arg2))) type = DNS_T_; + else if (!strcasecmp(SRV, Z_STRVAL_PP(arg2))) type = DNS_T_SRV; + else if (!strcasecmp(NAPTR, Z_STRVAL_PP(arg2))) type = DNS_T_NAPTR; + else if (!strcasecmp(A6, Z_STRVAL_PP(arg2)))type = DNS_T_A6; else { php_error_docref(NULL TSRMLS_CC, E_WARNING, Type '%s' not supported, Z_STRVAL_PP(arg2)); RETURN_FALSE; @@ -266,7 +306,7 @@ #if HAVE_DNS_FUNCS -#define PHP_DNS_NUM_TYPES 11 /* Number of DNS Types Supported by PHP currently */ +#define PHP_DNS_NUM_TYPES 12 /* Number of DNS Types Supported by PHP currently */ #define PHP_DNS_A 0x0001 #define PHP_DNS_NS 0x0002 @@ -276,11 +316,12 @@ #define PHP_DNS_HINFO 0x1000 #define PHP_DNS_MX 0x4000 #define PHP_DNS_TXT0x8000 +#define PHP_DNS_A6 0x0100 #define PHP_DNS_SRV0x0200 #define PHP_DNS_NAPTR 0x0400 #define PHP_DNS_ 0x0800 #define PHP_DNS_ANY0x1000 -#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) +#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA|PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT|PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_) PHP_MINIT_FUNCTION(dns) { REGISTER_LONG_CONSTANT(DNS_A, PHP_DNS_A, CONST_CS | CONST_PERSISTENT); @@ -294,6 +335,7 @@ REGISTER_LONG_CONSTANT(DNS_SRV, PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(DNS_NAPTR, PHP_DNS_NAPTR, CONST_CS
Re: [PHP-CVS] cvs: php-src /ext/standard dns.c
Don't forget the NEWS entry.. --Jani On Fri, 19 Mar 2004, Sara Golemon wrote: pollitaFri Mar 19 16:43:44 2004 EDT Modified files: /php-src/ext/standard dns.c Log: Bug Fix #27657: TXT records longer than MAXHOSTNAMELEN cause segfaults. http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.66r2=1.67ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.66 php-src/ext/standard/dns.c:1.67 --- php-src/ext/standard/dns.c:1.66Thu Jan 8 03:17:31 2004 +++ php-src/ext/standard/dns.c Fri Mar 19 16:42:29 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.66 2004/01/08 08:17:31 andi Exp $ */ +/* $Id: dns.c,v 1.67 2004/03/19 21:42:29 pollita Exp $ */ /* {{{ includes */ #include php.h @@ -400,12 +400,14 @@ break; case T_TXT: add_assoc_string(*subarray, type, TXT, 1); - n = cp[0]; - for(i=1; i=n; i++) - name[i-1] = cp[i]; - name[i-1] = '\0'; + n = cp[0]; + tp = emalloc(n + 1); + for(i=1; i=n; i++) { + tp[i-1] = cp[i]; + } + tp[i-1] = '\0'; cp += dlen; - add_assoc_string(*subarray, txt, name, 1); + add_assoc_stringl(*subarray, txt, tp, n, 0); break; case T_SOA: add_assoc_string(*subarray, type, SOA, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
pollita Fri Mar 19 16:43:44 2004 EDT Modified files: /php-src/ext/standard dns.c Log: Bug Fix #27657: TXT records longer than MAXHOSTNAMELEN cause segfaults. http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.66r2=1.67ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.66 php-src/ext/standard/dns.c:1.67 --- php-src/ext/standard/dns.c:1.66 Thu Jan 8 03:17:31 2004 +++ php-src/ext/standard/dns.c Fri Mar 19 16:42:29 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.66 2004/01/08 08:17:31 andi Exp $ */ +/* $Id: dns.c,v 1.67 2004/03/19 21:42:29 pollita Exp $ */ /* {{{ includes */ #include php.h @@ -400,12 +400,14 @@ break; case T_TXT: add_assoc_string(*subarray, type, TXT, 1); - n = cp[0]; - for(i=1; i=n; i++) - name[i-1] = cp[i]; - name[i-1] = '\0'; + n = cp[0]; + tp = emalloc(n + 1); + for(i=1; i=n; i++) { + tp[i-1] = cp[i]; + } + tp[i-1] = '\0'; cp += dlen; - add_assoc_string(*subarray, txt, name, 1); + add_assoc_stringl(*subarray, txt, tp, n, 0); break; case T_SOA: add_assoc_string(*subarray, type, SOA, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
pollita Fri Mar 19 17:23:09 2004 EDT Modified files: /php-src/ext/standard dns.c Log: Cleanup, minor refactor, and CS http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.67r2=1.68ty=u Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.67 php-src/ext/standard/dns.c:1.68 --- php-src/ext/standard/dns.c:1.67 Fri Mar 19 16:42:29 2004 +++ php-src/ext/standard/dns.c Fri Mar 19 17:21:53 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.67 2004/03/19 21:42:29 pollita Exp $ */ +/* $Id: dns.c,v 1.68 2004/03/19 22:21:53 pollita Exp $ */ /* {{{ includes */ #include php.h @@ -352,7 +352,7 @@ return cp; } - MAKE_STD_ZVAL(*subarray); + ALLOC_INIT_ZVAL(*subarray); array_init(*subarray); add_assoc_string(*subarray, host, name, 1); @@ -402,10 +402,8 @@ add_assoc_string(*subarray, type, TXT, 1); n = cp[0]; tp = emalloc(n + 1); - for(i=1; i=n; i++) { - tp[i-1] = cp[i]; - } - tp[i-1] = '\0'; + memcpy(tp, cp + 1, n); + tp[n] = '\0'; cp += dlen; add_assoc_stringl(*subarray, txt, tp, n, 0); break; @@ -517,11 +515,9 @@ Get any Resource Record corresponding to a given Internet host name */ PHP_FUNCTION(dns_get_record) { - zval *subarray[MAXRESOURCERECORDS]; pval *addtl, *host, *authns, *fetch_type; int addtl_recs = 0; int type_to_fetch, type_param = PHP_DNS_ANY; - int current_subarray = 0; struct __res_state res; HEADER *hp; querybuf buf, answer, *ans; @@ -670,10 +666,12 @@ /* YAY! Our real answers! */ while (an-- cp cp end) { - cp = php_parserr(cp, answer, type_to_fetch, store_results, subarray[current_subarray]); - if (subarray[current_subarray] != NULL store_results) - zend_hash_next_index_insert(HASH_OF(return_value), (void *)subarray[current_subarray], sizeof(zval *), NULL); - current_subarray++; + zval *retval; + + cp = php_parserr(cp, answer, type_to_fetch, store_results, retval); + if (retval != NULL store_results) { + add_next_index_zval(return_value, retval); + } } res_nclose(res); } @@ -682,17 +680,21 @@ if (addtl_recs) { /* List of Authoritative Name Servers */ while (ns-- 0 cp cp end) { - cp = php_parserr(cp, answer, T_ANY, 1, subarray[current_subarray]); - if (subarray[current_subarray] != NULL) - zend_hash_next_index_insert(HASH_OF(authns), (void *)subarray[current_subarray], sizeof(zval *), NULL); - current_subarray++; + zval *retval; + + cp = php_parserr(cp, answer, T_ANY, 1, retval); + if (retval != NULL) { + add_next_index_zval(authns, retval); + } } /* Additional records associated with authoritative name servers */ while (ar-- 0 cp cp end) { - cp = php_parserr(cp, answer, T_ANY, 1, subarray[current_subarray]); - if (subarray[current_subarray] != NULL) - zend_hash_next_index_insert(HASH_OF(addtl), (void *)subarray[current_subarray], sizeof(zval *), NULL); - current_subarray++; + zval *retval; + + cp = php_parserr(cp, answer, T_ANY, 1, retval); + if (retval != NULL) { + add_next_index_zval(addtl, retval); + } } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard dns.c
sniper Sun Dec 7 13:19:31 2003 EDT Modified files: /php-src/ext/standard dns.c Log: ws Index: php-src/ext/standard/dns.c diff -u php-src/ext/standard/dns.c:1.64 php-src/ext/standard/dns.c:1.65 --- php-src/ext/standard/dns.c:1.64 Fri Oct 24 13:09:36 2003 +++ php-src/ext/standard/dns.c Sun Dec 7 13:19:30 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: dns.c,v 1.64 2003/10/24 17:09:36 markonen Exp $ */ +/* $Id: dns.c,v 1.65 2003/12/07 18:19:30 sniper Exp $ */ /* {{{ includes */ #include php.h @@ -89,7 +89,7 @@ addr = php_gethostbyaddr(Z_STRVAL_PP(arg)); - if(addr == NULL) { + if (addr == NULL) { #if HAVE_IPV6 HAVE_INET_PTON php_error_docref(NULL TSRMLS_CC, E_WARNING, Address is not a valid IPv4 or IPv6 address); #else @@ -321,7 +321,8 @@ } querybuf; /* {{{ php_parserr */ -static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray) { +static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray) +{ u_short type, class, dlen; u_long ttl; long n, i; @@ -572,7 +573,7 @@ for(type = (type_param==PHP_DNS_ANY ? (PHP_DNS_NUM_TYPES + 1) : 0); type (addtl_recs ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query; type++) { first_query = 0; - switch(type) { + switch (type) { case 0: type_to_fetch = type_paramPHP_DNS_A ? T_A : 0; break; @@ -711,7 +712,7 @@ u_char *cp, *end; int i; - switch(ZEND_NUM_ARGS()) { + switch (ZEND_NUM_ARGS()) { case 2: if (zend_get_parameters(ht, 2, host, mx_list) == FAILURE) { WRONG_PARAM_COUNT; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php