Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3955:295af5c1cce6 HEAD
If client disconnected while we were trying to send authentication
continuation to it, we crashed.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 28 Jan 2006 23:47:00 +0200 |
parents | 99ed24b66363 |
children | a52c36c51ff2 |
files | src/imap-login/client-authenticate.c src/imap-login/client.c src/pop3-login/client-authenticate.c src/pop3-login/client.c |
diffstat | 4 files changed, 10 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c Sat Jan 28 23:28:16 2006 +0200 +++ b/src/imap-login/client-authenticate.c Sat Jan 28 23:47:00 2006 +0200 @@ -179,7 +179,6 @@ struct imap_client *client = (struct imap_client *)_client; struct const_iovec iov[3]; size_t data_len; - ssize_t ret; switch (reply) { case SASL_SERVER_REPLY_SUCCESS: @@ -217,16 +216,10 @@ iov[2].iov_base = "\r\n"; iov[2].iov_len = 2; - ret = o_stream_sendv(client->output, iov, 3); - if (ret < 0) - client_destroy(client, "Disconnected"); - else if ((size_t)ret != 2 + data_len + 2) - client_destroy(client, "Transmit buffer full"); - else { - /* continue */ - return; - } - break; + /* don't check return value here. it gets tricky if we try + to call client_destroy() in here. */ + (void)o_stream_sendv(client->output, iov, 3); + return; } client_unref(client);
--- a/src/imap-login/client.c Sat Jan 28 23:28:16 2006 +0200 +++ b/src/imap-login/client.c Sat Jan 28 23:47:00 2006 +0200 @@ -519,6 +519,7 @@ bool client_unref(struct imap_client *client) { + i_assert(client->refcount > 0); if (--client->refcount > 0) return TRUE;
--- a/src/pop3-login/client-authenticate.c Sat Jan 28 23:28:16 2006 +0200 +++ b/src/pop3-login/client-authenticate.c Sat Jan 28 23:47:00 2006 +0200 @@ -188,16 +188,10 @@ iov[2].iov_base = "\r\n"; iov[2].iov_len = 2; - ret = o_stream_sendv(client->output, iov, 3); - if (ret < 0) - client_destroy(client, "Disconnected"); - else if ((size_t)ret != 2 + data_len + 2) - client_destroy(client, "Transmit buffer full"); - else { - /* continue */ - return; - } - break; + /* don't check return value here. it gets tricky if we try + to call client_destroy() in here. */ + (void)o_stream_sendv(client->output, iov, 3); + return; } client_unref(client);