diff --git a/configure b/configure index e2e03dc4ba7..a5516fe60eb 100755 --- a/configure +++ b/configure @@ -18296,9 +18296,6 @@ for ac_func in \ getprotobyname \ getprotobynumber \ getservbyport \ - inet_addr \ - inet_network \ - inet_ntop \ do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index d81f5cc88ca..b43ec739294 100644 --- a/configure.ac +++ b/configure.ac @@ -2249,9 +2249,6 @@ AC_CHECK_FUNCS(\ getprotobyname \ getprotobynumber \ getservbyport \ - inet_addr \ - inet_network \ - inet_ntop \ ) dnl Check for clock_gettime which may be in -lrt diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index bdfe63ee191..199b7187a87 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -8351,10 +8351,8 @@ int WINAPI WSARemoveServiceClass(LPGUID info) */ PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, SIZE_T len ) { -#ifdef HAVE_INET_NTOP - struct WS_in6_addr *in6; - struct WS_in_addr *in; - PCSTR pdst; + NTSTATUS status; + ULONG size = min( len, (ULONG)-1 ); TRACE("family %d, addr (%p), buffer (%p), len %ld\n", family, addr, buffer, len); if (!buffer) @@ -8367,14 +8365,12 @@ PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, SIZE_T len ) { case WS_AF_INET: { - in = addr; - pdst = inet_ntop( AF_INET, &in->WS_s_addr, buffer, len ); + status = RtlIpv4AddressToStringExA( (IN_ADDR *)addr, 0, buffer, &size ); break; } case WS_AF_INET6: { - in6 = addr; - pdst = inet_ntop( AF_INET6, in6->WS_s6_addr, buffer, len ); + status = RtlIpv6AddressToStringExA( (IN6_ADDR *)addr, 0, 0, buffer, &size ); break; } default: @@ -8382,13 +8378,9 @@ PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, SIZE_T len ) return NULL; } - if (!pdst) SetLastError( STATUS_INVALID_PARAMETER ); - return pdst; -#else - FIXME( "not supported on this platform\n" ); - SetLastError( WSAEAFNOSUPPORT ); + if (status == STATUS_SUCCESS) return buffer; + SetLastError( STATUS_INVALID_PARAMETER ); return NULL; -#endif } /*********************************************************************** diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index c72dc7a77a1..cd9a13937ca 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -5008,6 +5008,12 @@ static void test_inet_pton(void) "0x12345678", NULL, NULL}, {AF_INET6, 0, 0, /* windows bug */ "::1:2:3:4:5:6:7", NULL, NULL}, + {AF_INET6, 1, 0, /* Test 30 */ + "::5efe:1.2.3.4", "::5efe:1.2.3.4", + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5e\xfe\x01\x02\x03\x04"}, + {AF_INET6, 1, 0, + "::ffff:0:1.2.3.4", "::ffff:0:1.2.3.4", + "\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x01\x02\x03\x04"}, }; int i, ret; DWORD err; diff --git a/include/config.h.in b/include/config.h.in index d2933eee65a..26424873129 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -296,18 +296,9 @@ /* Define to 1 if you have the `ilogbf' function. */ #undef HAVE_ILOGBF -/* Define to 1 if you have the `inet_addr' function. */ -#undef HAVE_INET_ADDR - /* Define to 1 if you have the header file. */ #undef HAVE_INET_MIB2_H -/* Define to 1 if you have the `inet_network' function. */ -#undef HAVE_INET_NETWORK - -/* Define to 1 if you have the `inet_ntop' function. */ -#undef HAVE_INET_NTOP - /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H