[Commits] [SCM] claws branch, master, updated. 3.11.1-19-g0ff3e02

ticho at claws-mail.org ticho at claws-mail.org
Sat Nov 15 21:11:58 CET 2014


The branch, master has been updated
       via  0ff3e0287ad189654ce9c24cb60570e624bc53c7 (commit)
      from  434811f2fb961f3d1d4d3f57631037573fe50c5b (commit)

Summary of changes:
 src/common/smtp.c |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit 0ff3e0287ad189654ce9c24cb60570e624bc53c7
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Nov 15 21:11:36 2014 +0100

    Fix SMTP LOGIN auth method.

diff --git a/src/common/smtp.c b/src/common/smtp.c
index 3b94b47..4c818d8 100644
--- 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");
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list