From 9c0bfcfdc62200e9d6a0687ab2106991effb8049 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Thu, 8 Jul 2004 09:50:52 +0000 Subject: [PATCH] sync smtp size verification with head --- ChangeLog-gtk2.claws | 6 ++++++ PATCHSETS | 1 + configure.ac | 2 +- src/common/smtp.c | 16 ++++++++++++++++ src/common/smtp.h | 2 ++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index e9414be40..93d9a173f 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,9 @@ +2004-07-08 [colin] 0.9.11cvs17.12 + + * src/common/smtp.c + * src/common/smtp.h + Sync smtp size verification with HEAD + 2004-07-08 [colin] 0.9.11cvs17.11 * src/summaryview.c diff --git a/PATCHSETS b/PATCHSETS index 9d9530830..0e6396cec 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -5,3 +5,4 @@ 1.1.4.1 1.87.2.5 -r 1.2.4.1 1.1.4.1 1.87.2.6 src/folder.h; cvs diff -u -r 1.149.2.6 -r 1.149.2.7 src/inc.c; cvs diff -u -r 1.94.2.7 -r 1.94.2.8 src/messageview.c; cvs diff -u -r 1.47.2.5 -r 1.47.2.6 src/procheader.c; cvs diff -u -r 1.150.2.3 -r 1.150.2.4 src/procmsg.c; cvs diff -u -r 1.60.2.4 -r 1.60.2.5 src/procmsg.h; ) > 0.9.11cvs17.10.patchset ( cvs diff -u -r 1.395.2.15 -r 1.395.2.16 src/summaryview.c; cvs diff -u -r 1.204.2.11 -r 1.204.2.12 src/prefs_common.c; cvs diff -u -r 1.103.2.5 -r 1.103.2.6 src/prefs_common.h; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/gtk/quicksearch.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/gtk/quicksearch.h; ) > 0.9.11cvs17.11.patchset +( cvs diff -u -r 1.11.2.1 -r 1.11.2.2 src/common/smtp.c; cvs diff -u -r 1.6 -r 1.7 src/common/smtp.h; ) > 0.9.11cvs17.12.patchset diff --git a/configure.ac b/configure.ac index 195d80151..25d40f5af 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=11 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=17.11 +EXTRA_VERSION=17.12 EXTRA_RELEASE= if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then diff --git a/src/common/smtp.c b/src/common/smtp.c index 39ccbb90a..6c4f7f963 100644 --- a/src/common/smtp.c +++ b/src/common/smtp.c @@ -90,6 +90,8 @@ Session *smtp_session_new(void) session->send_data = NULL; session->send_data_len = 0; + session->max_message_size = -1; + session->avail_auth_type = 0; session->forced_auth_type = 0; session->auth_type = 0; @@ -276,6 +278,10 @@ static gint smtp_ehlo_recv(SMTPSession *session, const gchar *msg) if (strcasestr(p, "DIGEST-MD5")) session->avail_auth_type |= SMTPAUTH_DIGEST_MD5; } + if (g_strncasecmp(p, "SIZE", 4) == 0) { + p += 5; + session->max_message_size = atoi(p); + } return SM_OK; } else if ((msg[0] == '1' || msg[0] == '2' || msg[0] == '3') && (msg[3] == ' ' || msg[3] == '\0')) @@ -492,6 +498,16 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg) smtp_ehlo_recv(smtp_session, msg); if (cont == TRUE) break; + if (smtp_session->max_message_size > 0 + && smtp_session->max_message_size < + smtp_session->send_data_len) { + log_warning(_("Message is too big " + "(Maximum size is %dKB)\n"), + smtp_session->max_message_size / 1024); + smtp_session->state = SMTP_ERROR; + smtp_session->error_val = SM_ERROR; + return -1; + } #if USE_OPENSSL if (session->ssl_type == SSL_STARTTLS && smtp_session->tls_init_done == FALSE) { diff --git a/src/common/smtp.h b/src/common/smtp.h index a8234f564..4212234a0 100644 --- a/src/common/smtp.h +++ b/src/common/smtp.h @@ -103,6 +103,8 @@ struct _SMTPSession guchar *send_data; guint send_data_len; + guint max_message_size; + SMTPAuthType avail_auth_type; SMTPAuthType forced_auth_type; SMTPAuthType auth_type; -- 2.25.1