From 0d28512bce4b44445857e0cc59b967a4ce2d695b Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 2 Jun 2008 10:44:32 +0000 Subject: [PATCH] - allow interrupts when reading, writing or closing sockets (#447887) - fix possible crash when opening IMAP mailbox --- mutt-1.5.18-imap.patch | 20 +++++++++++++++ mutt-1.5.18-intr.patch | 58 ++++++++++++++++++++++++++++++++++++++++++ mutt.spec | 10 +++++++- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 mutt-1.5.18-imap.patch create mode 100644 mutt-1.5.18-intr.patch diff --git a/mutt-1.5.18-imap.patch b/mutt-1.5.18-imap.patch new file mode 100644 index 0000000..f02b1e1 --- /dev/null +++ b/mutt-1.5.18-imap.patch @@ -0,0 +1,20 @@ +# HG changeset patch +# User Rocco Rutte +# Date 1211437223 25200 +# Branch HEAD +# Node ID bba92e40144004664f0ff20dddc82d253f5a656d +# Parent 51c494a2e735c8f6a8338b26d932b54c5d8a9a7d +Guard idata->mailbox read in imap_mailbox_state. Closes #3057. + +diff -r 51c494a2e735 -r bba92e401440 imap/browse.c +--- a/imap/browse.c Wed May 21 22:59:22 2008 -0700 ++++ b/imap/browse.c Wed May 21 23:20:23 2008 -0700 +@@ -228,7 +228,7 @@ int imap_mailbox_state (const char* path + return -1; + } + +- if (!imap_mxcmp(mx.mbox, idata->mailbox)) ++ if (idata->ctx && !imap_mxcmp(mx.mbox, idata->mailbox)) + { + state->new = idata->ctx->new; + state->messages = idata->ctx->msgcount; diff --git a/mutt-1.5.18-intr.patch b/mutt-1.5.18-intr.patch new file mode 100644 index 0000000..f09bff1 --- /dev/null +++ b/mutt-1.5.18-intr.patch @@ -0,0 +1,58 @@ +diff -up mutt-1.5.18/mutt_socket.c.intr mutt-1.5.18/mutt_socket.c +--- mutt-1.5.18/mutt_socket.c.intr 2008-01-28 03:20:23.000000000 +0100 ++++ mutt-1.5.18/mutt_socket.c 2008-05-22 16:49:04.000000000 +0200 +@@ -75,10 +75,12 @@ int mutt_socket_close (CONNECTION* conn) + { + int rc = -1; + ++ mutt_allow_interrupt (1); + if (conn->fd < 0) + dprint (1, (debugfile, "mutt_socket_close: Attempt to close closed connection.\n")); + else + rc = conn->conn_close (conn); ++ mutt_allow_interrupt (0); + + conn->fd = -1; + conn->ssf = 0; +@@ -96,7 +98,9 @@ int mutt_socket_read (CONNECTION* conn, + return -1; + } + ++ mutt_allow_interrupt (1); + rc = conn->conn_read (conn, buf, len); ++ mutt_allow_interrupt (0); + /* EOF */ + if (rc == 0) + { +@@ -123,14 +127,17 @@ int mutt_socket_write_d (CONNECTION *con + + if (len < 0) + len = mutt_strlen (buf); ++ mutt_allow_interrupt (1); + if ((rc = conn->conn_write (conn, buf, len)) < 0) + { ++ mutt_allow_interrupt (0); + dprint (1, (debugfile, + "mutt_socket_write: error writing, closing socket\n")); + mutt_socket_close (conn); + + return -1; + } ++ mutt_allow_interrupt (0); + + if (rc < len) + { +@@ -161,9 +168,11 @@ int mutt_socket_readchar (CONNECTION *co + { + if (conn->bufpos >= conn->available) + { +- if (conn->fd >= 0) ++ if (conn->fd >= 0) { ++ mutt_allow_interrupt (1); + conn->available = conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf)); +- else ++ mutt_allow_interrupt (0); ++ } else + { + dprint (1, (debugfile, "mutt_socket_readchar: attempt to read from closed connection.\n")); + return -1; diff --git a/mutt.spec b/mutt.spec index 28e57af..cd49d10 100644 --- a/mutt.spec +++ b/mutt.spec @@ -15,7 +15,7 @@ Summary: A text mode mail user agent Name: mutt Version: 1.5.18 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 5 # The entire source code is GPLv2+ except # pgpewrap.c setenv.c sha1.c wcwidth.c which are Public Domain @@ -26,6 +26,8 @@ Source1: mutt_ldap_query Patch2: mutt-1.5.13-nodotlock.patch Patch3: mutt-1.5.18-muttrc.patch Patch4: mutt-1.5.18-manual.patch +Patch5: mutt-1.5.18-intr.patch +Patch6: mutt-1.5.18-imap.patch Url: http://www.mutt.org/ Requires: mailcap urlview BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -63,6 +65,8 @@ for selecting groups of messages. %patch2 -p1 -b .nodl %patch3 -p1 -b .muttrc %patch4 -p1 -b .manual +%patch5 -p1 -b .intr +%patch6 -p1 -b .imap install -p -m644 %{SOURCE1} mutt_ldap_query @@ -137,6 +141,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man5/muttrc.* %changelog +* Mon Jun 02 2008 Miroslav Lichvar 5:1.5.18-2 +- allow interrupts when reading, writing or closing sockets (#447887) +- fix possible crash when opening IMAP mailbox + * Mon May 19 2008 Miroslav Lichvar 5:1.5.18-1 - update to 1.5.18