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

ntlm: Only define ntlm data structure when USE_NTLM is defined

This commit is contained in:
Steve Holme 2014-10-25 22:32:46 +01:00
parent 28ff8babad
commit 3fe5b462f7
4 changed files with 23 additions and 12 deletions

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, 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
@ -35,10 +35,6 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
void Curl_http_ntlm_cleanup(struct connectdata *conn);
#else
#define Curl_http_ntlm_cleanup(a) Curl_nop_stmt
#endif
#endif /* HEADER_CURL_NTLM_H */

View File

@ -420,6 +420,7 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
conn->bits.rewindaftersend = FALSE; /* default */
if((expectsend == -1) || (expectsend > bytessent)) {
#if defined(USE_NTLM)
/* There is still data left to send */
if((data->state.authproxy.picked == CURLAUTH_NTLM) ||
(data->state.authhost.picked == CURLAUTH_NTLM) ||
@ -439,6 +440,7 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
return CURLE_OK;
}
if(conn->bits.close)
/* this is already marked to get closed */
return CURLE_OK;
@ -447,9 +449,9 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
CURL_FORMAT_CURL_OFF_T " bytes\n",
(curl_off_t)(expectsend - bytessent));
}
#endif
/* This is not NTLM or many bytes left to send: close
*/
/* This is not NTLM or many bytes left to send: close */
connclose(conn, "Mid-auth HTTP and much data left to send");
data->req.size = 0; /* don't download any more than 0 bytes */

View File

@ -2650,8 +2650,10 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
Curl_hostcache_prune(data); /* kill old DNS cache entries */
#if defined(USE_NTLM)
/* Cleanup NTLM connection-related data */
Curl_http_ntlm_cleanup(conn);
#endif
if(conn->handler->disconnect)
/* This is set if protocol-specific cleanups should be made */
@ -3198,6 +3200,7 @@ ConnectionExists(struct SessionHandle *data,
}
if(match) {
#if defined(USE_NTLM)
/* If we are looking for an HTTP+NTLM connection, check if this is
already authenticating with the right credentials. If not, keep
looking so that we can reuse NTLM connections if
@ -3216,6 +3219,7 @@ ConnectionExists(struct SessionHandle *data,
chosen = check;
continue;
}
#endif
if(canPipeline) {
/* We can pipeline if we want to. Let's continue looking for
@ -5616,6 +5620,7 @@ static CURLcode create_conn(struct SessionHandle *data,
ConnectionStore(data, conn);
}
#if defined(USE_NTLM)
/* If NTLM is requested in a part of this connection, make sure we don't
assume the state is fine as this is a fresh connection and NTLM is
connection based. */
@ -5624,12 +5629,13 @@ static CURLcode create_conn(struct SessionHandle *data,
infof(data, "NTLM picked AND auth done set, clear picked!\n");
data->state.authhost.picked = CURLAUTH_NONE;
}
if((data->state.authproxy.picked & (CURLAUTH_NTLM | CURLAUTH_NTLM_WB)) &&
data->state.authproxy.done) {
infof(data, "NTLM-proxy picked AND auth done set, clear picked!\n");
data->state.authproxy.picked = CURLAUTH_NONE;
}
#endif
}
/* Mark the connection as used */
@ -5886,9 +5892,12 @@ CURLcode Curl_done(struct connectdata **connp,
but currently we have no such detail knowledge.
*/
if((data->set.reuse_forbid && !(conn->ntlm.state == NTLMSTATE_TYPE2 ||
conn->proxyntlm.state == NTLMSTATE_TYPE2))
|| conn->bits.close || premature) {
if((data->set.reuse_forbid
#if defined(USE_NTLM)
&& !(conn->ntlm.state == NTLMSTATE_TYPE2 ||
conn->proxyntlm.state == NTLMSTATE_TYPE2)
#endif
) || conn->bits.close || premature) {
CURLcode res2 = Curl_disconnect(conn, premature); /* close connection */
/* If we had an error already, make sure we return that one. But

View File

@ -432,6 +432,7 @@ struct kerberos5data {
#endif
/* Struct used for NTLM challenge-response authentication */
#if defined(USE_NTLM)
struct ntlmdata {
curlntlm state;
#ifdef USE_WINDOWS_SSPI
@ -450,6 +451,7 @@ struct ntlmdata {
unsigned int target_info_len;
#endif
};
#endif
#ifdef USE_SPNEGO
struct negotiatedata {
@ -1009,17 +1011,19 @@ struct connectdata {
curl_read_callback fread_func; /* function that reads the input */
void *fread_in; /* pointer to pass to the fread() above */
#if defined(USE_NTLM)
struct ntlmdata ntlm; /* NTLM differs from other authentication schemes
because it authenticates connections, not
single requests! */
struct ntlmdata proxyntlm; /* NTLM data for proxy */
#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)
#if defined(NTLM_WB_ENABLED)
/* used for communication with Samba's winbind daemon helper ntlm_auth */
curl_socket_t ntlm_auth_hlpr_socket;
pid_t ntlm_auth_hlpr_pid;
char* challenge_header;
char* response_header;
#endif
#endif
char syserr_buf [256]; /* buffer for Curl_strerror() */