talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 0ff3e0287ad189654ce9c24cb60570e624bc53c7
parent 434811f2fb961f3d1d4d3f57631037573fe50c5b
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Sat, 15 Nov 2014 21:11:36 +0100

Fix SMTP LOGIN auth method.

Diffstat:
Msrc/common/smtp.c | 20+++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/common/smtp.c b/src/common/smtp.c @@ -196,6 +196,7 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg) if (!strncmp(msg, "334 ", 4)) { tmp = g_base64_encode(session->user, strlen(session->user)); + debug_print("|%s|\n", tmp); if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, tmp) < 0) { @@ -268,29 +269,22 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg) static gint smtp_auth_login_user_recv(SMTPSession *session, const gchar *msg) { - gchar buf[MESSAGEBUFSIZE], *tmp; - gsize len; + gchar *tmp; session->state = SMTP_AUTH_LOGIN_PASS; if (!strncmp(msg, "334 ", 4)) { tmp = g_base64_encode(session->pass, strlen(session->pass)); - len = g_strlcat(buf, tmp, MESSAGEBUFSIZE); - if (len >= MESSAGEBUFSIZE) { - /* This should never happen, and even if it does, all it will do - * is send an incorrect password so auth will fail. That's why - * we're printing this debug message, so investigating user or dev - * will know what's wrong. */ - debug_print("Truncation of password occured in g_strlcat().\n"); - } - g_free(tmp); } else { /* Server rejects AUTH */ - g_snprintf(buf, sizeof(buf), "*"); + tmp = g_strdup("*"); } - if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, tmp) < 0) { + g_free(tmp); return SM_ERROR; + } + g_free(tmp); log_print(LOG_PROTOCOL, "ESMTP> [PASSWORD]\n");