Commit cb3d0ce2 authored by Steve Holme's avatar Steve Holme
Browse files

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.
parent f86432b1
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -708,7 +708,6 @@ static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn,
{
  CURLcode result = CURLE_OK;
  struct SessionHandle *data = conn->data;
  size_t plen;
  size_t len = 0;
  char *authpasswd = NULL;

@@ -719,12 +718,7 @@ static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn,
    result = CURLE_LOGIN_DENIED;
  }
  else {
    plen = strlen(conn->passwd);

    if(!plen)
      result = Curl_pp_sendf(&conn->proto.smtpc.pp, "=");
    else {
      result = Curl_base64_encode(data, conn->passwd, plen, &authpasswd, &len);
    result = smtp_auth_login(conn, conn->passwd, &authpasswd, &len);

    if(!result) {
      if(authpasswd) {
@@ -736,7 +730,6 @@ static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn,
      Curl_safefree(authpasswd);
    }
  }
  }

  return result;
}