From 3a705907a7f767328d9778e6fa6bf3892713fe55 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Wed, 21 Dec 2005 17:28:49 +0000 Subject: [PATCH 1/1] 2005-12-21 [colin] 1.9.100cvs101 * configure.ac Fix DATADIRNAME * COPYING Fix missing section and explicit the exception better * src/compose.c Prevent mail from being lost without notice when an SMTP error happens on trying to send an unmodified drafted mail. * src/send_message.c * src/common/smtp.c Fix password remembering when wrong, and add return value checks where they should have been * src/plugins/pgpcore/sylpheed.def * src/plugins/pgpinline/sylpheed.def * src/plugins/pgpmime/sylpheed.def Add a few symbols needed --- COPYING | 73 +++++++++++++++++- ChangeLog | 19 +++++ PATCHSETS | 1 + configure.ac | 7 +- src/common/smtp.c | 114 +++++++++++++++-------------- src/compose.c | 3 + src/plugins/pgpcore/sylpheed.def | 2 + src/plugins/pgpinline/sylpheed.def | 1 + src/plugins/pgpmime/sylpheed.def | 1 + src/send_message.c | 19 +++-- 10 files changed, 178 insertions(+), 62 deletions(-) diff --git a/COPYING b/COPYING index 5b67f7b6a..36af8274c 100644 --- a/COPYING +++ b/COPYING @@ -1,8 +1,14 @@ The code in this distribution is Copyright 1999-2005 by Hiroyuki Yamamoto and the Sylpheed-Claws team. -Specific permission is granted for the GPLed code in this distribition to -be linked to OpenSSL without invoking GPL clause 2(b). +As a special exception, the Sylpheed-Claws team gives permission to link +the code of its release of Sylpheed-Claws with the OpenSSL project's +"OpenSSL" library (or with modified versions of it that use the same +license as the "OpenSSL" library), and distribute the linked executables. +You must obey the GNU General Public License in all respects for all of the +code used other than "OpenSSL". If you modify this file, you may extend this +exception to your version of the file, but you are not obliged to do so. If +you do not wish to do so, delete this exception statement from your version. ------------------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE @@ -283,4 +289,65 @@ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -------------------------------------------------------------------------------- + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog index 99769dd5a..5f198348a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2005-12-21 [colin] 1.9.100cvs101 + + * configure.ac + Fix DATADIRNAME + * COPYING + Fix missing section and explicit the exception better + * src/compose.c + Prevent mail from being lost without notice when an + SMTP error happens on trying to send an unmodified + drafted mail. + * src/send_message.c + * src/common/smtp.c + Fix password remembering when wrong, and add return + value checks where they should have been + * src/plugins/pgpcore/sylpheed.def + * src/plugins/pgpinline/sylpheed.def + * src/plugins/pgpmime/sylpheed.def + Add a few symbols needed + 2005-12-21 [paul] 1.9.100cvs100 * m4/codeset.m4 diff --git a/PATCHSETS b/PATCHSETS index aed6c5d3a..49b278f54 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -1084,3 +1084,4 @@ ( cvs diff -u -r 1.4.2.4 -r 1.4.2.5 po/sv.po; ) > 1.9.100cvs98.patchset ( cvs diff -u -r 1.4.2.5 -r 1.4.2.6 po/sv.po; ) > 1.9.100cvs99.patchset ( diff -u /dev/null m4/codeset.m4; diff -u /dev/null m4/glibc21.m4; diff -u /dev/null m4/intdiv0.m4; diff -u /dev/null m4/inttypes-pri.m4; diff -u /dev/null m4/inttypes.m4; diff -u /dev/null m4/inttypes_h.m4; diff -u /dev/null m4/isc-posix.m4; diff -u /dev/null m4/lcmessage.m4; diff -u /dev/null m4/stdint_h.m4; diff -u /dev/null m4/uintmax_t.m4; ) > 1.9.100cvs100.patchset +( cvs diff -u -r 1.654.2.1130 -r 1.654.2.1131 configure.ac; cvs diff -u -r 1.5.10.1 -r 1.5.10.2 COPYING; cvs diff -u -r 1.382.2.209 -r 1.382.2.210 src/compose.c; cvs diff -u -r 1.17.2.24 -r 1.17.2.25 src/send_message.c; cvs diff -u -r 1.11.2.14 -r 1.11.2.15 src/common/smtp.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpcore/sylpheed.def; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpinline/sylpheed.def; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/sylpheed.def; ) > 1.9.100cvs101.patchset diff --git a/configure.ac b/configure.ac index 21d7a8353..b05709353 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=100 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=100 +EXTRA_VERSION=101 EXTRA_RELEASE= EXTRA_GTK2_VERSION= @@ -159,6 +159,11 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.]) AM_GNU_GETTEXT_VERSION([0.14.5]) AM_GNU_GETTEXT([external]) +if test "x${DATADIRNAME}" = "x"; then + DATADIRNAME="share" + AC_SUBST(DATADIRNAME) +fi + localedir='${prefix}/${DATADIRNAME}/locale' AC_ARG_WITH(localedir, [ --with-localedir=DIR Locale directory], diff --git a/src/common/smtp.c b/src/common/smtp.c index a936a19fa..4dfe26251 100644 --- a/src/common/smtp.c +++ b/src/common/smtp.c @@ -144,7 +144,8 @@ gint smtp_from(SMTPSession *session) g_free(mail_size); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) + return SM_ERROR; log_print("%sSMTP> %s\n", (session->is_esmtp?"E":""), buf); return SM_OK; @@ -188,13 +189,15 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg) if (!strncmp(msg, "334 ", 4)) { base64_encode(buf, session->user, strlen(session->user)); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, - buf); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, + buf) < 0) + return SM_ERROR; log_print("ESMTP> [USERID]\n"); } else { /* Server rejects AUTH */ - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, - "*"); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, + "*") < 0) + return SM_ERROR; log_print("ESMTP> *\n"); } break; @@ -226,21 +229,24 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg) base64_encode(response64, response, strlen(response)); g_free(response); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, - response64); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, + response64) < 0) + return SM_ERROR; log_print("ESMTP> %s\n", response64); g_free(response64); } else { /* Server rejects AUTH */ - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, - "*"); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, + "*") < 0) + return SM_ERROR; log_print("ESMTP> *\n"); } break; case SMTPAUTH_DIGEST_MD5: default: /* stop smtp_auth when no correct authtype */ - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "*"); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "*") < 0) + return SM_ERROR; log_print("ESMTP> *\n"); break; } @@ -260,7 +266,9 @@ static gint smtp_auth_login_user_recv(SMTPSession *session, const gchar *msg) /* Server rejects AUTH */ g_snprintf(buf, sizeof(buf), "*"); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) + return SM_ERROR; + log_print("ESMTP> [PASSWORD]\n"); return SM_OK; @@ -276,7 +284,8 @@ static gint smtp_ehlo(SMTPSession *session) g_snprintf(buf, sizeof(buf), "EHLO %s", session->hostname ? session->hostname : get_domain_name()); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) + return SM_ERROR; log_print("ESMTP> %s\n", buf); return SM_OK; @@ -323,7 +332,8 @@ static gint smtp_starttls(SMTPSession *session) { session->state = SMTP_STARTTLS; - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "STARTTLS"); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "STARTTLS") < 0) + return SM_ERROR; log_print("ESMTP> STARTTLS\n"); return SM_OK; @@ -334,7 +344,8 @@ static gint smtp_auth_cram_md5(SMTPSession *session) session->state = SMTP_AUTH; session->auth_type = SMTPAUTH_CRAM_MD5; - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "AUTH CRAM-MD5"); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "AUTH CRAM-MD5") < 0) + return SM_ERROR; log_print("ESMTP> AUTH CRAM-MD5\n"); return SM_OK; @@ -383,7 +394,8 @@ static gint smtp_auth_plain(SMTPSession *session) a = buf + strlen(buf); base64_encode(a, b64buf, b64cnt); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) + return SM_ERROR; log_print("ESMTP> [AUTH PLAIN]\n"); @@ -397,7 +409,8 @@ static gint smtp_auth_login(SMTPSession *session) session->state = SMTP_AUTH; session->auth_type = SMTPAUTH_LOGIN; - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "AUTH LOGIN"); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "AUTH LOGIN") < 0) + return SM_ERROR; log_print("ESMTP> AUTH LOGIN\n"); return SM_OK; @@ -411,7 +424,8 @@ static gint smtp_helo(SMTPSession *session) g_snprintf(buf, sizeof(buf), "HELO %s", session->hostname ? session->hostname : get_domain_name()); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) + return SM_ERROR; log_print("SMTP> %s\n", buf); return SM_OK; @@ -432,7 +446,8 @@ static gint smtp_rcpt(SMTPSession *session) g_snprintf(buf, sizeof(buf), "RCPT TO:%s", to); else g_snprintf(buf, sizeof(buf), "RCPT TO:<%s>", to); - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) + return SM_ERROR; log_print("SMTP> %s\n", buf); session->cur_to = session->cur_to->next; @@ -444,7 +459,8 @@ static gint smtp_data(SMTPSession *session) { session->state = SMTP_DATA; - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "DATA"); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "DATA") < 0) + return SM_ERROR; log_print("SMTP> DATA\n"); return SM_OK; @@ -460,18 +476,6 @@ static gint smtp_send_data(SMTPSession *session) return SM_OK; } -#if 0 -static gint smtp_rset(SMTPSession *session) -{ - session->state = SMTP_RSET; - - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "RSET"); - log_print("SMTP> RSET\n"); - - return SM_OK; -} -#endif - static gint smtp_make_ready(SMTPSession *session) { session->state = SMTP_MAIL_SENT_OK; @@ -493,7 +497,8 @@ static gint smtp_eom(SMTPSession *session) { session->state = SMTP_EOM; - session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "."); + if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, ".") < 0) + return SM_ERROR; log_print("SMTP> . (EOM)\n"); return SM_OK; @@ -503,7 +508,8 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg) { SMTPSession *smtp_session = SMTP_SESSION(session); gboolean cont = FALSE; - + gint ret = 0; + if (strlen(msg) < 4) { log_warning(_("bad SMTP response\n")); return -1; @@ -576,15 +582,15 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg) #else if (smtp_session->user || smtp_session->is_esmtp) #endif - smtp_ehlo(smtp_session); + ret = smtp_ehlo(smtp_session); else - smtp_helo(smtp_session); + ret = smtp_helo(smtp_session); break; case SMTP_HELO: - smtp_from(smtp_session); + ret = smtp_from(smtp_session); break; case SMTP_EHLO: - smtp_ehlo_recv(smtp_session, msg); + ret = smtp_ehlo_recv(smtp_session, msg); if (cont == TRUE) break; if (smtp_session->max_message_size > 0 @@ -601,7 +607,7 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg) #if USE_OPENSSL if (session->ssl_type == SSL_STARTTLS && smtp_session->tls_init_done == FALSE) { - smtp_starttls(smtp_session); + ret = smtp_starttls(smtp_session); break; } #endif @@ -611,13 +617,13 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg) if (session->ssl_type == SSL_NONE && smtp_session->tls_init_done == FALSE && (smtp_session->avail_auth_type & SMTPAUTH_TLS_AVAILABLE)) - smtp_starttls(smtp_session); + ret = smtp_starttls(smtp_session); else #endif - smtp_from(smtp_session); + ret = smtp_from(smtp_session); } } else - smtp_from(smtp_session); + ret = smtp_from(smtp_session); break; case SMTP_STARTTLS: #if USE_OPENSSL @@ -628,32 +634,32 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg) return -1; } smtp_session->tls_init_done = TRUE; - smtp_ehlo(smtp_session); + ret = smtp_ehlo(smtp_session); #endif break; case SMTP_AUTH: - smtp_auth_recv(smtp_session, msg); + ret = smtp_auth_recv(smtp_session, msg); break; case SMTP_AUTH_LOGIN_USER: - smtp_auth_login_user_recv(smtp_session, msg); + ret = smtp_auth_login_user_recv(smtp_session, msg); break; case SMTP_AUTH_PLAIN: case SMTP_AUTH_LOGIN_PASS: case SMTP_AUTH_CRAM_MD5: - smtp_from(smtp_session); + ret = smtp_from(smtp_session); break; case SMTP_FROM: if (smtp_session->cur_to) - smtp_rcpt(smtp_session); + ret = smtp_rcpt(smtp_session); break; case SMTP_RCPT: if (smtp_session->cur_to) - smtp_rcpt(smtp_session); + ret = smtp_rcpt(smtp_session); else - smtp_data(smtp_session); + ret = smtp_data(smtp_session); break; case SMTP_DATA: - smtp_send_data(smtp_session); + ret = smtp_send_data(smtp_session); break; case SMTP_EOM: smtp_make_ready(smtp_session); @@ -668,14 +674,16 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg) return -1; } - if (cont) + if (cont && ret == SM_OK) return session_recv_msg(session); - return 0; + if (ret != SM_OK) + smtp_session->error_val = SM_ERROR; + + return ret == SM_OK ? 0 : -1; } static gint smtp_session_send_data_finished(Session *session, guint len) { - smtp_eom(SMTP_SESSION(session)); - return 0; + return smtp_eom(SMTP_SESSION(session)); } diff --git a/src/compose.c b/src/compose.c index 4277c4281..cd06f1a19 100644 --- a/src/compose.c +++ b/src/compose.c @@ -3766,6 +3766,7 @@ gint compose_send(Compose *compose) "the main window to retry.")); if (prefs_common.send_dialog_mode == SEND_DIALOG_ALWAYS) { compose->sending = FALSE; + compose->modified = TRUE; compose_allow_user_actions (compose, TRUE); } return 0; @@ -3795,6 +3796,7 @@ gint compose_send(Compose *compose) "the main window to retry.")); if (prefs_common.send_dialog_mode == SEND_DIALOG_ALWAYS) { compose_allow_user_actions (compose, TRUE); + compose->modified = TRUE; compose->sending = FALSE; } return -1; @@ -3805,6 +3807,7 @@ gint compose_send(Compose *compose) bail: compose_allow_user_actions (compose, TRUE); compose->sending = FALSE; + compose->modified = TRUE; return -1; } diff --git a/src/plugins/pgpcore/sylpheed.def b/src/plugins/pgpcore/sylpheed.def index 08791468e..cc937916f 100644 --- a/src/plugins/pgpcore/sylpheed.def +++ b/src/plugins/pgpcore/sylpheed.def @@ -28,3 +28,5 @@ prefs_set_default prefs_write_open prefs_write_param sylpheed_get_version +prefs_button_toggled +debug_srcname diff --git a/src/plugins/pgpinline/sylpheed.def b/src/plugins/pgpinline/sylpheed.def index 7b199fd05..dbb6339ce 100644 --- a/src/plugins/pgpinline/sylpheed.def +++ b/src/plugins/pgpinline/sylpheed.def @@ -25,3 +25,4 @@ sgpgme_sigstat_info_full sgpgme_sigstat_info_short sgpgme_verify_signature sylpheed_get_version +debug_srcname diff --git a/src/plugins/pgpmime/sylpheed.def b/src/plugins/pgpmime/sylpheed.def index 09dc17d23..7681a98a2 100644 --- a/src/plugins/pgpmime/sylpheed.def +++ b/src/plugins/pgpmime/sylpheed.def @@ -15,3 +15,4 @@ procmime_mimeinfo_parent procmime_scan_file procmime_write_mimeinfo sylpheed_get_version +debug_srcname diff --git a/src/send_message.c b/src/send_message.c index b92bd8204..0e0ef04f3 100644 --- a/src/send_message.c +++ b/src/send_message.c @@ -232,8 +232,10 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g input_dialog_query_password (ac_prefs->smtp_server, smtp_session->user); - if (!smtp_session->pass) - smtp_session->pass = g_strdup(""); + if (!smtp_session->pass) { + session_destroy(session); + return -1; + } ac_prefs->tmp_smtp_pass = g_strdup(smtp_session->pass); } @@ -249,8 +251,10 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g input_dialog_query_password (ac_prefs->smtp_server, smtp_session->user); - if (!smtp_session->pass) - smtp_session->pass = g_strdup(""); + if (!smtp_session->pass) { + session_destroy(session); + return -1; + } ac_prefs->tmp_pass = g_strdup(smtp_session->pass); } @@ -278,8 +282,10 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g _("Con_tinue connecting"), GTK_STOCK_CANCEL, NULL, FALSE, NULL, ALERT_WARNING, - G_ALERTALTERNATE) != G_ALERTDEFAULT) + G_ALERTALTERNATE) != G_ALERTDEFAULT) { + session_destroy(session); return -1; + } } port = ac_prefs->set_smtpport ? ac_prefs->smtpport : SMTP_PORT; #endif @@ -355,6 +361,9 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g if (ac_prefs->smtp_userid && ac_prefs->tmp_smtp_pass) { g_free(ac_prefs->tmp_smtp_pass); ac_prefs->tmp_smtp_pass = NULL; + } else if (ac_prefs->tmp_pass) { + g_free(ac_prefs->tmp_pass); + ac_prefs->tmp_pass = NULL; } ret = -1; } else if (SMTP_SESSION(session)->state == SMTP_MAIL_SENT_OK) { -- 2.25.1