]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: delete `libhostname.so` and `chkhostname`
authorViktor Szakats <commit@vsz.me>
Mon, 26 Aug 2024 12:26:29 +0000 (14:26 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 27 Aug 2024 21:40:48 +0000 (23:40 +0200)
Before this patch, `libhostname.so` and `chkhostname` were a test
facility for overriding `gethostname()` in non-debug builds on
Linux and other Unix platforms supporting `LD_PRELOAD`.

`gethostname()` has a single use with SMTP.

The alternative way to override `gethostname()` is building in debug
mode, which allows to do this via the `CURL_GETHOSTNAME` env, on all
platforms.

Drop the `LD_PRELOAD` solution in favour of the above.

Also:
- delete inactive NTLM code with a `gethostname()` call made from it.
- streamline NTLM code by dropping a `printf()` and a macro.
- tests: stop setting `CURL_GETHOSTNAME` where unnecessary.

Closes #14695

23 files changed:
configure.ac
lib/curl_gethostname.c
lib/vauth/ntlm.c
packages/OS400/make-tests.sh
tests/data/test1100
tests/data/test1310
tests/data/test159
tests/data/test2023
tests/data/test2024
tests/data/test2026
tests/data/test2027
tests/data/test831
tests/data/test834
tests/data/test877
tests/data/test880
tests/data/test933
tests/data/test936
tests/libtest/.gitignore
tests/libtest/CMakeLists.txt
tests/libtest/Makefile.am
tests/libtest/Makefile.inc
tests/libtest/chkhostname.c [deleted file]
tests/libtest/sethostname.c [deleted file]

index 5874b4002210b50a7376a65d253ad93670a0cf1b..71514c86425097c9e1b8e64d34c2a69bd454ed35 100644 (file)
@@ -4064,14 +4064,6 @@ AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
 
 CURL_CHECK_LIB_ARES
 
-if test "x$curl_cv_native_windows" != "xyes" &&
-   test "x$enable_shared" = "xyes"; then
-  build_libhostname=yes
-else
-  build_libhostname=no
-fi
-AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
-
 if test "x$want_ares" != xyes; then
   CURL_CHECK_OPTION_THREADED_RESOLVER
 
index cd111231d90c1c2afb33bcbf14a952f88604e236..7b28421275fcde7c80e50f21f849ac860b4485b7 100644 (file)
  *
  * Note: The function always returns the un-qualified hostname rather
  * than being provider dependent.
- *
- * For libcurl shared library release builds the test suite preloads
- * another shared library named libhostname using the LD_PRELOAD
- * mechanism which intercepts, and might override, the gethostname()
- * function call. In this case a given platform must support the
- * LD_PRELOAD mechanism and additionally have environment variable
- * CURL_GETHOSTNAME set in order to override the returned hostname.
- *
- * For libcurl static library release builds no overriding takes place.
  */
 
 int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen)
@@ -78,9 +69,6 @@ int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen)
 
 #else /* DEBUGBUILD */
 
-  /* The call to system's gethostname() might get intercepted by the
-     libhostname library when libcurl is built as a non-debug shared
-     library when running the test suite. */
   name[0] = '\0';
   err = gethostname(name, namelen);
 
index abebdeda741841a4d67eddce8e6984b3e37909a5..0050b4132cc2cfffcee19431eea378fa6dea8726 100644 (file)
 /* "NTLMSSP" signature is always in ASCII regardless of the platform */
 #define NTLMSSP_SIGNATURE "\x4e\x54\x4c\x4d\x53\x53\x50"
 
-/* The fixed hostname we provide, in order to not leak our real local host
-   name. Copy the name used by Firefox. */
-#define NTLM_HOSTNAME "WORKSTATION"
-
 #if DEBUG_ME
 # define DEBUG_OUT(x) x
 static void ntlm_print_flags(FILE *handle, unsigned long flags)
@@ -490,7 +486,9 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
   unsigned char *ptr_ntresp = &ntresp[0];
   unsigned char *ntlmv2resp = NULL;
   bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE) ? TRUE : FALSE;
-  char host[HOSTNAME_MAX + 1] = "";
+  /* The fixed hostname we provide, in order to not leak our real local host
+     name. Copy the name used by Firefox. */
+  static const char host[] = "WORKSTATION";
   const char *user;
   const char *domain = "";
   size_t hostoff = 0;
@@ -515,21 +513,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
     user = userp;
 
   userlen = strlen(user);
