]>
Commit | Line | Data |
---|---|---|
c29ea386 JR |
1 | --- a/saslauthd/auth_rimap.c |
2 | +++ b/saslauthd/auth_rimap.c | |
3 | @@ -1,3 +1,4 @@ | |
4 | + | |
5 | /* MODULE: auth_rimap */ | |
6 | ||
7 | /* COPYRIGHT | |
8 | @@ -367,6 +368,30 @@ auth_rimap ( | |
9 | alarm(NETWORK_IO_TIMEOUT); | |
10 | rc = read(s, rbuf, sizeof(rbuf)); | |
11 | alarm(0); | |
12 | + if ( rc>0 ) { | |
13 | + /* check if there is more to read */ | |
14 | + fd_set perm; | |
15 | + int fds, ret; | |
16 | + struct timeval timeout; | |
17 | + | |
18 | + FD_ZERO(&perm); | |
19 | + FD_SET(s, &perm); | |
20 | + fds = s +1; | |
21 | + | |
22 | + timeout.tv_sec = 1; | |
23 | + timeout.tv_usec = 0; | |
24 | + while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) { | |
25 | + if ( FD_ISSET(s, &perm) ) { | |
26 | + ret = read(s, rbuf+rc, sizeof(rbuf)-rc); | |
27 | + if ( ret<0 ) { | |
28 | + rc = ret; | |
29 | + break; | |
30 | + } else { | |
31 | + rc += ret; | |
32 | + } | |
33 | + } | |
34 | + } | |
35 | + } | |
36 | if (rc == -1) { | |
37 | syslog(LOG_WARNING, "auth_rimap: read (banner): %m"); | |
38 | (void) close(s); | |
39 | @@ -456,6 +481,30 @@ auth_rimap ( | |
40 | alarm(NETWORK_IO_TIMEOUT); | |
41 | rc = read(s, rbuf, sizeof(rbuf)); | |
42 | alarm(0); | |
43 | + if ( rc>0 ) { | |
44 | + /* check if there is more to read */ | |
45 | + fd_set perm; | |
46 | + int fds, ret; | |
47 | + struct timeval timeout; | |
48 | + | |
49 | + FD_ZERO(&perm); | |
50 | + FD_SET(s, &perm); | |
51 | + fds = s +1; | |
52 | + | |
53 | + timeout.tv_sec = 1; | |
54 | + timeout.tv_usec = 0; | |
55 | + while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) { | |
56 | + if ( FD_ISSET(s, &perm) ) { | |
57 | + ret = read(s, rbuf+rc, sizeof(rbuf)-rc); | |
58 | + if ( ret<0 ) { | |
59 | + rc = ret; | |
60 | + break; | |
61 | + } else { | |
62 | + rc += ret; | |
63 | + } | |
64 | + } | |
65 | + } | |
66 | + } | |
67 | (void) close(s); /* we're done with the remote */ | |
68 | if (rc == -1) { | |
69 | syslog(LOG_WARNING, "auth_rimap: read (response): %m"); | |
70 | --- a/lib/checkpw.c | |
71 | +++ b/lib/checkpw.c | |
72 | @@ -587,16 +587,14 @@ static int read_wait(int fd, unsigned de | |
73 | /* Timeout. */ | |
74 | errno = ETIMEDOUT; | |
75 | return -1; | |
76 | - case +1: | |
77 | - if (FD_ISSET(fd, &rfds)) { | |
78 | - /* Success, file descriptor is readable. */ | |
79 | - return 0; | |
80 | - } | |
81 | - return -1; | |
82 | case -1: | |
83 | if (errno == EINTR || errno == EAGAIN) | |
84 | continue; | |
85 | default: | |
86 | + if (FD_ISSET(fd, &rfds)) { | |
87 | + /* Success, file descriptor is readable. */ | |
88 | + return 0; | |
89 | + } | |
90 | /* Error catch-all. */ | |
91 | return -1; | |
92 | } |