Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42521 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25029 invoked from network); 7 Jan 2009 03:30:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jan 2009 03:30:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=scott@macvicar.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=scott@macvicar.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain macvicar.net from 193.227.246.108 cause and error) X-PHP-List-Original-Sender: scott@macvicar.net X-Host-Fingerprint: 193.227.246.108 ip246-108-v193.static.x-ip.net Received: from [193.227.246.108] ([193.227.246.108:35831] helo=lovelace.midden.org.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/7A-07052-0F124694 for ; Tue, 06 Jan 2009 22:30:57 -0500 Received: from macvicar.demon.co.uk ([80.177.111.173] helo=[192.168.1.100]) by lovelace.midden.org.uk with esmtpsa (TLS-1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1LKP84-0001Tv-Ry for internals@lists.php.net; Wed, 07 Jan 2009 03:30:51 +0000 Message-ID: To: PHP internals Content-Type: multipart/mixed; boundary=Apple-Mail-14--411227375 Mime-Version: 1.0 (Apple Message framework v930.3) Date: Wed, 7 Jan 2009 03:30:42 +0000 X-Mailer: Apple Mail (2.930.3) X-Spam-Score: -4.1 X-Spam_Report: Spam detection software, running on the system "lovelace.midden.org.uk", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: I went to look at the bug Pierre mention earlier and noticed that dns_get_record isn't implemented on OS X, this looks to be down to the fact that it has a bind 8 BC layer that we use by default for some reason. I tried to make it use the bind 9 interface but it wasn't a simple task as some other things were missing. [...] Content analysis details: (-4.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] 0.3 AWL AWL: From: address is in the auto white-list Subject: dns_get_record for OSX From: scott@macvicar.net (Scott MacVicar) --Apple-Mail-14--411227375 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit I went to look at the bug Pierre mention earlier and noticed that dns_get_record isn't implemented on OS X, this looks to be down to the fact that it has a bind 8 BC layer that we use by default for some reason. I tried to make it use the bind 9 interface but it wasn't a simple task as some other things were missing. End result here is a patch that allows bind 8 to work and therefore OS X, the main difference is that there is a shared _res structure rather than a per request one. I'll apply this tomorrow if no one has any objections. Scott --Apple-Mail-14--411227375 Content-Disposition: attachment; filename=dns_get_record-osx.patch.txt Content-Type: text/plain; x-unix-mode=0644; name="dns_get_record-osx.patch.txt" Content-Transfer-Encoding: 7bit ? tests/general_functions/escapeshellcmd-win32.phpt Index: config.m4 =================================================================== RCS file: /repository/php-src/ext/standard/config.m4,v retrieving revision 1.80.2.3.2.3.2.7 diff -u -r1.80.2.3.2.3.2.7 config.m4 --- config.m4 2 Dec 2008 16:27:15 -0000 1.80.2.3.2.3.2.7 +++ config.m4 7 Jan 2009 03:25:48 -0000 @@ -254,6 +254,14 @@ PHP_CHECK_FUNC(dn_expand, resolv, bind, socket) dnl +dnl These are old deprecated functions, a single define of HAVE_DEPRECATED_DNS_FUNCS +dnl will be set in ext/standard/dns.h +dnl + +PHP_CHECK_FUNC(res_mkquery, resolv, bind, socket) +PHP_CHECK_FUNC(res_send, resolv, bind, socket) + +dnl dnl Check if atof() accepts NAN dnl AC_CACHE_CHECK(whether atof() accepts NAN, ac_cv_atof_accept_nan,[ Index: dns.c =================================================================== RCS file: /repository/php-src/ext/standard/dns.c,v retrieving revision 1.70.2.7.2.5.2.14 diff -u -r1.70.2.7.2.5.2.14 dns.c --- dns.c 6 Jan 2009 23:37:28 -0000 1.70.2.7.2.5.2.14 +++ dns.c 7 Jan 2009 03:25:49 -0000 @@ -357,7 +357,7 @@ * __libc_res_nsend() in resolv/res_send.c * */ -#ifdef __GLIBC__ +#if defined(__GLIBC__) && !defined(HAVE_DEPRECATED_DNS_FUNCS) #define php_dns_free_res(__res__) _php_dns_free_res(__res__) static void _php_dns_free_res(struct __res_state res) { /* {{{ */ int ns; @@ -663,7 +663,9 @@ zval *authns = NULL, *addtl = NULL; int addtl_recs = 0; int type_to_fetch; +#if !defined(HAVE_DEPRECATED_DNS_FUNCS) struct __res_state res; +#endif HEADER *hp; querybuf buf, answer; u_char *cp = NULL, *end = NULL; @@ -748,11 +750,14 @@ break; } if (type_to_fetch) { +#if defined(HAVE_DEPRECATED_DNS_FUNCS) + res_init(); +#else memset(&res, 0, sizeof(res)); res_ninit(&res); res.retrans = 5; res.options &= ~RES_DEFNAMES; - +#endif n = res_nmkquery(&res, QUERY, hostname, C_IN, type_to_fetch, NULL, 0, NULL, buf.qb2, sizeof buf); if (n<0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "res_nmkquery() failed"); Index: dns.h =================================================================== RCS file: /repository/php-src/ext/standard/dns.h,v retrieving revision 1.19.2.1.2.1.2.4 diff -u -r1.19.2.1.2.1.2.4 dns.h --- dns.h 6 Jan 2009 20:48:20 -0000 1.19.2.1.2.1.2.4 +++ dns.h 7 Jan 2009 03:25:49 -0000 @@ -23,7 +23,18 @@ #ifndef DNS_H #define DNS_H -#if HAVE_RES_NMKQUERY && HAVE_RES_NSEND && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME +#if HAVE_RES_MKQUERY && !defined(HAVE_RES_NMKQUERY) && HAVE_RES_SEND && !defined(HAVE_RES_NSEND) +#define HAVE_DEPRECATED_DNS_FUNCS 1 +#endif + +#if HAVE_DEPRECATED_DNS_FUNCS +#define res_nmkquery(res, op, dname, class, type, data, datalen, newrr, buf, buflen) \ + res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen) +#define res_nsend(res, msg, msglen, answer, anslen) res_send(msg, msglen, answer, anslen); +#define res_nclose(res) /* noop*/ +#endif + +#if ((HAVE_RES_NMKQUERY && HAVE_RES_NSEND) || HAVE_DEPRECATED_DNS_FUNCS) && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME #define HAVE_DNS_FUNCS 1 #endif --Apple-Mail-14--411227375--