aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-07-11 09:37:18 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-07-16 17:26:08 +0200
commit9ad282b1ae1135e7d5dd2e466ff8671c1e4ee04b (patch)
tree20fda8058835d883461c231ff5297d5c99d43718 /lib
parent223612afa213cb013f380c9c51b8c503e858bf5c (diff)
Remove all traces of FBOpenSSL SPNEGO support
This is just fundamentally broken. SPNEGO (RFC4178) is a protocol which allows client and server to negotiate the underlying mechanism which will actually be used to authenticate. This is *often* Kerberos, and can also be NTLM and other things. And to complicate matters, there are various different OIDs which can be used to specify the Kerberos mechanism too. A SPNEGO exchange will identify *which* GSSAPI mechanism is being used, and will exchange GSSAPI tokens which are appropriate for that mechanism. But this SPNEGO implementation just strips the incoming SPNEGO packet and extracts the token, if any. And completely discards the information about *which* mechanism is being used. Then we *assume* it was Kerberos, and feed the token into gss_init_sec_context() with the default mechanism (GSS_S_NO_OID for the mech_type argument). Furthermore... broken as this code is, it was never even *used* for input tokens anyway, because higher layers of curl would just bail out if the server actually said anything *back* to us in the negotiation. We assume that we send a single token to the server, and it accepts it. If the server wants to continue the exchange (as is required for NTLM and for SPNEGO to do anything useful), then curl was broken anyway. So the only bit which actually did anything was the bit in Curl_output_negotiate(), which always generates an *initial* SPNEGO token saying "Hey, I support only the Kerberos mechanism and this is its token". You could have done that by manually just prefixing the Kerberos token with the appropriate bytes, if you weren't going to do any proper SPNEGO handling. There's no need for the FBOpenSSL library at all. The sane way to do SPNEGO is just to *ask* the GSSAPI library to do SPNEGO. That's what the 'mech_type' argument to gss_init_sec_context() is for. And then it should all Just Work™. That 'sane way' will be added in a subsequent patch, as will bug fixes for our failure to handle any exchange other than a single outbound token to the server which results in immediate success.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.Watcom4
-rw-r--r--lib/Makefile.m323
-rw-r--r--lib/Makefile.netware7
-rw-r--r--lib/config-dos.h1
-rw-r--r--lib/config-symbian.h3
-rw-r--r--lib/config-tpf.h3
-rw-r--r--lib/config-vxworks.h3
-rw-r--r--lib/curl_config.h.cmake3
-rw-r--r--lib/http_negotiate.c106
-rw-r--r--lib/version.c3
10 files changed, 2 insertions, 134 deletions
diff --git a/lib/Makefile.Watcom b/lib/Makefile.Watcom
index 832ca01fe..51de107ea 100644
--- a/lib/Makefile.Watcom
+++ b/lib/Makefile.Watcom
@@ -60,7 +60,7 @@ SYS_INCL = -I"$(%watcom)/h/nt" -I"$(%watcom)/h"
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
-wcd=201 -bt=nt -d+ -dWIN32 -dCURL_WANTS_CA_BUNDLE_ENV &
- -dBUILDING_LIBCURL -dHAVE_SPNEGO=1 -I. -I"../include" $(SYS_INCL)
+ -dBUILDING_LIBCURL -I. -I"../include" $(SYS_INCL)
!ifdef %debug
DEBUG = -dDEBUG=1 -dDEBUGBUILD
@@ -248,4 +248,4 @@ $(RESOURCE): libcurl.rc
.c{$(OBJ_STAT)}.obj:
$(CC) $(CFLAGS) -DCURL_STATICLIB $[@ -fo=$^@
- \ No newline at end of file
+
diff --git a/lib/Makefile.m32 b/lib/Makefile.m32
index afe3982dc..6b4c94a3d 100644
--- a/lib/Makefile.m32
+++ b/lib/Makefile.m32
@@ -137,9 +137,6 @@ endif
ifeq ($(findstring -sspi,$(CFG)),-sspi)
SSPI = 1
endif
-ifeq ($(findstring -spnego,$(CFG)),-spnego)
-SPNEGO = 1
-endif
ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
LDAPS = 1
endif
diff --git a/lib/Makefile.netware b/lib/Makefile.netware
index bafd32ffa..94c298e2b 100644
--- a/lib/Makefile.netware
+++ b/lib/Makefile.netware
@@ -217,9 +217,6 @@ endif
ifeq ($(findstring -idn,$(CFG)),-idn)
WITH_IDN = 1
endif
-ifeq ($(findstring -spnego,$(CFG)),-spnego)
-WITH_SPNEGO = 1
-endif
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
ENABLE_IPV6 = 1
endif
@@ -247,10 +244,6 @@ ifdef WITH_SSL
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
IMPORTS += GetProcessSwitchCount RunningProcess
INSTDEP += ca-bundle.crt
-ifdef WITH_SPNEGO
- INCLUDES += -I$(FBOPENSSL_PATH)/include
- LDLIBS += $(FBOPENSSL_PATH)/nw/fbopenssl.$(LIBEXT)
-endif
else
ifdef WITH_AXTLS
INCLUDES += -I$(AXTLS_PATH)/inc
diff --git a/lib/config-dos.h b/lib/config-dos.h
index cce5e8106..dd5b06db4 100644
--- a/lib/config-dos.h
+++ b/lib/config-dos.h
@@ -69,7 +69,6 @@
#define HAVE_SETMODE 1
#define HAVE_SIGNAL 1
#define HAVE_SOCKET 1
-#define HAVE_SPNEGO 1
#define HAVE_STRDUP 1
#define HAVE_STRICMP 1
#define HAVE_STRTOLL 1
diff --git a/lib/config-symbian.h b/lib/config-symbian.h
index 17d92b061..9c712639b 100644
--- a/lib/config-symbian.h
+++ b/lib/config-symbian.h
@@ -480,9 +480,6 @@
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
-/* Define this if you have the SPNEGO library fbopenssl */
-/* #undef HAVE_SPNEGO */
-
/* Define to 1 if you have the `SSL_get_shutdown' function. */
/*#define HAVE_SSL_GET_SHUTDOWN 1*/
diff --git a/lib/config-tpf.h b/lib/config-tpf.h
index ddb8f778c..cfdbcc5cd 100644
--- a/lib/config-tpf.h
+++ b/lib/config-tpf.h
@@ -436,9 +436,6 @@
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
-/* Define this if you have the SPNEGO library fbopenssl */
-/* #undef HAVE_SPNEGO */
-
/* Define to 1 if you have the <ssl.h> header file. */
/* #undef HAVE_SSL_H */
#define HAVE_SSL_H 1
diff --git a/lib/config-vxworks.h b/lib/config-vxworks.h
index c94534afb..05220b581 100644
--- a/lib/config-vxworks.h
+++ b/lib/config-vxworks.h
@@ -547,9 +547,6 @@
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
-/* Define this if you have the SPNEGO library fbopenssl */
-/* #undef HAVE_SPNEGO */
-
/* Define to 1 if you have the `SSL_get_shutdown' function. */
#define HAVE_SSL_GET_SHUTDOWN 1
diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
index 454c9e6d2..20979df2e 100644
--- a/lib/curl_config.h.cmake
+++ b/lib/curl_config.h.cmake
@@ -528,9 +528,6 @@
/* Define to 1 if you have the `socket' function. */
#cmakedefine HAVE_SOCKET ${HAVE_SOCKET}
-/* Define this if you have the SPNEGO library fbopenssl */
-#cmakedefine HAVE_SPNEGO ${HAVE_SPNEGO}
-
/* Define to 1 if you have the `SSL_get_shutdown' function. */
#cmakedefine HAVE_SSL_GET_SHUTDOWN ${HAVE_SSL_GET_SHUTDOWN}
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index 53df30e09..ccd005bbb 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -39,19 +39,6 @@
#include "curl_memory.h"
#include "url.h"
-#ifdef HAVE_SPNEGO
-# include <spnegohelp.h>
-# ifdef USE_SSLEAY
-# ifdef USE_OPENSSL
-# include <openssl/objects.h>
-# else
-# include <objects.h>
-# endif
-# else
-# error "Can't compile SPNEGO support without OpenSSL."
-# endif
-#endif
-
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -191,53 +178,6 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
input_token.length = rawlen;
DEBUGASSERT(input_token.value != NULL);
-
-#ifdef HAVE_SPNEGO /* Handle SPNEGO */
- if(checkprefix("Negotiate", header)) {
- unsigned char *spnegoToken = NULL;
- size_t spnegoTokenLength = 0;
- gss_buffer_desc mechToken = GSS_C_EMPTY_BUFFER;
-
- spnegoToken = malloc(input_token.length);
- if(spnegoToken == NULL) {
- Curl_safefree(input_token.value);
- return CURLE_OUT_OF_MEMORY;
- }
- memcpy(spnegoToken, input_token.value, input_token.length);
- spnegoTokenLength = input_token.length;
-
- if(!parseSpnegoTargetToken(spnegoToken,
- spnegoTokenLength,
- NULL,
- NULL,
- (unsigned char**)&mechToken.value,
- &mechToken.length,
- NULL,
- NULL)) {
- Curl_safefree(spnegoToken);
- infof(data, "Parse SPNEGO Target Token failed\n");
- }
- else if(!mechToken.value || !mechToken.length) {
- Curl_safefree(spnegoToken);
- if(mechToken.value)
- gss_release_buffer(&discard_st, &mechToken);
- infof(data, "Parse SPNEGO Target Token succeeded (NULL token)\n");
- }
- else {
- Curl_safefree(spnegoToken);
- Curl_safefree(input_token.value);
- input_token.value = malloc(mechToken.length);
- if(input_token.value == NULL) {
- gss_release_buffer(&discard_st, &mechToken);
- return CURLE_OUT_OF_MEMORY;
- }
- memcpy(input_token.value, mechToken.value, mechToken.length);
- input_token.length = mechToken.length;
- gss_release_buffer(&discard_st, &mechToken);
- infof(data, "Parse SPNEGO Target Token succeeded\n");
- }
- }
-#endif
}
major_status = Curl_gss_init_sec_context(data,
@@ -279,52 +219,6 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
CURLcode error;
OM_uint32 discard_st;
-#ifdef HAVE_SPNEGO /* Handle SPNEGO */
- if(checkprefix("Negotiate", neg_ctx->protocol)) {
- ASN1_OBJECT *object = NULL;
- unsigned char *responseToken = NULL;
- size_t responseTokenLength = 0;
- gss_buffer_desc spnegoToken = GSS_C_EMPTY_BUFFER;
-
- responseToken = malloc(neg_ctx->output_token.length);
- if(responseToken == NULL)
- return CURLE_OUT_OF_MEMORY;
- memcpy(responseToken, neg_ctx->output_token.value,
- neg_ctx->output_token.length);
- responseTokenLength = neg_ctx->output_token.length;
-
- object = OBJ_txt2obj("1.2.840.113554.1.2.2", 1);
- if(!object) {
- Curl_safefree(responseToken);
- return CURLE_OUT_OF_MEMORY;
- }
-
- if(!makeSpnegoInitialToken(object,
- responseToken,
- responseTokenLength,
- (unsigned char**)&spnegoToken.value,
- &spnegoToken.length)) {
- Curl_safefree(responseToken);
- ASN1_OBJECT_free(object);
- infof(conn->data, "Make SPNEGO Initial Token failed\n");
- }
- else if(!spnegoToken.value || !spnegoToken.length) {
- Curl_safefree(responseToken);
- ASN1_OBJECT_free(object);
- if(spnegoToken.value)
- gss_release_buffer(&discard_st, &spnegoToken);
- infof(conn->data, "Make SPNEGO Initial Token succeeded (NULL token)\n");
- }
- else {
- Curl_safefree(responseToken);
- ASN1_OBJECT_free(object);
- gss_release_buffer(&discard_st, &neg_ctx->output_token);
- neg_ctx->output_token.value = spnegoToken.value;
- neg_ctx->output_token.length = spnegoToken.length;
- infof(conn->data, "Make SPNEGO Initial Token succeeded\n");
- }
- }
-#endif
error = Curl_base64_encode(conn->data,
neg_ctx->output_token.value,
neg_ctx->output_token.length,
diff --git a/lib/version.c b/lib/version.c
index 2c0e9b8b1..c25b55b97 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -268,9 +268,6 @@ static curl_version_info_data version_info = {
#ifdef CURLRES_ASYNCH
| CURL_VERSION_ASYNCHDNS
#endif
-#ifdef HAVE_SPNEGO
- | CURL_VERSION_SPNEGO
-#endif
#if (CURL_SIZEOF_CURL_OFF_T > 4) && \
( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) )
| CURL_VERSION_LARGEFILE