Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
39464e86
Commit
39464e86
authored
Apr 05, 2020
by
Chip Davis
Committed by
Alexandre Julliard
Apr 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Use res_getservers() if available to get the DNS server list.
Signed-off-by:
Chip Davis
<
cdavis@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7814da1f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
1 deletion
+100
-1
configure
configure
+39
-0
configure.ac
configure.ac
+14
-0
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+44
-1
config.h.in
include/config.h.in
+3
-0
No files found.
configure
View file @
39464e86
...
@@ -14203,6 +14203,45 @@ $as_echo "#define HAVE_RESOLV 1" >>confdefs.h
...
@@ -14203,6 +14203,45 @@ $as_echo "#define HAVE_RESOLV 1" >>confdefs.h
RESOLV_LIBS
=
$ac_cv_have_resolv
RESOLV_LIBS
=
$ac_cv_have_resolv
;;
;;
esac
esac
if
test
"x
$ac_cv_have_resolv
"
!=
"xnot found"
then
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for res_getservers"
>
&5
$as_echo_n
"checking for res_getservers... "
>
&6
;
}
if
${
ac_cv_have_res_getservers
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
ac_save_LIBS
=
"
$LIBS
"
LIBS
=
"
$RESOLV_LIBS
$LIBS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
#include <resolv.h>
int
main ()
{
res_getservers(NULL, NULL, 0);
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_have_res_getservers
=
yes
else
ac_cv_have_res_getservers
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
"
$ac_save_LIBS
"
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_have_res_getservers
"
>
&5
$as_echo
"
$ac_cv_have_res_getservers
"
>
&6
;
}
if
test
"
$ac_cv_have_res_getservers
"
=
"yes"
then
$as_echo
"#define HAVE_RES_GETSERVERS 1"
>>
confdefs.h
fi
fi
fi
fi
if
test
"x
$with_cms
"
!=
"xno"
if
test
"x
$with_cms
"
!=
"xno"
...
...
configure.ac
View file @
39464e86
...
@@ -1535,6 +1535,20 @@ then
...
@@ -1535,6 +1535,20 @@ then
AC_DEFINE(HAVE_RESOLV, 1)
AC_DEFINE(HAVE_RESOLV, 1)
AC_SUBST(RESOLV_LIBS,$ac_cv_have_resolv) ;;
AC_SUBST(RESOLV_LIBS,$ac_cv_have_resolv) ;;
esac
esac
if test "x$ac_cv_have_resolv" != "xnot found"
then
AC_CACHE_CHECK([for res_getservers], ac_cv_have_res_getservers,
[ac_save_LIBS="$LIBS"
LIBS="$RESOLV_LIBS $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <resolv.h>]],[[res_getservers(NULL, NULL, 0);]])],[ac_cv_have_res_getservers=yes],[ac_cv_have_res_getservers=no])
LIBS="$ac_save_LIBS"])
if test "$ac_cv_have_res_getservers" = "yes"
then
AC_DEFINE(HAVE_RES_GETSERVERS, 1, [Define to 1 if you have the `res_getservers' function.])
fi
fi
fi
fi
dnl **** Check for LittleCMS ***
dnl **** Check for LittleCMS ***
...
...
dlls/iphlpapi/iphlpapi_main.c
View file @
39464e86
...
@@ -1249,7 +1249,8 @@ static void sockaddr_in_to_WS_storage( SOCKADDR_STORAGE *dst, const struct socka
...
@@ -1249,7 +1249,8 @@ static void sockaddr_in_to_WS_storage( SOCKADDR_STORAGE *dst, const struct socka
}
}
#if defined(HAVE_STRUCT___RES_STATE__U__EXT_NSCOUNT6) || \
#if defined(HAVE_STRUCT___RES_STATE__U__EXT_NSCOUNT6) || \
(defined(HAVE___RES_GET_STATE) && defined(HAVE___RES_GETSERVERS))
(defined(HAVE___RES_GET_STATE) && defined(HAVE___RES_GETSERVERS)) || \
defined(HAVE_RES_GETSERVERS)
static
void
sockaddr_in6_to_WS_storage
(
SOCKADDR_STORAGE
*
dst
,
const
struct
sockaddr_in6
*
src
)
static
void
sockaddr_in6_to_WS_storage
(
SOCKADDR_STORAGE
*
dst
,
const
struct
sockaddr_in6
*
src
)
{
{
SOCKADDR_IN6
*
s
=
(
SOCKADDR_IN6
*
)
dst
;
SOCKADDR_IN6
*
s
=
(
SOCKADDR_IN6
*
)
dst
;
...
@@ -1284,6 +1285,47 @@ static void initialise_resolver(void)
...
@@ -1284,6 +1285,47 @@ static void initialise_resolver(void)
LeaveCriticalSection
(
&
res_init_cs
);
LeaveCriticalSection
(
&
res_init_cs
);
}
}
#ifdef HAVE_RES_GETSERVERS
static
int
get_dns_servers
(
SOCKADDR_STORAGE
*
servers
,
int
num
,
BOOL
ip4_only
)
{
struct
__res_state
*
state
=
&
_res
;
int
i
,
found
=
0
,
total
;
SOCKADDR_STORAGE
*
addr
=
servers
;
union
res_sockaddr_union
*
buf
;
initialise_resolver
();
total
=
res_getservers
(
state
,
NULL
,
0
);
if
((
!
servers
||
!
num
)
&&
!
ip4_only
)
return
total
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
total
*
sizeof
(
union
res_sockaddr_union
)
);
total
=
res_getservers
(
state
,
buf
,
total
);
for
(
i
=
0
;
i
<
total
;
i
++
)
{
if
(
buf
[
i
].
sin6
.
sin6_family
==
AF_INET6
&&
ip4_only
)
continue
;
if
(
buf
[
i
].
sin
.
sin_family
!=
AF_INET
&&
buf
[
i
].
sin6
.
sin6_family
!=
AF_INET6
)
continue
;
found
++
;
if
(
!
servers
||
!
num
)
continue
;
if
(
buf
[
i
].
sin6
.
sin6_family
==
AF_INET6
)
{
sockaddr_in6_to_WS_storage
(
addr
,
&
buf
[
i
].
sin6
);
}
else
{
sockaddr_in_to_WS_storage
(
addr
,
&
buf
[
i
].
sin
);
}
if
(
++
addr
>=
servers
+
num
)
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
return
found
;
}
#else
static
int
get_dns_servers
(
SOCKADDR_STORAGE
*
servers
,
int
num
,
BOOL
ip4_only
)
static
int
get_dns_servers
(
SOCKADDR_STORAGE
*
servers
,
int
num
,
BOOL
ip4_only
)
{
{
int
i
,
ip6_count
=
0
;
int
i
,
ip6_count
=
0
;
...
@@ -1319,6 +1361,7 @@ static int get_dns_servers( SOCKADDR_STORAGE *servers, int num, BOOL ip4_only )
...
@@ -1319,6 +1361,7 @@ static int get_dns_servers( SOCKADDR_STORAGE *servers, int num, BOOL ip4_only )
}
}
return
addr
-
servers
;
return
addr
-
servers
;
}
}
#endif
#elif defined(HAVE___RES_GET_STATE) && defined(HAVE___RES_GETSERVERS)
#elif defined(HAVE___RES_GET_STATE) && defined(HAVE___RES_GETSERVERS)
static
int
get_dns_servers
(
SOCKADDR_STORAGE
*
servers
,
int
num
,
BOOL
ip4_only
)
static
int
get_dns_servers
(
SOCKADDR_STORAGE
*
servers
,
int
num
,
BOOL
ip4_only
)
...
...
include/config.h.in
View file @
39464e86
...
@@ -761,6 +761,9 @@
...
@@ -761,6 +761,9 @@
/* Define to 1 if you have the <resolv.h> header file. */
/* Define to 1 if you have the <resolv.h> header file. */
#undef HAVE_RESOLV_H
#undef HAVE_RESOLV_H
/* Define to 1 if you have the `res_getservers' function. */
#undef HAVE_RES_GETSERVERS
/* Define to 1 if you have the `rint' function. */
/* Define to 1 if you have the `rint' function. */
#undef HAVE_RINT
#undef HAVE_RINT
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment