- allow interrupts when reading, writing or closing sockets (#447887)

- fix possible crash when opening IMAP mailbox
This commit is contained in:
Miroslav Lichvar 2008-06-02 10:44:32 +00:00
parent 4c99360ace
commit 0d28512bce
3 changed files with 87 additions and 1 deletions

20
mutt-1.5.18-imap.patch Normal file
View File

@ -0,0 +1,20 @@
# HG changeset patch
# User Rocco Rutte <pdmef@gmx.net>
# 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;

58
mutt-1.5.18-intr.patch Normal file
View File

@ -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;

View File

@ -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 <mlichvar@redhat.com> 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 <mlichvar@redhat.com> 5:1.5.18-1
- update to 1.5.18