diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-04-02 20:53:43 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-04-05 23:09:04 +0100 |
commit | 3a92de56362dcf39895e3781429fcc4c6877105b (patch) | |
tree | 5b20f8ce0a9901d188eadc9664f1cc580528161e /lib/pop3.c | |
parent | 45d3f0080398d477a830549254e273359865fd41 (diff) | |
download | curl-3a92de56362dcf39895e3781429fcc4c6877105b.tar.gz |
sasl: Combined DIGEST-MD5 message decoding and generation
Diffstat (limited to 'lib/pop3.c')
-rw-r--r-- | lib/pop3.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/lib/pop3.c b/lib/pop3.c index 2716cec65..d33ca0fe5 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2014, 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 @@ -978,10 +978,6 @@ static CURLcode pop3_state_auth_digest_resp(struct connectdata *conn, char *rplyb64 = NULL; size_t len = 0; - char nonce[64]; - char realm[128]; - char algorithm[64]; - (void)instate; /* no use for this yet */ if(pop3code != '+') { @@ -992,29 +988,25 @@ static CURLcode pop3_state_auth_digest_resp(struct connectdata *conn, /* Get the challenge message */ pop3_get_message(data->state.buffer, &chlg64); - /* Decode the challange message */ - result = Curl_sasl_decode_digest_md5_message(chlg64, nonce, sizeof(nonce), - realm, sizeof(realm), - algorithm, sizeof(algorithm)); - if(result || strcmp(algorithm, "md5-sess") != 0) { - /* Send the cancellation */ - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "*"); + /* Create the response message */ + result = Curl_sasl_create_digest_md5_message(data, chlg64, + conn->user, conn->passwd, + "pop", &rplyb64, &len); + if(result) { + if(result == CURLE_BAD_CONTENT_ENCODING) { + /* Send the cancellation */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", "*"); - if(!result) - state(conn, POP3_AUTH_CANCEL); + if(!result) + state(conn, POP3_AUTH_CANCEL); + } } else { - /* Create the response message */ - result = Curl_sasl_create_digest_md5_message(data, nonce, realm, - conn->user, conn->passwd, - "pop", &rplyb64, &len); - if(!result && rplyb64) { - /* Send the response */ - result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", rplyb64); + /* Send the response */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s", rplyb64); - if(!result) - state(conn, POP3_AUTH_DIGESTMD5_RESP); - } + if(!result) + state(conn, POP3_AUTH_DIGESTMD5_RESP); } Curl_safefree(rplyb64); |