1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

NTLM tests: boost coverage by forcing the hostname

A shared library tests/libtest/.libs/lihostname.so is preloaded in NTLM
test-cases to override the system implementation of gethostname().  It
makes it possible to test the NTLM authentication for exact match, and
this way test the implementation of MD4 and DES.

If LD_PRELOAD doesn't work, a debug build willl also workk as debug
builds are now made to prefer a specific environment variable and will
then return that content as host name instead of the actual one.

Kamil wrote the bulk of this, Daniel Stenberg polished it.
This commit is contained in:
Kamil Dudka 2010-07-30 00:47:49 +02:00 committed by Daniel Stenberg
parent 01c309e186
commit b5c3feda17
36 changed files with 481 additions and 176 deletions

View File

@ -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

52
lib/curl_gethostname.c Normal file
View File

@ -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
}

34
lib/curl_gethostname.h Normal file
View File

@ -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 */

View File

@ -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;
}

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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

View File

@ -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

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -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: */*

View File

@ -1,2 +1,2 @@
chkhostname
lib5[0-9][0-9]

View File

@ -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

View File

@ -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)

View File

@ -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;
}

32
tests/libtest/hostname.c Normal file
View File

@ -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;
};

View File

@ -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;
};

View File

@ -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");