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

smtp.c: Reworked message encoding in smtp_state_authpasswd_resp()

Rather than encoding the password message itself the
smtp_state_authpasswd_resp() function now delegates the work to the same
function that smtp_state_authlogin_resp() and smtp_authenticate() use
when constructing the encoded user name.
This commit is contained in:
Steve Holme 2012-05-31 22:58:07 +01:00
parent f86432b119
commit cb3d0ce2cb

View File

@ -708,7 +708,6 @@ static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn,
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
size_t plen;
size_t len = 0; size_t len = 0;
char *authpasswd = NULL; char *authpasswd = NULL;
@ -719,22 +718,16 @@ static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn,
result = CURLE_LOGIN_DENIED; result = CURLE_LOGIN_DENIED;
} }
else { else {
plen = strlen(conn->passwd); result = smtp_auth_login(conn, conn->passwd, &authpasswd, &len);
if(!plen) if(!result) {
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "="); if(authpasswd) {
else { result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authpasswd);
result = Curl_base64_encode(data, conn->passwd, plen, &authpasswd, &len);
if(!result) { if(!result)
if(authpasswd) { state(conn, SMTP_AUTH);
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authpasswd);
if(!result)
state(conn, SMTP_AUTH);
}
Curl_safefree(authpasswd);
} }
Curl_safefree(authpasswd);
} }
} }