Skip to content

Commit

Permalink
Merge 4dfaf4e into f8548e8
Browse files Browse the repository at this point in the history
  • Loading branch information
iboukris committed Sep 8, 2017
2 parents f8548e8 + 4dfaf4e commit 230e429
Show file tree
Hide file tree
Showing 11 changed files with 827 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ addons:
- stunnel4
- libidn2-0-dev
- libssh2-1-dev
- krb5-user

matrix:
include:
- os: linux
compiler: gcc
dist: trusty
env: T=normal
env: T=normal C=--with-gssapi
- os: linux
compiler: gcc
dist: trusty
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,13 @@ else
CPPFLAGS="$save_CPPFLAGS"
fi

build_libstubgss=no
if test x"$want_gss" = "xyes"; then
build_libstubgss=yes
fi

AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")

dnl -------------------------------------------------------------
dnl parse --with-default-ssl-backend so it can be validated below
dnl -------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions tests/FILEFORMAT
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ B) The request was HTTP and included digest details, which adds 1000 to NUM
C) If a HTTP request is NTLM type-1, it adds 1001 to num
D) If a HTTP request is NTLM type-3, it adds 1002 to num
E) If a HTTP request is Basic and num is already >=1000, it adds 1 to num
F) If a HTTP request is Negotiate, num gets incremented by one for each
request with Negotiate authorization header on the same test case.

Dynamically changing num in this way allows the test harness to be used to
test authentication negotiation where several different requests must be sent
Expand Down Expand Up @@ -243,6 +245,7 @@ threaded-resolver
unittest
unix-sockets
WinSSL
ld_preload

as well as each protocol that curl supports. A protocol only needs to be
specified if it is different from the server (useful when the server
Expand Down
3 changes: 2 additions & 1 deletion tests/data/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,5 @@ test2016 test2017 test2018 test2019 test2020 test2021 test2022 test2023 \
test2024 test2025 test2026 test2027 test2028 test2029 test2030 test2031 \
test2032 test2033 test2034 test2035 test2036 test2037 test2038 test2039 \
test2040 test2041 test2042 test2043 test2044 test2045 test2046 test2047 \
test2048 test2049 test2050 test2051 test2052 test2053 test2054 test2055
test2048 test2049 test2050 test2051 test2052 test2053 test2054 test2055 \
test2056 test2057
87 changes: 87 additions & 0 deletions tests/data/test2056
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
HTTP Negotiate auth (stub krb5)
</keywords>
</info>
# Server-side
<reply>
<!-- First request, expect 401 Negotiate -->
<data>
HTTP/1.1 401 Authorization Required
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate
Content-Length: 13

Not yet sir!
</data>
<!-- Second request, expect success in one shot -->
<data1>
HTTP/1.1 200 Things are fine in server land
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate RA==
Content-Length: 15

Nice auth sir!
</data1>
<datacheck>
HTTP/1.1 401 Authorization Required
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate
Content-Length: 13

HTTP/1.1 200 Things are fine in server land
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate RA==
Content-Length: 15

Nice auth sir!
</datacheck>
</reply>

# Client-side
<client>
<server>
http
</server>
<name>
HTTP Negotiate authentication (stub krb5)
</name>
<features>
GSS-API
ld_preload
!debug
</features>
<setenv>
LD_PRELOAD=%PWD/libtest/.libs/libstubgss.so
CURL_STUB_GSS_CREDS="KRB5_Alice"
</setenv>
<command>
-u: --negotiate http://%HOSTIP:%HTTPPORT/2056
</command>
</client>

# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2056 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*

GET /2056 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Negotiate IktSQjVfQWxpY2UiOkhUVFBAMTI3LjAuMC4xOjE6QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQ==
Accept: */*

</protocol>
</verify>
</testcase>
108 changes: 108 additions & 0 deletions tests/data/test2057
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
HTTP Negotiate auth (stub ntlm)
</keywords>
</info>
# Server-side
<reply>
<!-- First request, expect 401 Negotiate -->
<data>
HTTP/1.1 401 Authorization Required
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate
Content-Length: 13

Not yet sir!
</data>
<!-- Second request, expect 401 (ntlm challenge) -->
<data1>
HTTP/1.1 401 Authorization Required
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate Qw==
Content-Length: 19

Still not yet sir!
</data1>
<!-- Third request, expect success -->
<data2>
HTTP/1.1 200 Things are fine in server land
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate RA==
Content-Length: 15

Nice auth sir!
</data2>
<datacheck>
HTTP/1.1 401 Authorization Required
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate
Content-Length: 13

HTTP/1.1 401 Authorization Required
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate Qw==
Content-Length: 19

HTTP/1.1 200 Things are fine in server land
Server: Microsoft-IIS/7.0
Content-Type: text/html; charset=iso-8859-1
WWW-Authenticate: Negotiate RA==
Content-Length: 15

Nice auth sir!
</datacheck>
</reply>

# Client-side
<client>
<server>
http
</server>
<name>
HTTP Negotiate authentication (stub ntlm)
</name>
<features>
GSS-API
ld_preload
!debug
</features>
<setenv>
LD_PRELOAD=%PWD/libtest/.libs/libstubgss.so
CURL_STUB_GSS_CREDS="NTLM_Alice"
</setenv>
<command>
-u: --negotiate http://%HOSTIP:%HTTPPORT/2057
</command>
</client>

# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2057 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*

GET /2057 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Negotiate Ik5UTE1fQWxpY2UiOkhUVFBAMTI3LjAuMC4xOjI6QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQ==
Accept: */*

GET /2057 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Negotiate Ik5UTE1fQWxpY2UiOkhUVFBAMTI3LjAuMC4xOjM6QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQ==
Accept: */*

</protocol>
</verify>
</testcase>
15 changes: 15 additions & 0 deletions tests/libtest/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ libhostname_la_SOURCES = sethostname.c sethostname.h
libhostname_la_LIBADD =
libhostname_la_DEPENDENCIES =

# Build a stub gssapi implementation for testing
if BUILD_STUB_GSS
noinst_LTLIBRARIES += libstubgss.la

libstubgss_la_CPPFLAGS = $(AM_CPPFLAGS)
libstubgss_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version -rpath /nowhere
libstubgss_la_CFLAGS = $(AM_CFLAGS) -g -Wno-unused-parameter

libstubgss_la_SOURCES = stub_gssapi.c stub_gssapi.h

libstubgss_la_LIBADD =
libstubgss_la_DEPENDENCIES =
endif


lib1521.c: $(top_srcdir)/tests/libtest/mk-lib1521.pl $(top_srcdir)/include/curl/curl.h
@PERL@ $(top_srcdir)/tests/libtest/mk-lib1521.pl < $(top_srcdir)/include/curl/curl.h > lib1521.c

Expand Down

0 comments on commit 230e429

Please sign in to comment.