aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Makefile.inc4
-rw-r--r--lib/curl_gethostname.c52
-rw-r--r--lib/curl_gethostname.h34
-rw-r--r--lib/http_ntlm.c3
-rw-r--r--lib/smtp.c7
-rw-r--r--tests/data/test100816
-rw-r--r--tests/data/test102116
-rw-r--r--tests/data/test110016
-rw-r--r--tests/data/test15016
-rw-r--r--tests/data/test15516
-rw-r--r--tests/data/test15916
-rw-r--r--tests/data/test16916
-rw-r--r--tests/data/test20916
-rw-r--r--tests/data/test21316
-rw-r--r--tests/data/test23916
-rw-r--r--tests/data/test24316
-rw-r--r--tests/data/test26516
-rw-r--r--tests/data/test26716
-rw-r--r--tests/data/test54716
-rw-r--r--tests/data/test54816
-rw-r--r--tests/data/test5515
-rw-r--r--tests/data/test55514
-rw-r--r--tests/data/test6716
-rw-r--r--tests/data/test6816
-rw-r--r--tests/data/test6916
-rw-r--r--tests/data/test8116
-rw-r--r--tests/data/test8918
-rw-r--r--tests/data/test9018
-rw-r--r--tests/data/test9116
-rw-r--r--tests/libtest/.gitignore2
-rw-r--r--tests/libtest/Makefile.am10
-rw-r--r--tests/libtest/Makefile.inc4
-rw-r--r--tests/libtest/chkhostname.c26
-rw-r--r--tests/libtest/hostname.c32
-rw-r--r--tests/libtest/sethostname.c28
-rwxr-xr-xtests/runtests.pl80
36 files changed, 481 insertions, 176 deletions
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
index 17e2d36e7..bfd3abedc 100644
--- a/lib/Makefile.inc
+++ b/lib/Makefile.inc
@@ -20,7 +20,7 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c \
socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \
curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \
- warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c
+ warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \
@@ -34,5 +34,5 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \
tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h \
curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \
curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \
- warnless.h curl_hmac.h polarssl.h curl_rtmp.h
+ warnless.h curl_hmac.h polarssl.h curl_rtmp.h curl_gethostname.h
diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c
new file mode 100644
index 000000000..5a8c6494b
--- /dev/null
+++ b/lib/curl_gethostname.c
@@ -0,0 +1,52 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2010, 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 http://curl.haxx.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.
+ *
+ ***************************************************************************/
+
+#include "setup.h"
+#include "curl_gethostname.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define GETHOSTNAME_ENV_VAR "CURL_GETHOSTNAME"
+
+int Curl_gethostname(char *name, size_t namelen) {
+#ifdef HAVE_GETHOSTNAME
+
+#ifdef CURLDEBUG
+ /* we check the environment variable only in case of debug build */
+ const char *force_hostname = getenv(GETHOSTNAME_ENV_VAR);
+ if(force_hostname) {
+ strncpy(name, force_hostname, namelen);
+ return 0;
+ }
+#endif
+ /* no override requested */
+ return gethostname(name, namelen);
+
+#else
+ /* no gethostname() available on system, we should always fail */
+ (void) name;
+ (void) namelen;
+ return -1;
+#endif
+}
diff --git a/lib/curl_gethostname.h b/lib/curl_gethostname.h
new file mode 100644
index 000000000..0e393afe4
--- /dev/null
+++ b/lib/curl_gethostname.h
@@ -0,0 +1,34 @@
+#ifndef HEADER_CURL_GETHOSTNAME_H
+#define HEADER_CURL_GETHOSTNAME_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2010, 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 http://curl.haxx.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.
+ *
+ ***************************************************************************/
+
+#include "setup.h"
+
+/* wrapper around gethostname(), which makes it possible to override the
+ * returned value during testing. It reads the value of CURL_GETHOSTNAME
+ * environment variable when built with --enable-curldebug. The function always
+ * returns -1, if gethostname() is not available on system.
+ */
+int Curl_gethostname(char *name, size_t namelen);
+
+#endif /* HEADER_CURL_GETHOSTNAME_H */
diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c
index 0e831ca33..f5b696a69 100644
--- a/lib/http_ntlm.c
+++ b/lib/http_ntlm.c
@@ -58,6 +58,7 @@
#include "curl_base64.h"
#include "http_ntlm.h"
#include "url.h"
+#include "curl_gethostname.h"
#include "curl_memory.h"
#define _MPRINTF_REPLACE /* use our functions only */
@@ -994,7 +995,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
user = userp;
userlen = strlen(user);
- if(gethostname(host, HOSTNAME_MAX)) {
+ if(Curl_gethostname(host, HOSTNAME_MAX)) {
infof(conn->data, "gethostname() failed, continuing without!");
hostlen = 0;
}
diff --git a/lib/smtp.c b/lib/smtp.c
index edc3ff659..1133fe527 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -91,6 +91,7 @@
#include "curl_base64.h"
#include "curl_md5.h"
#include "curl_hmac.h"
+#include "curl_gethostname.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -1110,12 +1111,10 @@ static CURLcode smtp_connect(struct connectdata *conn,
pp->conn = conn;
if(!*path) {
-#ifdef HAVE_GETHOSTNAME
- if(!gethostname(localhost, sizeof localhost))
+ if(!Curl_gethostname(localhost, sizeof localhost))
path = localhost;
else
-#endif
- path = "localhost";
+ path = "localhost";
}
/* url decode the path and use it as domain with EHLO */
diff --git a/tests/data/test1008 b/tests/data/test1008
index 615444686..563a5c030 100644
--- a/tests/data/test1008
+++ b/tests/data/test1008
@@ -86,9 +86,18 @@ NTLM
<name>
HTTP proxy CONNECT auth NTLM with chunked-encoded 407 response
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se:1008/path/10080002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -96,11 +105,6 @@ http://test.remote.haxx.se:1008/path/10080002 --proxy http://%HOSTIP:%HTTPPORT -
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol>
CONNECT test.remote.haxx.se:1008 HTTP/1.1
Host: test.remote.haxx.se:1008
@@ -109,7 +113,7 @@ Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se:1008 HTTP/1.1
Host: test.remote.haxx.se:1008
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=
Proxy-Connection: Keep-Alive
GET /path/10080002 HTTP/1.1
diff --git a/tests/data/test1021 b/tests/data/test1021
index 233cbc4db..0bc8af3cc 100644
--- a/tests/data/test1021
+++ b/tests/data/test1021
@@ -95,9 +95,18 @@ NTLM
<name>
HTTP proxy CONNECT with any proxyauth and proxy offers NTLM and close
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se:1021/path/10210002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-anyauth --proxytunnel
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -105,11 +114,6 @@ http://test.remote.haxx.se:1021/path/10210002 --proxy http://%HOSTIP:%HTTPPORT -
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol>
CONNECT test.remote.haxx.se:1021 HTTP/1.1
Host: test.remote.haxx.se:1021
@@ -122,7 +126,7 @@ Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se:1021 HTTP/1.1
Host: test.remote.haxx.se:1021
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=
Proxy-Connection: Keep-Alive
GET /path/10210002 HTTP/1.1
diff --git a/tests/data/test1100 b/tests/data/test1100
index 40d9f641e..00bd64431 100644
--- a/tests/data/test1100
+++ b/tests/data/test1100
@@ -70,9 +70,18 @@ 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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/1100 -u testuser:testpass --ntlm -L -d "stuff to send away"
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -80,11 +89,6 @@ http://%HOSTIP:%HTTPPORT/1100 -u testuser:testpass --ntlm -L -d "stuff to send a
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
POST /1100 HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -95,7 +99,7 @@ Content-Length: 0
Content-Type: application/x-www-form-urlencoded
POST /1100 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test150 b/tests/data/test150
index 8dcb3621a..fc922e2f2 100644
--- a/tests/data/test150
+++ b/tests/data/test150
@@ -57,9 +57,18 @@ http
<name>
HTTP with NTLM authorization and --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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/150 -u testuser:testpass --ntlm --fail
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -67,11 +76,6 @@ http://%HOSTIP:%HTTPPORT/150 -u testuser:testpass --ntlm --fail
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET /150 HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -80,7 +84,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /150 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test155 b/tests/data/test155
index 5d228db62..53ee1dbbd 100644
--- a/tests/data/test155
+++ b/tests/data/test155
@@ -75,9 +75,18 @@ http
<name>
HTTP PUT with --anyauth authorization (picking NTLM)
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/155 -T log/put155 -u testuser:testpass --anyauth
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
<file name="log/put155">
This is data we upload with PUT
a second line
@@ -91,11 +100,6 @@ four is the number of lines
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
PUT /155 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
@@ -111,7 +115,7 @@ Content-Length: 0
Expect: 100-continue
PUT /155 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.5 (i686-pc-linux-gnu) libcurl/7.10.5 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test159 b/tests/data/test159
index 3b018212a..ede462492 100644
--- a/tests/data/test159
+++ b/tests/data/test159
@@ -56,9 +56,18 @@ http
<name>
HTTP with NTLM authorization when talking HTTP/1.0
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/159 -u testuser:testpass --ntlm -0
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -66,11 +75,6 @@ http://%HOSTIP:%HTTPPORT/159 -u testuser:testpass --ntlm -0
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET /159 HTTP/1.0
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -79,7 +83,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /159 HTTP/1.0
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test169 b/tests/data/test169
index 0ad2f8808..5af7f9f5c 100644
--- a/tests/data/test169
+++ b/tests/data/test169
@@ -81,9 +81,18 @@ NTLM
<name>
HTTP with proxy-requiring-NTLM to site-requiring-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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://data.from.server.requiring.digest.hohoho.com/169 --proxy http://%HOSTIP:%HTTPPORT --proxy-user foo:bar --proxy-ntlm --digest --user digest:alot
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -91,11 +100,6 @@ http://data.from.server.requiring.digest.hohoho.com/169 --proxy http://%HOSTIP:%
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAAAwADAHAAAAA).*/$1/
-</strippart>
<protocol>
GET http://data.from.server.requiring.digest.hohoho.com/169 HTTP/1.1
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -105,7 +109,7 @@ Accept: */*
Proxy-Connection: Keep-Alive
GET http://data.from.server.requiring.digest.hohoho.com/169 HTTP/1.1
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAAAwADAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAAAwADAHAAAAAIAAgAcwAAAAAAAAAAAAAABoKBAIP6B+XVQ6vQsx3DfDXUVhd9436GAxPu0IYcl2Z7LxHmNeOAWQ+vxUmhuCFJBUgXCWZvb2N1cmxob3N0
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.3
Host: data.from.server.requiring.digest.hohoho.com
Accept: */*
diff --git a/tests/data/test209 b/tests/data/test209
index ef372c4de..e27b6e38b 100644
--- a/tests/data/test209
+++ b/tests/data/test209
@@ -79,9 +79,18 @@ NTLM
<name>
HTTP proxy CONNECT auth NTLM
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se:209/path/2090002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -89,11 +98,6 @@ http://test.remote.haxx.se:209/path/2090002 --proxy http://%HOSTIP:%HTTPPORT --p
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol>
CONNECT test.remote.haxx.se:209 HTTP/1.1
Host: test.remote.haxx.se:209
@@ -102,7 +106,7 @@ Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se:209 HTTP/1.1
Host: test.remote.haxx.se:209
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=
Proxy-Connection: Keep-Alive
GET /path/2090002 HTTP/1.1
diff --git a/tests/data/test213 b/tests/data/test213
index 801d9e7ad..8bab38783 100644
--- a/tests/data/test213
+++ b/tests/data/test213
@@ -79,9 +79,18 @@ NTLM
<name>
HTTP 1.0 proxy CONNECT auth NTLM and then POST
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se:213/path/2130002 --proxy1.0 http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel -d "postit"
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -89,11 +98,6 @@ http://test.remote.haxx.se:213/path/2130002 --proxy1.0 http://%HOSTIP:%HTTPPORT
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol nonewline="yes">
CONNECT test.remote.haxx.se:213 HTTP/1.0
Host: test.remote.haxx.se:213
@@ -102,7 +106,7 @@ Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se:213 HTTP/1.0
Host: test.remote.haxx.se:213
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=
Proxy-Connection: Keep-Alive
POST /path/2130002 HTTP/1.1
diff --git a/tests/data/test239 b/tests/data/test239
index 2674b8e3a..e88908989 100644
--- a/tests/data/test239
+++ b/tests/data/test239
@@ -56,9 +56,18 @@ NTLM
<name>
HTTP proxy-auth NTLM and then POST
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/239 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm -d "postit"
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -66,11 +75,6 @@ http://%HOSTIP:%HTTPPORT/239 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol nonewline="yes">
POST http://%HOSTIP:%HTTPPORT/239 HTTP/1.1
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -82,7 +86,7 @@ Content-Length: 0
Content-Type: application/x-www-form-urlencoded
POST http://%HOSTIP:%HTTPPORT/239 HTTP/1.1
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test243 b/tests/data/test243
index f24fd7717..3effb8202 100644
--- a/tests/data/test243
+++ b/tests/data/test243
@@ -77,9 +77,18 @@ NTLM
<name>
HTTP POST with --proxy-anyauth, picking NTLM
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/243 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-anyauth -d "postit"
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -87,11 +96,6 @@ http://%HOSTIP:%HTTPPORT/243 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol nonewline="yes">
POST http://%HOSTIP:%HTTPPORT/243 HTTP/1.1
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
@@ -111,7 +115,7 @@ Content-Length: 0
Content-Type: application/x-www-form-urlencoded
POST http://%HOSTIP:%HTTPPORT/243 HTTP/1.1
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test265 b/tests/data/test265
index bd8a24c0a..e47dbe8e7 100644
--- a/tests/data/test265
+++ b/tests/data/test265
@@ -82,9 +82,18 @@ NTLM
<name>
HTTP proxy CONNECT auth NTLM and then POST, response-body in the 407
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se:265/path/2650002 --proxy http://%HOSTIP:%HTTPPORT --proxy-user silly:person --proxy-ntlm --proxytunnel -d "postit"
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -92,11 +101,6 @@ http://test.remote.haxx.se:265/path/2650002 --proxy http://%HOSTIP:%HTTPPORT --p
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol nonewline="yes">
CONNECT test.remote.haxx.se:265 HTTP/1.1
Host: test.remote.haxx.se:265
@@ -105,7 +109,7 @@ Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se:265 HTTP/1.1
Host: test.remote.haxx.se:265
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAKAeQjzKtCQ7ubW8S6MN7B59436GAxPu0CVROwwNBsgxML49gcbAXLT/bU+H5wrS9XNpbGx5Y3VybGhvc3Q=
Proxy-Connection: Keep-Alive
POST /path/2650002 HTTP/1.1
diff --git a/tests/data/test267 b/tests/data/test267
index 4e356b685..aa61b357b 100644
--- a/tests/data/test267
+++ b/tests/data/test267
@@ -63,9 +63,18 @@ http
<name>
HTTP POST with NTLM authorization and added custom headers
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/267 -u testuser:testpass --ntlm -d "data" -H "Header1: yes" -H "Header2: no"
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -73,11 +82,6 @@ http://%HOSTIP:%HTTPPORT/267 -u testuser:testpass --ntlm -d "data" -H "Header1:
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol nonewline="yes">
POST /267 HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -90,7 +94,7 @@ Content-Length: 0
Content-Type: application/x-www-form-urlencoded
POST /267 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test547 b/tests/data/test547
index d2e9d9ea1..8ac0c9dd5 100644
--- a/tests/data/test547
+++ b/tests/data/test547
@@ -80,9 +80,18 @@ NTLM
<name>
HTTP proxy auth NTLM with POST data from read callback
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se/path/547 http://%HOSTIP:%HTTPPORT s1lly:pers0n
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -90,11 +99,6 @@ http://test.remote.haxx.se/path/547 http://%HOSTIP:%HTTPPORT s1lly:pers0n
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol>
POST http://test.remote.haxx.se/path/547 HTTP/1.1
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
@@ -115,7 +119,7 @@ Content-Length: 0
Content-Type: application/x-www-form-urlencoded
POST http://test.remote.haxx.se/path/547 HTTP/1.1
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAIYrD1xJmhNBNL9fLzuk9PV9436GAxPu0EKWzqQ/sZDVLXnp1JrySgl8A+cibE6z4HMxbGx5Y3VybGhvc3Q=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Host: test.remote.haxx.se
Accept: */*
diff --git a/tests/data/test548 b/tests/data/test548
index 215b44fd9..d811fcaeb 100644
--- a/tests/data/test548
+++ b/tests/data/test548
@@ -80,9 +80,18 @@ NTLM
<name>
HTTP proxy auth NTLM with POST data from CURLOPT_POSTFIELDS
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se/path/548 http://%HOSTIP:%HTTPPORT s1lly:pers0n
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -90,11 +99,6 @@ http://test.remote.haxx.se/path/548 http://%HOSTIP:%HTTPPORT s1lly:pers0n
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol>
POST http://test.remote.haxx.se/path/548 HTTP/1.1
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
@@ -115,7 +119,7 @@ Content-Length: 0
Content-Type: application/x-www-form-urlencoded
POST http://test.remote.haxx.se/path/548 HTTP/1.1
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAIYrD1xJmhNBNL9fLzuk9PV9436GAxPu0EKWzqQ/sZDVLXnp1JrySgl8A+cibE6z4HMxbGx5Y3VybGhvc3Q=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Host: test.remote.haxx.se
Accept: */*
diff --git a/tests/data/test551 b/tests/data/test551
index 28b5af5a7..8027d91cf 100644
--- a/tests/data/test551
+++ b/tests/data/test551
@@ -75,11 +75,6 @@ http://test.remote.haxx.se/path/551 http://%HOSTIP:%HTTPPORT s1lly:pers0n
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
-</strippart>
<protocol>
POST http://test.remote.haxx.se/path/551 HTTP/1.1
Host: test.remote.haxx.se
diff --git a/tests/data/test555 b/tests/data/test555
index d433569c0..74dc210b1 100644
--- a/tests/data/test555
+++ b/tests/data/test555
@@ -85,9 +85,18 @@ NTLM
<name>
HTTP proxy auth NTLM with POST data from read callback multi-if
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://test.remote.haxx.se/path/555 http://%HOSTIP:%HTTPPORT s1lly:pers0n
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -95,10 +104,7 @@ http://test.remote.haxx.se/path/555 http://%HOSTIP:%HTTPPORT s1lly:pers0n
<strip>
^User-Agent: curl/.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
<strippart>
-s/^(Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA).*/$1/
# remove CR that CURLOPT_TRANSFERTEXT added, when CharConv enabled:
s/^(this is the blurb we want to upload)\r\n/$1\n/ if($has_charconv)
</strippart>
@@ -122,7 +128,7 @@ Content-Length: 0
Content-Type: application/x-www-form-urlencoded
POST http://test.remote.haxx.se/path/555 HTTP/1.1
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAABQAFAHAAAAAIAAgAdQAAAAAAAAAAAAAABoKBAIYrD1xJmhNBNL9fLzuk9PV9436GAxPu0EKWzqQ/sZDVLXnp1JrySgl8A+cibE6z4HMxbGx5Y3VybGhvc3Q=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Host: test.remote.haxx.se
Accept: */*
diff --git a/tests/data/test67 b/tests/data/test67
index 46d120b13..d6d60efe7 100644
--- a/tests/data/test67
+++ b/tests/data/test67
@@ -63,9 +63,18 @@ http
<name>
HTTP with NTLM authorization
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/67 -u testuser:testpass --ntlm
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -73,11 +82,6 @@ http://%HOSTIP:%HTTPPORT/67 -u testuser:testpass --ntlm
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET /67 HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -86,7 +90,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /67 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test68 b/tests/data/test68
index 9cceaf7a2..5b79a7a98 100644
--- a/tests/data/test68
+++ b/tests/data/test68
@@ -62,9 +62,18 @@ http
<name>
HTTP with NTLM authorization and wrong password
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/68 -u testuser:testpass --ntlm
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -72,11 +81,6 @@ http://%HOSTIP:%HTTPPORT/68 -u testuser:testpass --ntlm
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET /68 HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -85,7 +89,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /68 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test69 b/tests/data/test69
index 1bf0f735f..d6b8de62c 100644
--- a/tests/data/test69
+++ b/tests/data/test69
@@ -79,9 +79,18 @@ http
<name>
HTTP with NTLM, Basic or Wild-and-crazy authorization
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/69 -u testuser:testpass --anyauth
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -89,11 +98,6 @@ http://%HOSTIP:%HTTPPORT/69 -u testuser:testpass --anyauth
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET /69 HTTP/1.1
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
@@ -107,7 +111,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /69 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test81 b/tests/data/test81
index 9a12cc1a7..47b37e963 100644
--- a/tests/data/test81
+++ b/tests/data/test81
@@ -62,9 +62,18 @@ http
<name>
HTTP with proxy using NTLM authorization
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/81 --proxy-user testuser:testpass -x http://%HOSTIP:%HTTPPORT --proxy-ntlm
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -72,11 +81,6 @@ http://%HOSTIP:%HTTPPORT/81 --proxy-user testuser:testpass -x http://%HOSTIP:%HT
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET http://%HOSTIP:%HTTPPORT/81 HTTP/1.1
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -86,7 +90,7 @@ Accept: */*
Proxy-Connection: Keep-Alive
GET http://%HOSTIP:%HTTPPORT/81 HTTP/1.1
-Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test89 b/tests/data/test89
index 06effd1b7..3512fbe55 100644
--- a/tests/data/test89
+++ b/tests/data/test89
@@ -96,9 +96,18 @@ http
<name>
HTTP with NTLM and follow-location
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/89 -u testuser:testpass --ntlm -L
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -106,11 +115,6 @@ http://%HOSTIP:%HTTPPORT/89 -u testuser:testpass --ntlm -L
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET /89 HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
@@ -119,7 +123,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /89 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
@@ -131,7 +135,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /you/890010 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.8-pre1 (i686-pc-linux-gnu) libcurl/7.10.8-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3 GSS
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test90 b/tests/data/test90
index 387608b5b..55c98f4a0 100644
--- a/tests/data/test90
+++ b/tests/data/test90
@@ -134,9 +134,18 @@ http
<name>
HTTP with NTLM via --anyauth, and then follow-location with NTLM again
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/90 -u testuser:testpass --anyauth -L
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -144,11 +153,6 @@ http://%HOSTIP:%HTTPPORT/90 -u testuser:testpass --anyauth -L
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA).*/$1/
-</strippart>
<protocol>
GET /90 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
@@ -161,7 +165,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /90 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
@@ -177,7 +181,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /you/900010 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=
User-Agent: curl/7.10.8-pre1 (i686-pc-linux-gnu) libcurl/7.10.8-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3 GSS
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/data/test91 b/tests/data/test91
index e3b81b3b4..90ace92ed 100644
--- a/tests/data/test91
+++ b/tests/data/test91
@@ -80,9 +80,18 @@ http
<name>
HTTP with NTLM/Negotiate/Basic, anyauth and user with domain, with size 0
</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=./libtest/.libs/libhostname.so
+ </setenv>
<command>
http://%HOSTIP:%HTTPPORT/91 --anyauth -u mydomain\\myself:secret
</command>
+<precheck>
+chkhostname curlhost
+</precheck>
</client>
# Verify data after the test has been "shot"
@@ -90,11 +99,6 @@ http://%HOSTIP:%HTTPPORT/91 --anyauth -u mydomain\\myself:secret
<strip>
^User-Agent:.*
</strip>
-# We strip off a large chunk of the type-2 NTLM message since it depends on
-# the local host name and thus differs on different machines!
-<strippart>
-s/^(Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAgACABwAAAABgAGAHgAAAA).*/$1/
-</strippart>
<protocol>
GET /91 HTTP/1.1
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
@@ -108,7 +112,7 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /91 HTTP/1.1
-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAgACABwAAAABgAGAHgAAAA
+Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAgACABwAAAABgAGAHgAAAAIAAgAfgAAAAAAAAAAAAAABoKBAMIyJpR5mHpg2FZha5kRaFZ9436GAxPu0C5llxexSQ5QzVkiLSfkcpVyRgCXXqR+Am15ZG9tYWlubXlzZWxmY3VybGhvc3Q=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Host: %HOSTIP:%HTTPPORT
Accept: */*
diff --git a/tests/libtest/.gitignore b/tests/libtest/.gitignore
index 3311a821e..cabcb671c 100644
--- a/tests/libtest/.gitignore
+++ b/tests/libtest/.gitignore
@@ -1,2 +1,2 @@
+chkhostname
lib5[0-9][0-9]
-
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index 70b0f12a4..2a0e3eaa4 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -53,6 +53,16 @@ endif
EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl \
test1022.pl Makefile.inc
+if STATICLIB
+# this means no shared option is enabled so we can disable the LD_PRELOAD
+# attempt
+libhostname_la_CFLAGS = -DDISABLE_PRELOAD
+endif
+
+# we force our own host name, in order to make some tests machine independent
+lib_LTLIBRARIES = libhostname.la
+libhostname_la_SOURCES = sethostname.c
+
# Dependencies (may need to be overriden)
LDADD = $(top_builddir)/lib/libcurl.la
DEPENDENCIES = $(top_builddir)/lib/libcurl.la
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index 814c01e6c..28ed6831c 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -12,7 +12,9 @@ noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \
lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 \
lib544 lib545 lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 \
lib539 lib557 lib558 lib559 lib560 lib562 lib564 lib565 lib566 lib567 \
- lib568 lib569 lib570 lib571 lib572 lib573
+ lib568 lib569 lib570 lib571 lib572 lib573 chkhostname
+
+chkhostname_SOURCES = chkhostname.c $(top_srcdir)/lib/curl_gethostname.c
lib500_SOURCES = lib500.c $(SUPPORTFILES)
diff --git a/tests/libtest/chkhostname.c b/tests/libtest/chkhostname.c
new file mode 100644
index 000000000..686eb471a
--- /dev/null
+++ b/tests/libtest/chkhostname.c
@@ -0,0 +1,26 @@
+#include "curl_gethostname.h"
+
+#include <stdio.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/hostname.c b/tests/libtest/hostname.c
new file mode 100644
index 000000000..ca7fccaf8
--- /dev/null
+++ b/tests/libtest/hostname.c
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+#define HOSTNAME "curlhost"
+#define HOSTNAME_LEN sizeof(HOSTNAME)
+
+/*
+ * we force our own host name, in order to make some tests machine independent
+ */
+int gethostname(char *name, size_t namelen) {
+ char buff[HOSTNAME_LEN + /* terminating zero */ 1];
+ size_t max = (namelen < HOSTNAME_LEN)
+ ? namelen
+ : HOSTNAME_LEN;
+
+ if(!name || !namelen)
+ return -1;
+
+ strcpy(buff, HOSTNAME);
+ buff[max - 1] = '\0';
+ strcpy(name, buff);
+ return 0;
+};
diff --git a/tests/libtest/sethostname.c b/tests/libtest/sethostname.c
new file mode 100644
index 000000000..667f689ae
--- /dev/null
+++ b/tests/libtest/sethostname.c
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define GETHOSTNAME_ENV_VAR "CURL_GETHOSTNAME"
+
+/*
+ * we force our own host name, in order to make some tests machine independent
+ */
+int gethostname(char *name, size_t namelen) {
+ const char *force_hostname = getenv(GETHOSTNAME_ENV_VAR);
+ if(force_hostname) {
+ strncpy(name, force_hostname, namelen);
+ return 0;
+ }
+
+ /* LD_PRELOAD used, but no hostname set, we'll just return a failure */
+ return -1;
+};
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 6abca9fce..8bb5d69e9 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -148,6 +148,7 @@ my $SERVER2IN="$LOGDIR/server2.input"; # what curl sent the second server
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy ftp server instructions here
my $SERVERLOGS_LOCK="$LOGDIR/serverlogs.lock"; # server logs advisor read lock
+my $CURLCONFIG="../curl-config"; # curl-config from current build
# Normally, all test cases should be run, but at times it is handy to
# simply run a particular one:
@@ -204,6 +205,8 @@ my $has_nss; # built with NSS
my $has_yassl; # built with yassl
my $has_polarssl;# built with polarssl
+my $has_shared; # built shared
+
my $ssllib; # name of the lib we use (for human presentation)
my $has_crypto; # set if libcurl is built with cryptographic support
my $has_textaware; # set if running on a system that has a text mode concept
@@ -436,7 +439,8 @@ sub startnew {
sub checkcmd {
my ($cmd)=@_;
my @paths=(split(":", $ENV{'PATH'}), "/usr/sbin", "/usr/local/sbin",
- "/sbin", "/usr/bin", "/usr/local/bin" );
+ "/sbin", "/usr/bin", "/usr/local/bin",
+ "./libtest/.libs", "./libtest");
for(@paths) {
if( -x "$_/$cmd" && ! -d "$_/$cmd") {
# executable bit but not a directory!
@@ -2042,6 +2046,9 @@ sub checksystem {
die "can't run torture tests since curl was not built with curldebug";
}
+ $has_shared = `sh $CURLCONFIG --built-shared`;
+ chomp $has_shared;
+
# curl doesn't list cryptographic support separately, so assume it's
# always available
$has_crypto=1;
@@ -2064,8 +2071,9 @@ sub checksystem {
logmsg sprintf(" HTTP IPv6 %s\n", $http_ipv6?"ON ":"OFF");
logmsg sprintf("* FTP IPv6 %8s", $ftp_ipv6?"ON ":"OFF");
logmsg sprintf(" Libtool lib: %s\n", $libtool?"ON ":"OFF");
+ logmsg sprintf("* Shared build: %s\n", $has_shared);
if($ssl_version) {
- logmsg sprintf("* SSL library: %s\n", $ssllib);
+ logmsg sprintf("* SSL library: %13s\n", $ssllib);
}
logmsg "* Ports:\n";
@@ -2350,13 +2358,59 @@ sub singletest {
# timestamp required servers verification end
$timesrvrend{$testnum} = Time::HiRes::time() if($timestats);
+ # test definition may instruct to (un)set environment vars
+ # this is done this early, so that the precheck can use environment
+ # variables and still bail out fine on errors
+ my %oldenv;
+ my @setenv = getpart("client", "setenv");
+ if(@setenv) {
+ foreach my $s (@setenv) {
+ chomp $s;
+ subVariables \$s;
+ if($s =~ /([^=]*)=(.*)/) {
+ my ($var, $content) = ($1, $2);
+ # remember current setting, to restore it once test runs
+ $oldenv{$var} = ($ENV{$var})?"$ENV{$var}":'notset';
+ # set new value
+ if(!$content) {
+ delete $ENV{$var} if($ENV{$var});
+ }
+ else {
+ if(($has_shared ne "yes") && ($var =~ /^LD_PRELOAD/)) {
+ # print "Skipping LD_PRELOAD due to no shared build\n";
+ next;
+ }
+ $ENV{$var} = "$content";
+ }
+ }
+ }
+ }
+
if(!$why) {
+ # TODO:
+ # Add a precheck cache. If a precheck command was already invoked
+ # exactly like this, then use the previous result to speed up
+ # successive test invokes!
+
my @precheck = getpart("client", "precheck");
if(@precheck) {
$cmd = $precheck[0];
chomp $cmd;
subVariables \$cmd;
if($cmd) {
+ my @p = split(/ /, $cmd);
+ if($p[0] !~ /\//) {
+ # the first word, the command, does not contain a slash so
+ # we will scan the "improved" PATH to find the command to
+ # be able to run it
+ my $fullp = checktestcmd($p[0]);
+
+ if($fullp) {
+ $p[0] = $fullp;
+ }
+ $cmd = join(" ", @p);
+ }
+
my @o = `$cmd 2>/dev/null`;
if($o[0]) {
$why = $o[0];
@@ -2453,28 +2507,6 @@ sub singletest {
writearray($FTPDCMD, \@ftpservercmd);
}
- # test definition may instruct to (un)set environment vars
- my %oldenv;
- my @setenv = getpart("client", "setenv");
- if(@setenv) {
- foreach my $s (@setenv) {
- chomp $s;
- subVariables \$s;
- if($s =~ /([^=]*)=(.*)/) {
- my ($var, $content) = ($1, $2);
- # remember current setting, to restore it once test runs
- $oldenv{$var} = ($ENV{$var})?"$ENV{$var}":'notset';
- # set new value
- if(!$content) {
- delete $ENV{$var} if($ENV{$var});
- }
- else {
- $ENV{$var} = "$content";
- }
- }
- }
- }
-
# get the command line options to use
my @blaha;
($cmd, @blaha)= getpart("client", "command");