lib1960: revert the use of libcurl's inet_pton

Since it now uses hex conversion code from strparse as well.

Closes #16888
This commit is contained in:
Daniel Stenberg 2025-03-31 23:47:23 +02:00
parent 0c6e63a1be
commit 8a45c2851a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 29 additions and 4 deletions

View File

@ -26,7 +26,6 @@ TESTUTIL = testutil.c testutil.h
TSTTRACE = testtrace.c testtrace.h
WARNLESS = ../../lib/warnless.c ../../lib/warnless.h
MULTIBYTE = ../../lib/curl_multibyte.c ../../lib/curl_multibyte.h
INET_PTON = ../../lib/inet_pton.c ../../lib/inet_pton.h
THREADS = ../../lib/curl_threads.c ../../lib/curl_threads.h
# these files are used in every single test program below
@ -657,7 +656,7 @@ lib1958_LDADD = $(TESTUTIL_LIBS)
lib1959_SOURCES = lib1959.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
lib1959_LDADD = $(TESTUTIL_LIBS)
lib1960_SOURCES = lib1960.c $(SUPPORTFILES) $(INET_PTON)
lib1960_SOURCES = lib1960.c $(SUPPORTFILES)
lib1960_LDADD = $(TESTUTIL_LIBS)
lib1964_SOURCES = lib1964.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)

View File

@ -23,7 +23,18 @@
***************************************************************************/
#include "test.h"
#include "inet_pton.h"
#ifdef HAVE_INET_PTON
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include "memdebug.h"
/* to prevent libcurl from closing our socket */
@ -56,6 +67,13 @@ static int sockopt_cb(void *clientp,
return CURL_SOCKOPT_ALREADY_CONNECTED;
}
#if defined(__AMIGA__)
#define my_inet_pton(x,y,z) inet_pton(x,(unsigned char *)y,z)
#else
#define my_inet_pton(x,y,z) inet_pton(x,y,z)
#endif
/* Expected args: URL IP PORT */
CURLcode test(char *URL)
{
@ -90,7 +108,7 @@ CURLcode test(char *URL)
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
if(curlx_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) {
if(my_inet_pton(AF_INET, libtest_arg2, &serv_addr.sin_addr) <= 0) {
fprintf(stderr, "inet_pton failed\n");
goto test_cleanup;
}
@ -128,3 +146,11 @@ test_cleanup:
return res;
}
#else
CURLcode test(char *URL)
{
(void)URL;
printf("lacks inet_pton\n");
return CURLE_OK;
}
#endif