-
-#ifndef NTLM_HOSTNAME
-  /* Get the machine's un-qualified hostname as NTLM does not like the fully
-     qualified domain name */
-  if(Curl_gethostname(host, sizeof(host))) {
-    infof(data, "gethostname() failed, continuing without");
-    hostlen = 0;
-  }
-  else {
-    hostlen = strlen(host);
-  }
-#else
-  (void)msnprintf(host, sizeof(host), "%s", NTLM_HOSTNAME);
-  hostlen = sizeof(NTLM_HOSTNAME)-1;
-#endif
+  hostlen = sizeof(host) - 1;
 
   if(ntlm->flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY) {
     unsigned char ntbuffer[0x18];
index 8ff64d2fb8da148228e6fa3ed66ad35db573e378..3a2125965cfc9774b1c1960440c5cec9e7ef1641 100755 (executable)
@@ -139,13 +139,6 @@ build_all_programs()
         cd libtest || exit 1
         get_make_vars Makefile.inc
 
-        #       Special case: redefine chkhostname compilation parameters.
-
-        # shellcheck disable=SC2034
-        chkhostname_SOURCES=chkhostname.c
-        # shellcheck disable=SC2034
-        chkhostname_LDADD=curl_gethostname.o
-
         # shellcheck disable=SC2153
         build_all_programs "" "${TARGETLIB}/${SRVPGM}"
 )
index 268f367f218a8ce71b5b052d26c78e74ba5f1875..13eaeb3177b56501ceefcaaa5a57276b1040c4c5 100644 (file)
@@ -73,18 +73,9 @@ http
 <name>
 HTTP POST with NTLM authorization and following a 302 redirect
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 http://%HOSTIP:%HTTPPORT/%TESTNUMBER -u testuser:testpass --ntlm -L -d "stuff to send away"
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 # Verify data after the test has been "shot"
index f3c1cfa3dae86732f48f8045b9ea65abc85d62b2..c935a783f0663c3e28e51dd9c7fb7b88ff5a3db7 100644 (file)
@@ -65,10 +65,6 @@ http
 HTTP with NTLM delegation to winbind helper
 </name>
  <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
 # set path to fake_auth instead of real ntlm_auth to generate NTLM type1 and type 3 messages
 CURL_NTLM_WB_FILE=%PWD/server/fake_ntlm
 # set source directory so fake_ntlm can find the test files
@@ -81,9 +77,6 @@ CURL_NTLM_AUTH_TESTNUM=%TESTNUMBER
 <command>
 http://%HOSTIP:%HTTPPORT/%TESTNUMBER -u testuser:anypasswd --ntlm-wb
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 # Verify data after the test has been "shot"
index 887c4795fa69e9a56853b801f77fcee75ce4e78a..cc183855a71ffb3a1b2365454358fbd71df722e1 100644 (file)
@@ -53,18 +53,9 @@ http
 <name>
 HTTP with NTLM authorization when talking HTTP/1.0 (known to fail)
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 http://%HOSTIP:%HTTPPORT/%TESTNUMBER -u testuser:testpass --ntlm -0
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 # Verify data after the test has been "shot"
index e395ece9d6a604ed9c53fb1250dc28a63212b537..759e6828038b4a2bef05d445a5c2260893a7eb91 100644 (file)
@@ -112,18 +112,9 @@ libauthretry
 <name>
 HTTP authorization retry (Basic)
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 http://%HOSTIP:%HTTPPORT/%TESTNUMBER basic basic
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 # Verify data after the test has been "shot"
index 07bf931a2266f7dc140d1223b5013bd97b93be39..915f76919b0c93968a7858174568b8d46d5e546d 100644 (file)
@@ -126,18 +126,9 @@ libauthretry
 <name>
 HTTP authorization retry (Basic switching to Digest)
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 http://%HOSTIP:%HTTPPORT/%TESTNUMBER basic digest
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 # Verify data after the test has been "shot"
index 81d252a3053c449cbddd2ad033fba022ef62583b..96e2ad4963412800b79701a158bb45f852fd12af 100644 (file)
@@ -162,18 +162,9 @@ libauthretry
 <name>
 HTTP authorization retry (Digest switching to Basic)
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 http://%HOSTIP:%HTTPPORT/%TESTNUMBER digest basic
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 # Verify data after the test has been "shot"
index 0a9338777f8afd807aeca03d60a64910890fd245..45baa64bc03554cecfa3b70c47a87cd349c59073 100644 (file)
@@ -185,18 +185,9 @@ libauthretry
 <name>
 HTTP authorization retry (Digest)
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 http://%HOSTIP:%HTTPPORT/%TESTNUMBER digest digest
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 # Verify data after the test has been "shot"
index 382432368dfc1799bcecfbf12323224ad32866c2..1ef3d45c418360847ec44bafaeca30d64fbbc72c 100644 (file)
@@ -34,18 +34,9 @@ SSL
 <name>
 IMAP NTLM graceful cancellation
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 'imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1' -u testuser:testpass
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 #
index e142ca2196dcda04624e0bfeb1778ef375cd36b7..ccdf0d1fdba0441a28850e5fe3f46dff5e4d9249 100644 (file)
@@ -45,18 +45,9 @@ SSL
 <name>
 IMAP NTLM authentication with SASL downgrade
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 'imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1' -u user:secret
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 #
index 25023706241179a9778baa6c640ad14b97b7cc3e..e2cb4b37657077b986fcf174e555fe7f0b732770 100644 (file)
@@ -35,18 +35,9 @@ SSL
 <name>
 POP3 NTLM graceful cancellation
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 pop3://%HOSTIP:%POP3PORT/%TESTNUMBER -u testuser:testpass
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 #
index dfa2e688c6e1765121d5eb0d0e846632114da0c0..21536d81f50b70d6958962f2a04074747ab2355e 100644 (file)
@@ -47,18 +47,9 @@ SSL
 <name>
 POP3 NTLM authentication with SASL downgrade
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 pop3://%HOSTIP:%POP3PORT/%TESTNUMBER -u user:secret
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 #
index 71f3893005a5cd79789ad351645d1e9bb96e6b19..3c25ffa5cafaebd751173129bc38162ac55c3a2f 100644 (file)
@@ -34,18 +34,9 @@ SSL
 <name>
 SMTP NTLM graceful cancellation
 </name>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient@example.com --mail-from sender@example.com -u testuser:testpass -T -
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 #
index f57f63ec86f82557a527d66e595abd8a9bc1970f..723cebca37bb2675c15493c6fc08acf0eba8b321 100644 (file)
@@ -40,18 +40,9 @@ SMTP NTLM authentication with SASL downgrade
 <stdin>
 mail body\r
 </stdin>
