Commit 788e30f1 authored by Alexandre Julliard's avatar Alexandre Julliard

dnsapi: Added check for _msg_ptr vs. _ptr member in ns_msg struct.

parent d1a3383d
...@@ -20742,6 +20742,135 @@ _ACEOF ...@@ -20742,6 +20742,135 @@ _ACEOF
fi 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 "$as_me:$LINENO: checking for timezone variable" >&5
echo $ECHO_N "checking for timezone variable... $ECHO_C" >&6; } echo $ECHO_N "checking for timezone variable... $ECHO_C" >&6; }
if test "${ac_cv_have_timezone+set}" = set; then if test "${ac_cv_have_timezone+set}" = set; then
......
...@@ -1455,6 +1455,18 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,, ...@@ -1455,6 +1455,18 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
#include <netinet/in.h> #include <netinet/in.h>
#endif]) #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 dnl Check for the external timezone variables timezone and daylight
AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone, AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone,
AC_TRY_LINK([#include <time.h>],[timezone;], AC_TRY_LINK([#include <time.h>],[timezone;],
......
...@@ -40,6 +40,12 @@ static void setsection(ns_msg *msg, ns_sect sect); ...@@ -40,6 +40,12 @@ static void setsection(ns_msg *msg, ns_sect sect);
#define RETERR(err) do { return (-1); } while (0) #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. */ /* Public. */
static int static int
...@@ -121,38 +127,38 @@ dns_ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) { ...@@ -121,38 +127,38 @@ dns_ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
if (rrnum < handle->_rrnum) if (rrnum < handle->_rrnum)
setsection(handle, section); setsection(handle, section);
if (rrnum > handle->_rrnum) { 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); rrnum - handle->_rrnum);
if (b < 0) if (b < 0)
return (-1); return (-1);
handle->_ptr += b; NS_PTR(handle) += b;
handle->_rrnum = rrnum; handle->_rrnum = rrnum;
} }
/* Do the parse. */ /* Do the parse. */
b = dn_expand(handle->_msg, handle->_eom, b = dn_expand(handle->_msg, handle->_eom,
handle->_ptr, rr->name, NS_MAXDNAME); NS_PTR(handle), rr->name, NS_MAXDNAME);
if (b < 0) if (b < 0)
return (-1); return (-1);
handle->_ptr += b; NS_PTR(handle) += b;
if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom) if (NS_PTR(handle) + NS_INT16SZ + NS_INT16SZ > handle->_eom)
RETERR(EMSGSIZE); RETERR(EMSGSIZE);
NS_GET16(rr->type, handle->_ptr); NS_GET16(rr->type, NS_PTR(handle));
NS_GET16(rr->rr_class, handle->_ptr); NS_GET16(rr->rr_class, NS_PTR(handle));
if (section == ns_s_qd) { if (section == ns_s_qd) {
rr->ttl = 0; rr->ttl = 0;
rr->rdlength = 0; rr->rdlength = 0;
rr->rdata = NULL; rr->rdata = NULL;
} else { } else {
if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom) if (NS_PTR(handle) + NS_INT32SZ + NS_INT16SZ > handle->_eom)
RETERR(EMSGSIZE); RETERR(EMSGSIZE);
NS_GET32(rr->ttl, handle->_ptr); NS_GET32(rr->ttl, NS_PTR(handle));
NS_GET16(rr->rdlength, handle->_ptr); NS_GET16(rr->rdlength, NS_PTR(handle));
if (handle->_ptr + rr->rdlength > handle->_eom) if (NS_PTR(handle) + rr->rdlength > handle->_eom)
RETERR(EMSGSIZE); RETERR(EMSGSIZE);
rr->rdata = handle->_ptr; rr->rdata = NS_PTR(handle);
handle->_ptr += rr->rdlength; NS_PTR(handle) += rr->rdlength;
} }
if (++handle->_rrnum > handle->_counts[(int)section]) if (++handle->_rrnum > handle->_counts[(int)section])
setsection(handle, (ns_sect)((int)section + 1)); setsection(handle, (ns_sect)((int)section + 1));
...@@ -168,9 +174,9 @@ setsection(ns_msg *msg, ns_sect sect) { ...@@ -168,9 +174,9 @@ setsection(ns_msg *msg, ns_sect sect) {
msg->_sect = sect; msg->_sect = sect;
if (sect == ns_s_max) { if (sect == ns_s_max) {
msg->_rrnum = -1; msg->_rrnum = -1;
msg->_ptr = NULL; NS_PTR(msg) = NULL;
} else { } else {
msg->_rrnum = 0; msg->_rrnum = 0;
msg->_ptr = msg->_sections[(int)sect]; NS_PTR(msg) = msg->_sections[(int)sect];
} }
} }
...@@ -476,6 +476,9 @@ ...@@ -476,6 +476,9 @@
/* Define to 1 if you have the <net/route.h> header file. */ /* Define to 1 if you have the <net/route.h> header file. */
#undef HAVE_NET_ROUTE_H #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'. */ /* Define to 1 if the system has the type `off_t'. */
#undef HAVE_OFF_T #undef HAVE_OFF_T
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment