dnsapi: Added check for _msg_ptr vs. _ptr member in ns_msg struct.
This commit is contained in:
parent
d1a3383d53
commit
788e30f139
|
@ -20742,6 +20742,135 @@ _ACEOF
|
|||
fi
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for ns_msg._msg_ptr" >&5
|
||||
echo $ECHO_N "checking for ns_msg._msg_ptr... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_member_ns_msg__msg_ptr+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
# include <arpa/nameser.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static ns_msg ac_aggr;
|
||||
if (ac_aggr._msg_ptr)
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_member_ns_msg__msg_ptr=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
# include <arpa/nameser.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static ns_msg ac_aggr;
|
||||
if (sizeof ac_aggr._msg_ptr)
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_member_ns_msg__msg_ptr=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_member_ns_msg__msg_ptr=no
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_member_ns_msg__msg_ptr" >&5
|
||||
echo "${ECHO_T}$ac_cv_member_ns_msg__msg_ptr" >&6; }
|
||||
if test $ac_cv_member_ns_msg__msg_ptr = yes; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_NS_MSG__MSG_PTR 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for timezone variable" >&5
|
||||
echo $ECHO_N "checking for timezone variable... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_have_timezone+set}" = set; then
|
||||
|
|
12
configure.ac
12
configure.ac
|
@ -1455,6 +1455,18 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
|
|||
#include <netinet/in.h>
|
||||
#endif])
|
||||
|
||||
dnl Check for ns_msg ptr member
|
||||
AC_CHECK_MEMBERS([ns_msg._msg_ptr],,,
|
||||
[#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
# include <arpa/nameser.h>
|
||||
#endif])
|
||||
|
||||
dnl Check for the external timezone variables timezone and daylight
|
||||
AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone,
|
||||
AC_TRY_LINK([#include <time.h>],[timezone;],
|
||||
|
|
|
@ -40,6 +40,12 @@ static void setsection(ns_msg *msg, ns_sect sect);
|
|||
|
||||
#define RETERR(err) do { return (-1); } while (0)
|
||||
|
||||
#ifdef HAVE_NS_MSG__MSG_PTR
|
||||
# define NS_PTR(ns_msg) ((ns_msg)->_msg_ptr)
|
||||
#else
|
||||
# define NS_PTR(ns_msg) ((ns_msg)->_ptr)
|
||||
#endif
|
||||
|
||||
/* Public. */
|
||||
|
||||
static int
|
||||
|
@ -121,38 +127,38 @@ dns_ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
|
|||
if (rrnum < handle->_rrnum)
|
||||
setsection(handle, section);
|
||||
if (rrnum > handle->_rrnum) {
|
||||
b = dns_ns_skiprr(handle->_ptr, handle->_eom, section,
|
||||
b = dns_ns_skiprr(NS_PTR(handle), handle->_eom, section,
|
||||
rrnum - handle->_rrnum);
|
||||
|
||||
if (b < 0)
|
||||
return (-1);
|
||||
handle->_ptr += b;
|
||||
NS_PTR(handle) += b;
|
||||
handle->_rrnum = rrnum;
|
||||
}
|
||||
|
||||
/* Do the parse. */
|
||||
b = dn_expand(handle->_msg, handle->_eom,
|
||||
handle->_ptr, rr->name, NS_MAXDNAME);
|
||||
NS_PTR(handle), rr->name, NS_MAXDNAME);
|
||||
if (b < 0)
|
||||
return (-1);
|
||||
handle->_ptr += b;
|
||||
if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
|
||||
NS_PTR(handle) += b;
|
||||
if (NS_PTR(handle) + NS_INT16SZ + NS_INT16SZ > handle->_eom)
|
||||
RETERR(EMSGSIZE);
|
||||
NS_GET16(rr->type, handle->_ptr);
|
||||
NS_GET16(rr->rr_class, handle->_ptr);
|
||||
NS_GET16(rr->type, NS_PTR(handle));
|
||||
NS_GET16(rr->rr_class, NS_PTR(handle));
|
||||
if (section == ns_s_qd) {
|
||||
rr->ttl = 0;
|
||||
rr->rdlength = 0;
|
||||
rr->rdata = NULL;
|
||||
} else {
|
||||
if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
|
||||
if (NS_PTR(handle) + NS_INT32SZ + NS_INT16SZ > handle->_eom)
|
||||
RETERR(EMSGSIZE);
|
||||
NS_GET32(rr->ttl, handle->_ptr);
|
||||
NS_GET16(rr->rdlength, handle->_ptr);
|
||||
if (handle->_ptr + rr->rdlength > handle->_eom)
|
||||
NS_GET32(rr->ttl, NS_PTR(handle));
|
||||
NS_GET16(rr->rdlength, NS_PTR(handle));
|
||||
if (NS_PTR(handle) + rr->rdlength > handle->_eom)
|
||||
RETERR(EMSGSIZE);
|
||||
rr->rdata = handle->_ptr;
|
||||
handle->_ptr += rr->rdlength;
|
||||
rr->rdata = NS_PTR(handle);
|
||||
NS_PTR(handle) += rr->rdlength;
|
||||
}
|
||||
if (++handle->_rrnum > handle->_counts[(int)section])
|
||||
setsection(handle, (ns_sect)((int)section + 1));
|
||||
|
@ -168,9 +174,9 @@ setsection(ns_msg *msg, ns_sect sect) {
|
|||
msg->_sect = sect;
|
||||
if (sect == ns_s_max) {
|
||||
msg->_rrnum = -1;
|
||||
msg->_ptr = NULL;
|
||||
NS_PTR(msg) = NULL;
|
||||
} else {
|
||||
msg->_rrnum = 0;
|
||||
msg->_ptr = msg->_sections[(int)sect];
|
||||
NS_PTR(msg) = msg->_sections[(int)sect];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -476,6 +476,9 @@
|
|||
/* Define to 1 if you have the <net/route.h> header file. */
|
||||
#undef HAVE_NET_ROUTE_H
|
||||
|
||||
/* Define to 1 if `_msg_ptr' is member of `ns_msg'. */
|
||||
#undef HAVE_NS_MSG__MSG_PTR
|
||||
|
||||
/* Define to 1 if the system has the type `off_t'. */
|
||||
#undef HAVE_OFF_T
|
||||
|
||||
|
|
Loading…
Reference in New Issue