- <setenv>
-# we force our own host name, in order to make the test machine independent
-CURL_GETHOSTNAME=curlhost
-# we try to use the LD_PRELOAD hack, if not a debug build
-LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
- </setenv>
 <command>
 smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient@example.com --mail-from sender@example.com -u user:secret -T -
 </command>
-<precheck>
-chkhostname curlhost
-</precheck>
 </client>
 
 #
index 9541d16e17ba923d7ee3630ff5c152a5a2b368ac..2b4dc1a362a345cfdc5473ff50bb62982febd75f 100644 (file)
@@ -2,7 +2,6 @@
 #
 # SPDX-License-Identifier: curl
 
-chkhostname
 lib[1234][0-9][0-9][0-9]
 lib[56][0-9][0-9]
 lib1521.c
index 0e4f4daa29f437f2c7779a60daf49853236209ca..73bc34503403d942a1585457ff84eb4e277b70fb 100644 (file)
@@ -54,25 +54,6 @@ foreach(_target IN LISTS noinst_PROGRAMS)
     PROJECT_LABEL "Test libtest ${_target}")
 endforeach()
 
-# Allows for hostname override to make tests machine independent.
-# TODO: this cmake build assumes a shared build, detect static linking here!
-if(NOT WIN32)
-  add_library(hostname MODULE EXCLUDE_FROM_ALL "sethostname.c")
-  add_dependencies(testdeps hostname)
-  target_include_directories(hostname PRIVATE
-    "${CURL_BINARY_DIR}/lib"  # for "curl_config.h"
-    "${CURL_SOURCE_DIR}/lib"  # for "curl_setup.h"
-  )
-  # Output to .libs for compatibility with autotools, the test data expects a
-  # library at (tests)/libtest/.libs/libhostname.so
-  set_target_properties(hostname PROPERTIES
-    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.libs")
-  if(CURL_HIDES_PRIVATE_SYMBOLS)
-    set_property(TARGET hostname APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
-    set_property(TARGET hostname APPEND PROPERTY COMPILE_FLAGS ${CURL_CFLAG_SYMBOLS_HIDE})
-  endif()
-endif()
-
 add_custom_command(
   OUTPUT "lib1521.c"
   COMMAND ${PERL_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/mk-lib1521.pl" < "${CURL_SOURCE_DIR}/include/curl/curl.h" > "lib1521.c"
index f03a687c1ef3f3bcb1946969aa7ac5ffa819f966..d5b394463f91b39d25210388329a725fdfe30834 100644 (file)
@@ -63,14 +63,7 @@ LDADD = $(SUPPORTFILES_LIBS)
 # noinst_PROGRAMS, lib*_SOURCES, and lib*_CFLAGS)
 include Makefile.inc
 
-# Preloading of libhostname allows host name overriding,
-# this is used to make some tests machine independent.
-
-if BUILD_LIBHOSTNAME
-noinst_LTLIBRARIES = libhostname.la
-else
 noinst_LTLIBRARIES =
-endif
 
 if USE_CPPFLAG_CURL_STATICLIB
 AM_CPPFLAGS += -DCURL_STATICLIB
@@ -79,35 +72,12 @@ endif
 AM_LDFLAGS =
 AM_CFLAGS =
 
-libhostname_la_CPPFLAGS_EXTRA =
-libhostname_la_LDFLAGS_EXTRA = -module -avoid-version -rpath /nowhere
-libhostname_la_CFLAGS_EXTRA =
-
 libstubgss_la_LDFLAGS_EXTRA =
 
 if CURL_LT_SHLIB_USE_NO_UNDEFINED
-libhostname_la_LDFLAGS_EXTRA += -no-undefined
 libstubgss_la_LDFLAGS_EXTRA += -no-undefined
 endif
 
-if CURL_LT_SHLIB_USE_MIMPURE_TEXT
-libhostname_la_LDFLAGS_EXTRA += -mimpure-text
-endif
-
-if DOING_CURL_SYMBOL_HIDING
-libhostname_la_CPPFLAGS_EXTRA += -DCURL_HIDDEN_SYMBOLS
-libhostname_la_CFLAGS_EXTRA += $(CFLAG_CURL_SYMBOL_HIDING)
-endif
-
-libhostname_la_CPPFLAGS = $(AM_CPPFLAGS) $(libhostname_la_CPPFLAGS_EXTRA)
-libhostname_la_LDFLAGS = $(AM_LDFLAGS) $(libhostname_la_LDFLAGS_EXTRA)
-libhostname_la_CFLAGS = $(AM_CFLAGS) $(libhostname_la_CFLAGS_EXTRA)
-
-libhostname_la_SOURCES = sethostname.c
-
-libhostname_la_LIBADD =
-libhostname_la_DEPENDENCIES =
-
 # Build a stub gssapi implementation for testing
 if BUILD_STUB_GSS
 noinst_LTLIBRARIES += libstubgss.la
index 371f26656269219aeb1bd1e321d69b880fb13972..0c1414938a0ffe287f0e3fd6cb7f79dab4aaa681 100644 (file)
@@ -38,7 +38,7 @@ TIMEDIFF = ../../lib/timediff.c ../../lib/timediff.h
 SUPPORTFILES = $(TIMEDIFF) first.c test.h
 
 # These are all libcurl test programs
-noinst_PROGRAMS = chkhostname libauthretry libntlmconnect libprereq      \
+noinst_PROGRAMS = libauthretry libntlmconnect libprereq                  \
  lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507 lib508 lib509   \
  lib510 lib511 lib512 lib513 lib514 lib515 lib516 lib517 lib518 lib519   \
  lib520 lib521 lib523 lib524 lib525 lib526 lib527 lib529 lib530 lib532   \
@@ -80,10 +80,6 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect libprereq      \
  lib3010 lib3025 lib3026 lib3027 \
  lib3100 lib3101 lib3102 lib3103
 
-chkhostname_SOURCES = chkhostname.c ../../lib/curl_gethostname.c
-chkhostname_LDADD = @CURL_NETWORK_LIBS@
-chkhostname_DEPENDENCIES =
-
 libntlmconnect_SOURCES = libntlmconnect.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
 libntlmconnect_LDADD = $(TESTUTIL_LIBS)
 
diff --git a/tests/libtest/chkhostname.c b/tests/libtest/chkhostname.c
deleted file mode 100644 (file)
index e49da13..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-#include "curl_setup.h"
-
-#include "curl_gethostname.h"
-
-#define HOSTNAME_MAX 1024
-
-int main(int argc, char *argv[])
-{
-  char buff[HOSTNAME_MAX];
-  if(argc != 2) {
-    printf("Usage: %s EXPECTED_HOSTNAME\n", argv[0]);
-    return 1;
-  }
-
-  if(Curl_gethostname(buff, HOSTNAME_MAX)) {
-    printf("Curl_gethostname() failed\n");
-    return 1;
-  }
-
-  /* compare the name returned by Curl_gethostname() with the expected one */
-  if(strncmp(buff, argv[1], HOSTNAME_MAX)) {
-    printf("got unexpected host name back, LD_PRELOAD failed\n");
-    return 1;
-  }
-  return 0;
-}
diff --git a/tests/libtest/sethostname.c b/tests/libtest/sethostname.c
deleted file mode 100644 (file)
index 1e07d26..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************
- *                                  _   _ ____  _
- *  Project                     ___| | | |  _ \| |
- *                             / __| | | | |_) | |
- *                            | (__| |_| |  _ <| |___
- *                             \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-#include "curl_setup.h"
-
-/*
- * we force our own host name, in order to make some tests machine independent
- */
-
-int gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen)
-{
-  const char *force_hostname = getenv("CURL_GETHOSTNAME");
-  if(force_hostname) {
-    strncpy(name, force_hostname, namelen);
-    name[namelen-1] = '\0';
-    return 0;
-  }
-
-  /* LD_PRELOAD used, but no hostname set, we'll just return a failure */
-  return -1;
-}