# HG changeset patch # User Timo Sirainen # Date 1034278537 -10800 # Node ID d12fa0b21a59772eb4b9fd0bed4af565ba510df8 # Parent 576967cbd0646bfbf99944dde20dfc87350aa421 STARTTLS was broken diff -r 576967cbd064 -r d12fa0b21a59 src/login/client.c --- a/src/login/client.c Thu Oct 10 05:07:55 2002 +0300 +++ b/src/login/client.c Thu Oct 10 22:35:37 2002 +0300 @@ -51,17 +51,25 @@ client_send_tagline(client, "OK Begin TLS negotiation now."); io_buffer_send_flush(client->outbuf); + /* must be removed before ssl_proxy_new(), since it may + io_add() the same fd. */ + io_remove(client->io); + fd_ssl = ssl_proxy_new(client->fd); if (fd_ssl != -1) { client->tls = TRUE; client->fd = fd_ssl; client->inbuf->fd = fd_ssl; client->outbuf->fd = fd_ssl; + + i_assert(client->inbuf->io == NULL); + i_assert(client->outbuf->io == NULL); } else { client_send_line(client, " * BYE TLS handehake failed."); client_destroy(client, "TLS handshake failed"); } + client->io = io_add(client->fd, IO_READ, client_input, client); return TRUE; } diff -r 576967cbd064 -r d12fa0b21a59 src/login/ssl-proxy.c --- a/src/login/ssl-proxy.c Thu Oct 10 05:07:55 2002 +0300 +++ b/src/login/ssl-proxy.c Thu Oct 10 22:35:37 2002 +0300 @@ -290,6 +290,9 @@ return -1; } + net_set_nonblock(sfd[0], TRUE); + net_set_nonblock(sfd[1], TRUE); + proxy = i_new(SSLProxy, 1); proxy->refcount = 1; proxy->state = state;