#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;
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)
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
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;
}
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;
}
* 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 */
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
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
userp = conn->user;
ntlm = &conn->ntlm;
state = &conn->http_ntlm_state;
- authp = &conn->data->state.authhost;
+ authp = &data->state.authhost;
}
authp->done = FALSE;
* 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;
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;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
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);
/* 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 */
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);
}
*
* 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)
};
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;
*
* 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;
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);
}
}
*
* 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
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;
}
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) {
}
else {
*progress = SASL_DONE;
- state(sasl, conn, SASL_STOP);
+ state(sasl, data, SASL_STOP);
return CURLE_LOGIN_DENIED;
}
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:
free(resp);
- state(sasl, conn, newstate);
+ state(sasl, data, newstate);
return result;
}
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 */
#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;
}
#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;
}
#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;
}
#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);
unsigned long *availp;
struct auth *authp;
+ (void) conn; /* In case conditionals make it unused. */
+
if(proxy) {
availp = &data->info.proxyauthavail;
authp = &data->state.authproxy;
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);
*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;
* 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;
}
#endif
else if(conn->handler->protocol & CURLPROTO_RTSP) {
- result = Curl_rtsp_parseheader(conn, headp);
+ result = Curl_rtsp_parseheader(data, headp);
if(result)
return result;
}
}
}
-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;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
#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 */
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 */
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);
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 */
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
*/
-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;
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;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
#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);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
#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 */
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) {
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;
(*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 */
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;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
#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);
}
/* 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)
(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:
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)
(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:
}
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);
/*
* 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;
}
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;
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)) {
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
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 */
}
/* 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)
(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: