Add fix for auth_rimap infinite loop (hang) when IMAP server closes connection
Ondřej Surý
8 years ago
0 | From: Jered Floyd <jered@convivian.com> | |
1 | Date: Thu, 24 Mar 2016 11:36:07 +0100 | |
2 | Subject: Fix auth_rimap infinite loop (hang) when IMAP server closes | |
3 | connection | |
4 | ||
5 | --- | |
6 | saslauthd/auth_rimap.c | 4 ++-- | |
7 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
8 | ||
9 | diff --git a/saslauthd/auth_rimap.c b/saslauthd/auth_rimap.c | |
10 | index 06341d7..03584ac 100644 | |
11 | --- a/saslauthd/auth_rimap.c | |
12 | +++ b/saslauthd/auth_rimap.c | |
13 | @@ -494,7 +494,7 @@ auth_rimap ( | |
14 | while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) { | |
15 | if ( FD_ISSET(s, &perm) ) { | |
16 | ret = read(s, rbuf+rc, sizeof(rbuf)-rc); | |
17 | - if ( ret<0 ) { | |
18 | + if ( ret<=0 ) { | |
19 | rc = ret; | |
20 | break; | |
21 | } else { | |
22 | @@ -607,7 +607,7 @@ auth_rimap ( | |
23 | while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) { | |
24 | if ( FD_ISSET(s, &perm) ) { | |
25 | ret = read(s, rbuf+rc, sizeof(rbuf)-rc); | |
26 | - if ( ret<0 ) { | |
27 | + if ( ret<=0 ) { | |
28 | rc = ret; | |
29 | break; | |
30 | } else { |