mirror of
https://github.com/curl/curl.git
synced 2026-06-04 08:54:17 +03:00
tests: delete libhostname.so and chkhostname
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
This commit is contained in:
parent
59b419f1a5
commit
09437d8cd4
23 changed files with 5 additions and 307 deletions
|
|
@ -39,15 +39,6 @@
|
|||
*
|
||||
* 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);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,10 +59,6 @@
|
|||
/* "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];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue