mirror of
https://github.com/php/php-src.git
synced 2025-01-20 10:43:40 +08:00
Add support for the older style bind 8 functions, this adds support for OS X to use all of the dns_* functions.
This commit is contained in:
parent
cc50663b56
commit
8911ba1c62
@ -398,15 +398,9 @@ if test "$ac_cv_func_dlopen" = "yes"; then
|
||||
fi
|
||||
AC_CHECK_LIB(m, sin)
|
||||
|
||||
dnl Check for resolver routines.
|
||||
dnl Need to check for both res_search and __res_search
|
||||
dnl in -lc, -lbind, -lresolv and -lsocket
|
||||
PHP_CHECK_FUNC(res_search, resolv, bind, socket)
|
||||
|
||||
dnl Check for inet_aton and dn_skipname
|
||||
dnl Check for inet_aton
|
||||
dnl in -lc, -lbind and -lresolv
|
||||
PHP_CHECK_FUNC(inet_aton, resolv, bind)
|
||||
PHP_CHECK_FUNC(dn_skipname, resolv, bind)
|
||||
|
||||
|
||||
dnl Then headers.
|
||||
|
@ -251,7 +251,17 @@ dnl ext/standard/dns.h will collect these in a single define: HAVE_DNS_FUNCS
|
||||
dnl
|
||||
PHP_CHECK_FUNC(res_nmkquery, resolv, bind, socket)
|
||||
PHP_CHECK_FUNC(res_nsend, resolv, bind, socket)
|
||||
PHP_CHECK_FUNC(res_search, resolv, bind, socket)
|
||||
PHP_CHECK_FUNC(dn_expand, resolv, bind, socket)
|
||||
PHP_CHECK_FUNC(dn_skipname, 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
|
||||
|
@ -357,7 +357,7 @@ typedef union {
|
||||
* __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;
|
||||
@ -672,7 +672,9 @@ PHP_FUNCTION(dns_get_record)
|
||||
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;
|
||||
@ -758,11 +760,14 @@ PHP_FUNCTION(dns_get_record)
|
||||
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");
|
||||
|
@ -23,7 +23,19 @@
|
||||
#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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user