From a965af97b4138062deb4f3bb3a95c32b23ec7d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Arreola=20Rodr=C3=ADguez?= Date: Sat, 29 Oct 2022 21:53:20 -0500 Subject: [PATCH] =?UTF-8?q?Parcho=20el=20=C3=BAltimo=20mensaje=20tomado=20?= =?UTF-8?q?de=20las=20lineas=20de=20estatus.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/smtp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/smtp.c b/src/smtp.c index fce3881..5dd801a 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -210,6 +210,7 @@ int smtp_session_continue (SMTPSession *session, int what) { char linea[8192]; size_t linea_size; int res; + int e; if (session->internal == SMTP_INTERNAL_FREE) { return SMTP_ERROR; @@ -285,6 +286,12 @@ smtp_continue_read_line_again: /* Linea buena, guardar el estado y el mensaje de la linea */ /* Estamos conectados */ strncpy (session->last_message, &linea[4], sizeof (session->last_message) - 1); + e = strlen (session->last_message) - 1; + while (e > 0 && (session->last_message[e] == '\r' || session->last_message[e] == '\n')) { + session->last_message[e] = 0; + e--; + } + session->last_code = ((linea[0] - '0') * 100) + ((linea[1] - '0') * 10) + (linea[2] - '0'); /* Correr la funciĆ³n correcta para pasar al siguiente estado */ switch (session->estado) {