aboutsummaryrefslogtreecommitdiff
path: root/lib/pop3.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-10-27 12:34:56 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-10-27 12:42:30 +0000
commit1e39b95682781fd9117eef094f6fd8c58b443610 (patch)
tree966e5f3f8645bcdcc56772e1dbac5cc8db54a0e0 /lib/pop3.c
parent8230af0b9420617f275bd4dea921610e960bb997 (diff)
email: Added support for canceling CRAM-MD5 authentication
Diffstat (limited to 'lib/pop3.c')
-rw-r--r--lib/pop3.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/pop3.c b/lib/pop3.c
index f4dc5d1b3..d4075f4b3 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -964,6 +964,7 @@ static CURLcode pop3_state_auth_cram_resp(struct connectdata *conn,
{
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
+ char *chlg = NULL;
char *chlg64 = NULL;
char *rplyb64 = NULL;
size_t len = 0;
@@ -978,22 +979,31 @@ static CURLcode pop3_state_auth_cram_resp(struct connectdata *conn,
/* Get the challenge message */
pop3_get_message(data->state.buffer, &chlg64);
- /* Create the response message */
- result = Curl_sasl_create_cram_md5_message(data, chlg64, conn->user,
- conn->passwd, &rplyb64, &len);
+ /* Decode the challenge message */
+ result = Curl_sasl_decode_cram_md5_message(chlg64, &chlg, &len);
+ if(result) {
+ /* Send the cancellation */
+ result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "*");
- /* Send the response */
- if(!result) {
- if(rplyb64) {
+ if(!result)
+ state(conn, POP3_AUTH_CANCEL);
+ }
+ else {
+ /* Create the response message */
+ result = Curl_sasl_create_cram_md5_message(data, chlg64, conn->user,
+ conn->passwd, &rplyb64, &len);
+ if(!result && rplyb64) {
+ /* Send the response */
result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", rplyb64);
if(!result)
state(conn, POP3_AUTH_FINAL);
}
-
- Curl_safefree(rplyb64);
}
+ Curl_safefree(chlg);
+ Curl_safefree(rplyb64);
+
return result;
}