Lines Matching refs:sasl
160 CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl, in Curl_sasl_parse_url_auth_option() argument
169 if(sasl->resetprefs) { in Curl_sasl_parse_url_auth_option()
170 sasl->resetprefs = FALSE; in Curl_sasl_parse_url_auth_option()
171 sasl->prefmech = SASL_AUTH_NONE; in Curl_sasl_parse_url_auth_option()
175 sasl->prefmech = SASL_AUTH_DEFAULT; in Curl_sasl_parse_url_auth_option()
179 sasl->prefmech |= mechbit; in Curl_sasl_parse_url_auth_option()
192 void Curl_sasl_init(struct SASL *sasl, struct Curl_easy *data, in Curl_sasl_init() argument
197 sasl->params = params; /* Set protocol dependent parameters */ in Curl_sasl_init()
198 sasl->state = SASL_STOP; /* Not yet running */ in Curl_sasl_init()
199 sasl->curmech = NULL; /* No mechanism yet. */ in Curl_sasl_init()
200 sasl->authmechs = SASL_AUTH_NONE; /* No known authentication mechanism yet */ in Curl_sasl_init()
201 sasl->prefmech = params->defmechs; /* Default preferred mechanisms */ in Curl_sasl_init()
202 sasl->authused = SASL_AUTH_NONE; /* The authentication mechanism used */ in Curl_sasl_init()
203 sasl->resetprefs = TRUE; /* Reset prefmech upon AUTH parsing. */ in Curl_sasl_init()
204 sasl->mutual_auth = FALSE; /* No mutual authentication (GSSAPI only) */ in Curl_sasl_init()
205 sasl->force_ir = FALSE; /* Respect external option */ in Curl_sasl_init()
224 sasl->prefmech = mechs; in Curl_sasl_init()
233 static void sasl_state(struct SASL *sasl, struct Curl_easy *data, in sasl_state() argument
260 if(sasl->state != newstate) in sasl_state()
262 (void *)sasl, names[sasl->state], names[newstate]); in sasl_state()
267 sasl->state = newstate; in sasl_state()
273 static CURLcode get_server_message(struct SASL *sasl, struct Curl_easy *data, in get_server_message() argument
278 result = sasl->params->getmessage(data, out); in get_server_message()
279 if(!result && (sasl->params->flags & SASL_FLAG_BASE64)) { in get_server_message()
297 static CURLcode build_message(struct SASL *sasl, struct bufref *msg) in build_message() argument
301 if(sasl->params->flags & SASL_FLAG_BASE64) { in build_message()
325 bool Curl_sasl_can_authenticate(struct SASL *sasl, struct Curl_easy *data) in Curl_sasl_can_authenticate() argument
332 if(sasl->authmechs & sasl->prefmech & SASL_MECH_EXTERNAL) in Curl_sasl_can_authenticate()
343 CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data, in Curl_sasl_start() argument
358 sasl->params->service; in Curl_sasl_start()
366 sasl->force_ir = force_ir; /* Latch for future use */ in Curl_sasl_start()
367 sasl->authused = 0; /* No mechanism used yet */ in Curl_sasl_start()
368 enabledmechs = sasl->authmechs & sasl->prefmech; in Curl_sasl_start()
376 sasl->authused = SASL_MECH_EXTERNAL; in Curl_sasl_start()
385 sasl->mutual_auth = FALSE; in Curl_sasl_start()
389 sasl->authused = SASL_MECH_GSSAPI; in Curl_sasl_start()
396 sasl->mutual_auth, in Curl_sasl_start()
407 sasl->authused = SASL_MECH_SCRAM_SHA_256; in Curl_sasl_start()
420 sasl->authused = SASL_MECH_SCRAM_SHA_1; in Curl_sasl_start()
436 sasl->authused = SASL_MECH_DIGEST_MD5; in Curl_sasl_start()
441 sasl->authused = SASL_MECH_CRAM_MD5; in Curl_sasl_start()
450 sasl->authused = SASL_MECH_NTLM; in Curl_sasl_start()
465 sasl->authused = SASL_MECH_OAUTHBEARER; in Curl_sasl_start()
477 sasl->authused = SASL_MECH_XOAUTH2; in Curl_sasl_start()
487 sasl->authused = SASL_MECH_PLAIN; in Curl_sasl_start()
498 sasl->authused = SASL_MECH_LOGIN; in Curl_sasl_start()
506 sasl->curmech = mech; in Curl_sasl_start()
508 result = build_message(sasl, &resp); in Curl_sasl_start()
510 if(sasl->params->maxirlen && in Curl_sasl_start()
511 strlen(mech) + Curl_bufref_len(&resp) > sasl->params->maxirlen) in Curl_sasl_start()
515 result = sasl->params->sendauth(data, mech, &resp); in Curl_sasl_start()
519 sasl_state(sasl, data, Curl_bufref_ptr(&resp) ? state2 : state1); in Curl_sasl_start()
532 CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data, in Curl_sasl_continue() argument
545 sasl->params->service; in Curl_sasl_continue()
555 if(sasl->state == SASL_FINAL) { in Curl_sasl_continue()
556 if(code != sasl->params->finalcode) in Curl_sasl_continue()
559 sasl_state(sasl, data, SASL_STOP); in Curl_sasl_continue()
563 if(sasl->state != SASL_CANCEL && sasl->state != SASL_OAUTH2_RESP && in Curl_sasl_continue()
564 code != sasl->params->contcode) { in Curl_sasl_continue()
566 sasl_state(sasl, data, SASL_STOP); in Curl_sasl_continue()
570 switch(sasl->state) { in Curl_sasl_continue()
590 result = get_server_message(sasl, data, &serverdata); in Curl_sasl_continue()
599 result = get_server_message(sasl, data, &serverdata); in Curl_sasl_continue()
605 result = get_server_message(sasl, data, &serverdata); in Curl_sasl_continue()
610 if(!result && (sasl->params->flags & SASL_FLAG_BASE64)) in Curl_sasl_continue()
629 result = get_server_message(sasl, data, &serverdata); in Curl_sasl_continue()
646 sasl->mutual_auth, NULL, in Curl_sasl_continue()
652 result = get_server_message(sasl, data, &serverdata); in Curl_sasl_continue()
654 if(sasl->mutual_auth) { in Curl_sasl_continue()
659 sasl->mutual_auth, in Curl_sasl_continue()
676 result = get_server_message(sasl, data, &serverdata); in Curl_sasl_continue()
688 if(sasl->authused == SASL_MECH_OAUTHBEARER) { in Curl_sasl_continue()
706 if(code == sasl->params->finalcode) { in Curl_sasl_continue()
709 sasl_state(sasl, data, SASL_STOP); in Curl_sasl_continue()
712 else if(code == sasl->params->contcode) { in Curl_sasl_continue()
719 sasl_state(sasl, data, SASL_STOP); in Curl_sasl_continue()
725 sasl->authmechs ^= sasl->authused; in Curl_sasl_continue()
728 return Curl_sasl_start(sasl, data, sasl->force_ir, progress); in Curl_sasl_continue()
740 result = sasl->params->cancelauth(data, sasl->curmech); in Curl_sasl_continue()
744 result = build_message(sasl, &resp); in Curl_sasl_continue()
746 result = sasl->params->contauth(data, sasl->curmech, &resp); in Curl_sasl_continue()
756 sasl_state(sasl, data, newstate); in Curl_sasl_continue()