aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-07 20:02:06 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-07 20:02:06 +0000
commit86dfcf737d1b05c7c731f098ff8c0e0ab87040fa (patch)
treea68c371bfee89d0d7ff432d07bf3fdec5ea8775c
parent4ed469a56fd2ff7d4c85a7cf14c871a54f06fa2e (diff)
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.
-rw-r--r--lib/imap.c11
-rw-r--r--lib/imap.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 72774c089..ebf04218a 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -24,6 +24,7 @@
* RFC3501 IMAPv4 protocol
* RFC4422 Simple Authentication and Security Layer (SASL)
* RFC4616 PLAIN authentication
+ * RFC4959 IMAP Extension for SASL Initial Client Response
* RFC5092 IMAP URL Scheme
*
***************************************************************************/
@@ -374,6 +375,10 @@ static int imap_endofresp(struct pingpong *pp, int *resp)
if(wordlen == 13 && !memcmp(line, "LOGINDISABLED", 13))
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? */
else if(wordlen > 5 && !memcmp(line, "AUTH=", 5)) {
line += 5;
@@ -676,7 +681,7 @@ static CURLcode imap_state_capability_resp(struct connectdata *conn,
return result;
}
-/* For AUTHENTICATE PLAIN responses */
+/* For AUTHENTICATE PLAIN (without initial response) responses */
static CURLcode imap_state_auth_plain_resp(struct connectdata *conn,
int imapcode,
imapstate instate)
@@ -713,7 +718,7 @@ static CURLcode imap_state_auth_plain_resp(struct connectdata *conn,
return result;
}
-/* For AUTHENTICATE LOGIN responses */
+/* For AUTHENTICATE LOGIN (without initial response) responses */
static CURLcode imap_state_auth_login_resp(struct connectdata *conn,
int imapcode,
imapstate instate)
@@ -910,7 +915,7 @@ static CURLcode imap_state_auth_digest_resp_resp(struct connectdata *conn,
#endif
#ifdef USE_NTLM
-/* For AUTHENTICATE NTLM responses */
+/* For AUTHENTICATE NTLM (without initial response) responses */
static CURLcode imap_state_auth_ntlm_resp(struct connectdata *conn,
int imapcode,
imapstate instate)
diff --git a/lib/imap.h b/lib/imap.h
index 5cbae751a..eeedcff17 100644
--- a/lib/imap.h
+++ b/lib/imap.h
@@ -63,6 +63,7 @@ struct imap_conn {
char resptag[5]; /* Response tag to wait for */
bool ssldone; /* Is connect() over SSL done? */
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;