[Dovecot] Disconnects with proxies / new facts

Michael Kress kress at hal.saar.de
Mon Mar 5 15:24:45 EET 2007


Michael Kress wrote:
> Timo Sirainen wrote:
>> v0.99.12 2004-12-05  Timo Sirainen <tss at iki.fi>
>>
>>         - IMAP and POP3 login processes may have sent each line in 
>> two IP
>>           packets, one with the data and another with CR+LF. Some 
>> clients
>>           didn't work because of this.
>>
>> You could diff 0.99.11 and 0.99.12 sources and find the fix from 
>> that. http://dovecot.org/releases/ has the tarballs.

Hi, I did that diff and as version 1.0-3_48.rc25.at uses another coding 
style I tried to adopt to it, but somehow it failed. Have you got any 
idea, what's going wrong?
Regards,
Michael

================================
diff -Naur dovecot-1.0.rc25/src/pop3-login/client.c 
dovecot-1.0.rc25-patched/src/pop3-login/client.c
--- dovecot-1.0.rc25/src/pop3-login/client.c    2006-11-24 
10:27:04.000000000 +0100
+++ dovecot-1.0.rc25-patched/src/pop3-login/client.c    2007-03-05 
15:32:31.660439938 +0100
@@ -438,16 +438,14 @@

 void client_send_line(struct pop3_client *client, const char *line)
 {
-       struct const_iovec iov[2];
+       struct const_iovec iov[1];
        ssize_t ret;

-       iov[0].iov_base = line;
-       iov[0].iov_len = strlen(line);
-       iov[1].iov_base = "\r\n";
-       iov[1].iov_len = 2;
+       iov[0].iov_base = strcat(line,"\r\n");
+       iov[0].iov_len = strlen(line) + 2;

-       ret = o_stream_sendv(client->output, iov, 2);
-       if (ret < 0 || (size_t)ret != iov[0].iov_len + iov[1].iov_len) {
+       ret = o_stream_sendv(client->output, iov, 1);
+       if (ret < 0 || (size_t)ret != iov[0].iov_len) {
                /* either disconnection or buffer full. in either case we
                   want this connection destroyed. however destroying it 
here
                   might break things if client is still tried to be 
accessed
================================

Here's the output of a login session. Here, at least there's no CR+LF 
after each character typed:

16:10:14.820218 accept(0, {sa_family=AF_INET, sin_port=htons(2112), 
sin_addr=inet_addr("84.165.121.174")}, [4613937826831007760]) = 7
16:10:14.820400 getsockname(7, {sa_family=AF_INET, sin_port=htons(110), 
sin_addr=inet_addr("999.999.999.999")}, [7926335352762007568]) = 0
16:10:14.820523 fcntl(7, F_GETFL)       = 0x2 (flags O_RDWR)
16:10:14.820618 fcntl(7, F_SETFL, O_RDWR|O_NONBLOCK) = 0
16:10:14.820691 fstat(7, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
16:10:14.820823 lseek(7, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
16:10:14.820922 getsockname(7, {sa_family=AF_INET, sin_port=htons(110), 
sin_addr=inet_addr("999.999.999.999")}, [7926335352762007568]) = 0
16:10:14.821089 write(7, "+OK Dovecot ready.\r\n\0\0", 22) = 22
16:10:14.821193 gettimeofday({1173107414, 821220}, NULL) = 0
16:10:14.821272 poll([{fd=5, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=8, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, events=POLLIN|PO
LLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=7, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 5, 374) = 0
16:10:15.196255 gettimeofday({1173107415, 196288}, {0, 0}) = 0
16:10:15.196342 gettimeofday({1173107415, 196371}, NULL) = 0
16:10:15.196420 poll([{fd=5, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=8, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, events=POLLIN|PO
LLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=7, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 5, 0) = 0
16:10:15.196517 gettimeofday({1173107415, 196546}, {0, 0}) = 0
16:10:15.196603 gettimeofday({1173107415, 196631}, NULL) = 0
16:10:15.196680 poll([{fd=5, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=8, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, events=POLLIN|PO
LLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=7, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 5, 999) = 0
16:10:16.196320 gettimeofday({1173107416, 196369}, {0, 0}) = 0
16:10:16.196424 gettimeofday({1173107416, 196453}, NULL) = 0
16:10:16.196505 poll([{fd=5, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=8, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, events=POLLIN|PO
LLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=7, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 5, 0) = 0
16:10:16.196602 gettimeofday({1173107416, 196630}, {0, 0}) = 0
16:10:16.196690 gettimeofday({1173107416, 196718}, NULL) = 0
16:10:16.196767 poll([{fd=5, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=8, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=3, events=POLLIN|PO
LLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=7, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL, revents=POLLI
N}], 5, 999) = 1
16:10:17.174464 gettimeofday({1173107417, 174510}, {0, 0}) = 0
16:10:17.174570 brk(0x564000)           = 0x564000
16:10:17.174659 read(7, "user kress\r\n", 4096) = 12
16:10:17.174766 setsockopt(7, SOL_TCP, TCP_CORK, [1], 4) = 0
16:10:17.174859 --- SIGSEGV (Segmentation fault) @ 0 (0) ---






-- 
Michael Kress, kress at hal.saar.de
http://www.michael-kress.de / http://kress.net
P E N G U I N S   A R E   C O O L



More information about the dovecot mailing list