1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

imap: Added support for SASL-IR extension (Part 1)

Introduced detection of the SASL-IR capability, in order to add support
for sending the initial response with the AUTHENTICATE command, as per
RFC4959.
This commit is contained in:
Steve Holme 2013-02-07 20:02:06 +00:00
parent 4ed469a56f
commit 86dfcf737d
2 changed files with 9 additions and 3 deletions

View File

@ -24,6 +24,7 @@
* RFC3501 IMAPv4 protocol * RFC3501 IMAPv4 protocol
* RFC4422 Simple Authentication and Security Layer (SASL) * RFC4422 Simple Authentication and Security Layer (SASL)
* RFC4616 PLAIN authentication * RFC4616 PLAIN authentication
* RFC4959 IMAP Extension for SASL Initial Client Response
* RFC5092 IMAP URL Scheme * RFC5092 IMAP URL Scheme
* *
***************************************************************************/ ***************************************************************************/
@ -374,6 +375,10 @@ static int imap_endofresp(struct pingpong *pp, int *resp)
if(wordlen == 13 && !memcmp(line, "LOGINDISABLED", 13)) if(wordlen == 13 && !memcmp(line, "LOGINDISABLED", 13))
imapc->login_disabled = TRUE; imapc->login_disabled = TRUE;
/* Does the server support the SASL-IR capability? */
else if(wordlen == 7 && !memcmp(line, "SASL-IR", 7))
imapc->ir_supported = TRUE;
/* Do we have a SASL based authentication mechanism? */ /* Do we have a SASL based authentication mechanism? */
else if(wordlen > 5 && !memcmp(line, "AUTH=", 5)) { else if(wordlen > 5 && !memcmp(line, "AUTH=", 5)) {
line += 5; line += 5;
@ -676,7 +681,7 @@ static CURLcode imap_state_capability_resp(struct connectdata *conn,
return result; return result;
} }
/* For AUTHENTICATE PLAIN responses */ /* For AUTHENTICATE PLAIN (without initial response) responses */
static CURLcode imap_state_auth_plain_resp(struct connectdata *conn, static CURLcode imap_state_auth_plain_resp(struct connectdata *conn,
int imapcode, int imapcode,
imapstate instate) imapstate instate)
@ -713,7 +718,7 @@ static CURLcode imap_state_auth_plain_resp(struct connectdata *conn,
return result; return result;
} }
/* For AUTHENTICATE LOGIN responses */ /* For AUTHENTICATE LOGIN (without initial response) responses */
static CURLcode imap_state_auth_login_resp(struct connectdata *conn, static CURLcode imap_state_auth_login_resp(struct connectdata *conn,
int imapcode, int imapcode,
imapstate instate) imapstate instate)
@ -910,7 +915,7 @@ static CURLcode imap_state_auth_digest_resp_resp(struct connectdata *conn,
#endif #endif
#ifdef USE_NTLM #ifdef USE_NTLM
/* For AUTHENTICATE NTLM responses */ /* For AUTHENTICATE NTLM (without initial response) responses */
static CURLcode imap_state_auth_ntlm_resp(struct connectdata *conn, static CURLcode imap_state_auth_ntlm_resp(struct connectdata *conn,
int imapcode, int imapcode,
imapstate instate) imapstate instate)

View File

@ -63,6 +63,7 @@ struct imap_conn {
char resptag[5]; /* Response tag to wait for */ char resptag[5]; /* Response tag to wait for */
bool ssldone; /* Is connect() over SSL done? */ bool ssldone; /* Is connect() over SSL done? */
bool login_disabled; /* LOGIN command explicitly disabled by server */ bool login_disabled; /* LOGIN command explicitly disabled by server */
bool ir_supported; /* Initial response supported by server */
}; };
extern const struct Curl_handler Curl_handler_imap; extern const struct Curl_handler Curl_handler_imap;