diff options
author | Patrick Monnerat <patrick@monnerat.net> | 2021-01-21 00:38:52 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-01-24 18:15:03 +0100 |
commit | ecb13416e316fc1c781f865d2bb7e74462ef793b (patch) | |
tree | 9aa6952ee7245220c75337e01f1e7762237a5f45 /lib | |
parent | 14e075d1a7fd58c78145bccbd53e679a3b691f5e (diff) | |
download | curl-ecb13416e316fc1c781f865d2bb7e74462ef793b.tar.gz |
lib: remove conn->data uses
Closes #6499
Diffstat (limited to 'lib')
-rw-r--r-- | lib/content_encoding.c | 8 | ||||
-rw-r--r-- | lib/curl_ntlm_wb.c | 29 | ||||
-rw-r--r-- | lib/curl_ntlm_wb.h | 8 | ||||
-rw-r--r-- | lib/curl_rtmp.c | 4 | ||||
-rw-r--r-- | lib/curl_sasl.c | 28 | ||||
-rw-r--r-- | lib/curl_sasl.h | 6 | ||||
-rw-r--r-- | lib/http.c | 19 | ||||
-rw-r--r-- | lib/http_aws_sigv4.c | 3 | ||||
-rw-r--r-- | lib/http_aws_sigv4.h | 4 | ||||
-rw-r--r-- | lib/http_chunks.c | 9 | ||||
-rw-r--r-- | lib/http_digest.c | 10 | ||||
-rw-r--r-- | lib/http_digest.h | 7 | ||||
-rw-r--r-- | lib/http_negotiate.c | 23 | ||||
-rw-r--r-- | lib/http_negotiate.h | 9 | ||||
-rw-r--r-- | lib/imap.c | 5 | ||||
-rw-r--r-- | lib/pop3.c | 4 | ||||
-rw-r--r-- | lib/rtsp.c | 11 | ||||
-rw-r--r-- | lib/rtsp.h | 4 | ||||
-rw-r--r-- | lib/smtp.c | 4 |
19 files changed, 99 insertions, 96 deletions
diff --git a/lib/content_encoding.c b/lib/content_encoding.c index 2918e0785..f179b8179 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -1077,10 +1077,10 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, #else /* Stubs for builds without HTTP. */ -CURLcode Curl_build_unencoding_stack(struct connectdata *conn, +CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, const char *enclist, int maybechunked) { - (void) conn; + (void) data; (void) enclist; (void) maybechunked; return CURLE_NOT_BUILT_IN; @@ -1097,9 +1097,9 @@ CURLcode Curl_unencode_write(struct Curl_easy *data, return CURLE_NOT_BUILT_IN; } -void Curl_unencode_cleanup(struct connectdata *conn) +void Curl_unencode_cleanup(struct Curl_easy *data) { - (void) conn; + (void) data; } char *Curl_all_content_encodings(void) diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c index c11757f55..9af79fd66 100644 --- a/lib/curl_ntlm_wb.c +++ b/lib/curl_ntlm_wb.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -329,13 +329,16 @@ done: return CURLE_REMOTE_ACCESS_DENIED; } -CURLcode Curl_input_ntlm_wb(struct connectdata *conn, +CURLcode Curl_input_ntlm_wb(struct Curl_easy *data, + struct connectdata *conn, bool proxy, const char *header) { struct ntlmdata *ntlm = proxy ? &conn->proxyntlm : &conn->ntlm; curlntlm *state = proxy ? &conn->proxy_ntlm_state : &conn->http_ntlm_state; + (void) data; /* In case it gets unused by nop log macros. */ + if(!checkprefix("NTLM", header)) return CURLE_BAD_CONTENT_ENCODING; @@ -352,17 +355,17 @@ CURLcode Curl_input_ntlm_wb(struct connectdata *conn, } else { if(*state == NTLMSTATE_LAST) { - infof(conn->data, "NTLM auth restarted\n"); + infof(data, "NTLM auth restarted\n"); Curl_http_auth_cleanup_ntlm_wb(conn); } else if(*state == NTLMSTATE_TYPE3) { - infof(conn->data, "NTLM handshake rejected\n"); + infof(data, "NTLM handshake rejected\n"); Curl_http_auth_cleanup_ntlm_wb(conn); *state = NTLMSTATE_NONE; return CURLE_REMOTE_ACCESS_DENIED; } else if(*state >= NTLMSTATE_TYPE1) { - infof(conn->data, "NTLM handshake failure (internal error)\n"); + infof(data, "NTLM handshake failure (internal error)\n"); return CURLE_REMOTE_ACCESS_DENIED; } @@ -376,7 +379,8 @@ CURLcode Curl_input_ntlm_wb(struct connectdata *conn, * This is for creating ntlm header output by delegating challenge/response * to Samba's winbind daemon helper ntlm_auth. */ -CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy) +CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn, + bool proxy) { /* point to the address of the pointer that holds the string to send to the server, which is for a plain host or for a HTTP proxy */ @@ -386,12 +390,11 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy) struct ntlmdata *ntlm; curlntlm *state; struct auth *authp; - struct Curl_easy *data = conn->data; CURLcode res = CURLE_OK; DEBUGASSERT(conn); - DEBUGASSERT(conn->data); + DEBUGASSERT(data); if(proxy) { #ifndef CURL_DISABLE_PROXY @@ -399,7 +402,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy) userp = conn->http_proxy.user; ntlm = &conn->proxyntlm; state = &conn->proxy_ntlm_state; - authp = &conn->data->state.authproxy; + authp = &data->state.authproxy; #else return CURLE_NOT_BUILT_IN; #endif @@ -409,7 +412,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy) userp = conn->user; ntlm = &conn->ntlm; state = &conn->http_ntlm_state; - authp = &conn->data->state.authhost; + authp = &data->state.authhost; } authp->done = FALSE; @@ -433,10 +436,10 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy) * request handling process. */ /* Create communication with ntlm_auth */ - res = ntlm_wb_init(conn->data, ntlm, userp); + res = ntlm_wb_init(data, ntlm, userp); if(res) return res; - res = ntlm_wb_response(conn->data, ntlm, "YR\n", *state); + res = ntlm_wb_response(data, ntlm, "YR\n", *state); if(res) return res; @@ -454,7 +457,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy) char *input = aprintf("TT %s\n", ntlm->challenge); if(!input) return CURLE_OUT_OF_MEMORY; - res = ntlm_wb_response(conn->data, ntlm, input, *state); + res = ntlm_wb_response(data, ntlm, input, *state); free(input); if(res) return res; diff --git a/lib/curl_ntlm_wb.h b/lib/curl_ntlm_wb.h index 4f847d22c..961b56873 100644 --- a/lib/curl_ntlm_wb.h +++ b/lib/curl_ntlm_wb.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -28,11 +28,13 @@ defined(NTLM_WB_ENABLED) /* this is for ntlm header input */ -CURLcode Curl_input_ntlm_wb(struct connectdata *conn, bool proxy, +CURLcode Curl_input_ntlm_wb(struct Curl_easy *data, + struct connectdata *conn, bool proxy, const char *header); /* this is for creating ntlm header output */ -CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy); +CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn, + bool proxy); void Curl_http_auth_cleanup_ntlm_wb(struct connectdata *conn); diff --git a/lib/curl_rtmp.c b/lib/curl_rtmp.c index 9ac9611ea..fabdc8848 100644 --- a/lib/curl_rtmp.c +++ b/lib/curl_rtmp.c @@ -223,7 +223,7 @@ static CURLcode rtmp_connect(struct Curl_easy *data, bool *done) /* We have to know if it's a write before we send the * connect request packet */ - if(conn->data->set.upload) + if(data->set.upload) r->Link.protocol |= RTMP_FEATURE_WRITE; /* For plain streams, use the buffer toggle trick to keep data flowing */ @@ -255,7 +255,7 @@ static CURLcode rtmp_do(struct Curl_easy *data, bool *done) if(!RTMP_ConnectStream(r, 0)) return CURLE_FAILED_INIT; - if(conn->data->set.upload) { + if(data->set.upload) { Curl_pgrsSetUploadSize(data, data->state.infilesize); Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET); } diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index dfc902aab..ffeb75164 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -194,7 +194,7 @@ void Curl_sasl_init(struct SASL *sasl, const struct SASLproto *params) * * This is the ONLY way to change SASL state! */ -static void state(struct SASL *sasl, struct connectdata *conn, +static void state(struct SASL *sasl, struct Curl_easy *data, saslstate newstate) { #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) @@ -221,10 +221,10 @@ static void state(struct SASL *sasl, struct connectdata *conn, }; if(sasl->state != newstate) - infof(conn->data, "SASL %p state change from %s to %s\n", + infof(data, "SASL %p state change from %s to %s\n", (void *)sasl, names[sasl->state], names[newstate]); #else - (void) conn; + (void) data; #endif sasl->state = newstate; @@ -253,11 +253,11 @@ bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn) * * Calculate the required login details for SASL authentication. */ -CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn, +CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data, + struct connectdata *conn, bool force_ir, saslprogress *progress) { CURLcode result = CURLE_OK; - struct Curl_easy *data = conn->data; unsigned int enabledmechs; const char *mech = NULL; char *resp = NULL; @@ -401,7 +401,7 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn, result = sasl->params->sendauth(data, conn, mech, resp); if(!result) { *progress = SASL_INPROGRESS; - state(sasl, conn, resp ? state2 : state1); + state(sasl, data, resp ? state2 : state1); } } @@ -415,11 +415,11 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn, * * Continue the authentication. */ -CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, +CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data, + struct connectdata *conn, int code, saslprogress *progress) { CURLcode result = CURLE_OK; - struct Curl_easy *data = conn->data; saslstate newstate = SASL_FINAL; char *resp = NULL; #ifndef CURL_DISABLE_PROXY @@ -450,14 +450,14 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, if(code != sasl->params->finalcode) result = CURLE_LOGIN_DENIED; *progress = SASL_DONE; - state(sasl, conn, SASL_STOP); + state(sasl, data, SASL_STOP); return result; } if(sasl->state != SASL_CANCEL && sasl->state != SASL_OAUTH2_RESP && code != sasl->params->contcode) { *progress = SASL_DONE; - state(sasl, conn, SASL_STOP); + state(sasl, data, SASL_STOP); return CURLE_LOGIN_DENIED; } @@ -587,7 +587,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, if(code == sasl->params->finalcode) { /* Final response was received so we are done */ *progress = SASL_DONE; - state(sasl, conn, SASL_STOP); + state(sasl, data, SASL_STOP); return result; } else if(code == sasl->params->contcode) { @@ -600,7 +600,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, } else { *progress = SASL_DONE; - state(sasl, conn, SASL_STOP); + state(sasl, data, SASL_STOP); return CURLE_LOGIN_DENIED; } @@ -609,7 +609,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, sasl->authmechs ^= sasl->authused; /* Start an alternative SASL authentication */ - result = Curl_sasl_start(sasl, conn, sasl->force_ir, progress); + result = Curl_sasl_start(sasl, data, conn, sasl->force_ir, progress); newstate = sasl->state; /* Use state from Curl_sasl_start() */ break; default: @@ -636,7 +636,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, free(resp); - state(sasl, conn, newstate); + state(sasl, data, newstate); return result; } diff --git a/lib/curl_sasl.h b/lib/curl_sasl.h index 6371933fb..75a957583 100644 --- a/lib/curl_sasl.h +++ b/lib/curl_sasl.h @@ -135,11 +135,13 @@ void Curl_sasl_init(struct SASL *sasl, const struct SASLproto *params); bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn); /* Calculate the required login details for SASL authentication */ -CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn, +CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data, + struct connectdata *conn, bool force_ir, saslprogress *progress); /* Continue an SASL authentication */ -CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, +CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data, + struct connectdata *conn, int code, saslprogress *progress); #endif /* HEADER_CURL_SASL_H */ diff --git a/lib/http.c b/lib/http.c index 471efe3d3..40773e6da 100644 --- a/lib/http.c +++ b/lib/http.c @@ -672,7 +672,7 @@ output_auth_headers(struct Curl_easy *data, #ifndef CURL_DISABLE_CRYPTO_AUTH if(authstatus->picked == CURLAUTH_AWS_SIGV4) { auth = "AWS_SIGV4"; - result = Curl_output_aws_sigv4(conn, proxy); + result = Curl_output_aws_sigv4(data, proxy); if(result) return result; } @@ -681,7 +681,7 @@ output_auth_headers(struct Curl_easy *data, #ifdef USE_SPNEGO if(authstatus->picked == CURLAUTH_NEGOTIATE) { auth = "Negotiate"; - result = Curl_output_negotiate(conn, proxy); + result = Curl_output_negotiate(data, conn, proxy); if(result) return result; } @@ -699,7 +699,7 @@ output_auth_headers(struct Curl_easy *data, #if defined(USE_NTLM) && defined(NTLM_WB_ENABLED) if(authstatus->picked == CURLAUTH_NTLM_WB) { auth = "NTLM_WB"; - result = Curl_output_ntlm_wb(conn, proxy); + result = Curl_output_ntlm_wb(data, conn, proxy); if(result) return result; } @@ -708,7 +708,8 @@ output_auth_headers(struct Curl_easy *data, #ifndef CURL_DISABLE_CRYPTO_AUTH if(authstatus->picked == CURLAUTH_DIGEST) { auth = "Digest"; - result = Curl_output_digest(conn, + result = Curl_output_digest(data, + conn, proxy, (const unsigned char *)request, (const unsigned char *)path); @@ -903,6 +904,8 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy, unsigned long *availp; struct auth *authp; + (void) conn; /* In case conditionals make it unused. */ + if(proxy) { availp = &data->info.proxyauthavail; authp = &data->state.authproxy; @@ -937,7 +940,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy, authp->avail |= CURLAUTH_NEGOTIATE; if(authp->picked == CURLAUTH_NEGOTIATE) { - CURLcode result = Curl_input_negotiate(conn, proxy, auth); + CURLcode result = Curl_input_negotiate(data, conn, proxy, auth); if(!result) { DEBUGASSERT(!data->req.newurl); data->req.newurl = strdup(data->change.url); @@ -976,7 +979,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy, *availp |= CURLAUTH_NTLM_WB; authp->avail |= CURLAUTH_NTLM_WB; - result = Curl_input_ntlm_wb(conn, proxy, auth); + result = Curl_input_ntlm_wb(data, conn, proxy, auth); if(result) { infof(data, "Authentication problem. Ignoring this.\n"); data->state.authproblem = TRUE; @@ -1007,7 +1010,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy, * authentication isn't activated yet, as we need to store the * incoming data from this header in case we are going to use * Digest */ - result = Curl_input_digest(conn, proxy, auth); + result = Curl_input_digest(data, proxy, auth); if(result) { infof(data, "Authentication problem. Ignoring this.\n"); data->state.authproblem = TRUE; @@ -3611,7 +3614,7 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn, } #endif else if(conn->handler->protocol & CURLPROTO_RTSP) { - result = Curl_rtsp_parseheader(conn, headp); + result = Curl_rtsp_parseheader(data, headp); if(result) return result; } diff --git a/lib/http_aws_sigv4.c b/lib/http_aws_sigv4.c index 40dfcdfeb..0bef049cd 100644 --- a/lib/http_aws_sigv4.c +++ b/lib/http_aws_sigv4.c @@ -69,11 +69,10 @@ static void sha256_to_hex(char *dst, unsigned char *sha, size_t dst_l) } } -CURLcode Curl_output_aws_sigv4(struct connectdata *conn, bool proxy) +CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) { CURLcode ret = CURLE_OK; char sk[FULL_SK_L] = {0}; - struct Curl_easy *data = conn->data; const char *customrequest = data->set.str[STRING_CUSTOMREQUEST]; const char *hostname = data->state.up.hostname; struct tm info; diff --git a/lib/http_aws_sigv4.h b/lib/http_aws_sigv4.h index 0f1b1614a..886b31440 100644 --- a/lib/http_aws_sigv4.h +++ b/lib/http_aws_sigv4.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -24,6 +24,6 @@ #include "curl_setup.h" /* this is for creating aws_sigv4 header output */ -CURLcode Curl_output_aws_sigv4(struct connectdata *conn, bool proxy); +CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy); #endif /* HEADER_CURL_HTTP_AWS_SIGV4_H */ diff --git a/lib/http_chunks.c b/lib/http_chunks.c index 7d22c9ec6..c1c2a4da9 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -159,8 +159,7 @@ CHUNKcode Curl_httpchunk_read(struct Curl_easy *data, ch->hexbuffer[ch->hexindex] = 0; /* convert to host encoding before calling strtoul */ - result = Curl_convert_from_network(conn->data, ch->hexbuffer, - ch->hexindex); + result = Curl_convert_from_network(data, ch->hexbuffer, ch->hexindex); if(result) { /* Curl_convert_from_network calls failf if unsuccessful */ /* Treat it as a bad hex character */ @@ -195,8 +194,8 @@ CHUNKcode Curl_httpchunk_read(struct Curl_easy *data, piece = curlx_sotouz((ch->datasize >= length)?length:ch->datasize); /* Write the data portion available */ - if(!conn->data->set.http_te_skip && !k->ignorebody) { - if(!conn->data->set.http_ce_skip && k->writer_stack) + if(!data->set.http_te_skip && !k->ignorebody) { + if(!data->set.http_ce_skip && k->writer_stack) result = Curl_unencode_write(data, k->writer_stack, datap, piece); else result = Curl_client_write(data, CLIENTWRITE_BODY, datap, piece); @@ -243,7 +242,7 @@ CHUNKcode Curl_httpchunk_read(struct Curl_easy *data, tr = Curl_dyn_ptr(&conn->trailer); trlen = Curl_dyn_len(&conn->trailer); /* Convert to host encoding before calling Curl_client_write */ - result = Curl_convert_from_network(conn->data, tr, trlen); + result = Curl_convert_from_network(data, tr, trlen); if(result) /* Curl_convert_from_network calls failf if unsuccessful */ /* Treat it as a bad chunk */ diff --git a/lib/http_digest.c b/lib/http_digest.c index dfa40dcb6..596b215db 100644 --- a/lib/http_digest.c +++ b/lib/http_digest.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -41,13 +41,11 @@ Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598" */ -CURLcode Curl_input_digest(struct connectdata *conn, +CURLcode Curl_input_digest(struct Curl_easy *data, bool proxy, const char *header) /* rest of the *-authenticate: header */ { - struct Curl_easy *data = conn->data; - /* Point to the correct struct with this */ struct digestdata *digest; @@ -68,13 +66,13 @@ CURLcode Curl_input_digest(struct connectdata *conn, return Curl_auth_decode_digest_http_message(header, digest); } -CURLcode Curl_output_digest(struct connectdata *conn, +CURLcode Curl_output_digest(struct Curl_easy *data, + struct connectdata *conn, bool proxy, const unsigned char *request, const unsigned char *uripath) { CURLcode result; - struct Curl_easy *data = conn->data; unsigned char *path = NULL; char *tmp = NULL; char *response; diff --git a/lib/http_digest.h b/lib/http_digest.h index f7001edec..106caa7c4 100644 --- a/lib/http_digest.h +++ b/lib/http_digest.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -26,11 +26,12 @@ #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) /* this is for digest header input */ -CURLcode Curl_input_digest(struct connectdata *conn, +CURLcode Curl_input_digest(struct Curl_easy *data, bool proxy, const char *header); /* this is for creating digest header output */ -CURLcode Curl_output_digest(struct connectdata *conn, +CURLcode Curl_output_digest(struct Curl_easy *data, + struct connectdata *conn, bool proxy, const unsigned char *request, const unsigned char *uripath); diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c index 872d172fc..d759748f2 100644 --- a/lib/http_negotiate.c +++ b/lib/http_negotiate.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -34,11 +34,10 @@ #include "curl_memory.h" #include "memdebug.h" -CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy, - const char *header) +CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn, + bool proxy, const char *header) { CURLcode result; - struct Curl_easy *data = conn->data; size_t len; /* Point to the username, password, service and host */ @@ -90,7 +89,7 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy, neg_ctx->havenegdata = len != 0; if(!len) { if(state == GSS_AUTHSUCC) { - infof(conn->data, "Negotiate auth restarted\n"); + infof(data, "Negotiate auth restarted\n"); Curl_http_auth_cleanup_negotiate(conn); } else if(state != GSS_AUTHNONE) { @@ -116,15 +115,14 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy, return result; } -CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) +CURLcode Curl_output_negotiate(struct Curl_easy *data, + struct connectdata *conn, bool proxy) { struct negotiatedata *neg_ctx = proxy ? &conn->proxyneg : &conn->negotiate; - struct auth *authp = proxy ? &conn->data->state.authproxy : - &conn->data->state.authhost; + struct auth *authp = proxy ? &data->state.authproxy : &data->state.authhost; curlnegotiate *state = proxy ? &conn->proxy_negotiate_state : &conn->http_negotiate_state; - struct Curl_easy *data = conn->data; char *base64 = NULL; size_t len = 0; char *userp; @@ -147,12 +145,12 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) (*state != GSS_AUTHDONE && *state != GSS_AUTHSUCC)) { if(neg_ctx->noauthpersist && *state == GSS_AUTHSUCC) { - infof(conn->data, "Curl_output_negotiate, " + infof(data, "Curl_output_negotiate, " "no persistent authentication: cleanup existing context"); Curl_http_auth_cleanup_negotiate(conn); } if(!neg_ctx->context) { - result = Curl_input_negotiate(conn, proxy, "Negotiate"); + result = Curl_input_negotiate(data, conn, proxy, "Negotiate"); if(result == CURLE_AUTH_ERROR) { /* negotiate auth failed, let's continue unauthenticated to stay * compatible with the behavior before curl-7_64_0-158-g6c6035532 */ @@ -163,8 +161,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) return result; } - result = Curl_auth_create_spnego_message(conn->data, - neg_ctx, &base64, &len); + result = Curl_auth_create_spnego_message(data, neg_ctx, &base64, &len); if(result) return result; diff --git a/lib/http_negotiate.h b/lib/http_negotiate.h index cf1d007dc..2640a3ee0 100644 --- a/lib/http_negotiate.h +++ b/lib/http_negotiate.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -25,11 +25,12 @@ #if !defined(CURL_DISABLE_HTTP) && defined(USE_SPNEGO) /* this is for Negotiate header input */ -CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy, - const char *header); +CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn, + bool proxy, const char *header); /* this is for creating Negotiate header output */ -CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy); +CURLcode Curl_output_negotiate(struct Curl_easy *data, + struct connectdata *conn, bool proxy); void Curl_http_auth_cleanup_negotiate(struct connectdata *conn); diff --git a/lib/imap.c b/lib/imap.c index 754b4d31e..a09a00c21 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -593,7 +593,8 @@ static CURLcode imap_perform_authentication(struct Curl_easy *data, } /* Calculate the SASL login details */ - result = Curl_sasl_start(&imapc->sasl, conn, imapc->ir_supported, &progress); + result = Curl_sasl_start(&imapc->sasl, data, conn, + imapc->ir_supported, &progress); if(!result) { if(progress == SASL_INPROGRESS) @@ -991,7 +992,7 @@ static CURLcode imap_state_auth_resp(struct Curl_easy *data, (void)instate; /* no use for this yet */ - result = Curl_sasl_continue(&imapc->sasl, conn, imapcode, &progress); + result = Curl_sasl_continue(&imapc->sasl, data, conn, imapcode, &progress); if(!result) switch(progress) { case SASL_DONE: diff --git a/lib/pop3.c b/lib/pop3.c index 8683f895a..0110f8562 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -530,7 +530,7 @@ static CURLcode pop3_perform_authentication(struct Curl_easy *data, if(pop3c->authtypes & pop3c->preftype & POP3_TYPE_SASL) { /* Calculate the SASL login details */ - result = Curl_sasl_start(&pop3c->sasl, conn, FALSE, &progress); + result = Curl_sasl_start(&pop3c->sasl, data, conn, FALSE, &progress); if(!result) if(progress == SASL_INPROGRESS) @@ -800,7 +800,7 @@ static CURLcode pop3_state_auth_resp(struct Curl_easy *data, (void)instate; /* no use for this yet */ - result = Curl_sasl_continue(&pop3c->sasl, conn, pop3code, &progress); + result = Curl_sasl_continue(&pop3c->sasl, data, conn, pop3code, &progress); if(!result) switch(progress) { case SASL_DONE: diff --git a/lib/rtsp.c b/lib/rtsp.c index e40832513..55766757a 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -87,7 +87,7 @@ static int rtsp_getsock_do(struct Curl_easy *data, struct connectdata *conn, } static -CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len); +CURLcode rtp_client_write(struct Curl_easy *data, char *ptr, size_t len); /* @@ -652,7 +652,7 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data, * Write out the header including the leading '$' */ DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n", rtspc->rtp_channel, rtp_length)); - result = rtp_client_write(conn, &rtp[0], rtp_length + 4); + result = rtp_client_write(data, &rtp[0], rtp_length + 4); if(result) { failf(data, "Got an error writing an RTP packet"); *readmore = FALSE; @@ -723,9 +723,8 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data, } static -CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len) +CURLcode rtp_client_write(struct Curl_easy *data, char *ptr, size_t len) { - struct Curl_easy *data = conn->data; size_t wrote; curl_write_callback writeit; void *user_ptr; @@ -765,10 +764,8 @@ CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len) return CURLE_OK; } -CURLcode Curl_rtsp_parseheader(struct connectdata *conn, - char *header) +CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header) { - struct Curl_easy *data = conn->data; long CSeq = 0; if(checkprefix("CSeq:", header)) { diff --git a/lib/rtsp.h b/lib/rtsp.h index 76ed28b4c..1e9cb7d2c 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -29,7 +29,7 @@ extern const struct Curl_handler Curl_handler_rtsp; -CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); +CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header); #else /* disabled */ diff --git a/lib/smtp.c b/lib/smtp.c index 39351b463..5fb7fe75d 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -475,7 +475,7 @@ static CURLcode smtp_perform_authentication(struct Curl_easy *data) } /* Calculate the SASL login details */ - result = Curl_sasl_start(&smtpc->sasl, conn, FALSE, &progress); + result = Curl_sasl_start(&smtpc->sasl, data, conn, FALSE, &progress); if(!result) { if(progress == SASL_INPROGRESS) @@ -979,7 +979,7 @@ static CURLcode smtp_state_auth_resp(struct Curl_easy *data, (void)instate; /* no use for this yet */ - result = Curl_sasl_continue(&smtpc->sasl, conn, smtpcode, &progress); + result = Curl_sasl_continue(&smtpc->sasl, data, conn, smtpcode, &progress); if(!result) switch(progress) { case SASL_DONE: |