changeset 5150:16240711734e HEAD

If authentication fails and we've already destroyed the client, don't go io_add()ing the client anywhere.
author Timo Sirainen <tss@iki.fi>
date Fri, 16 Feb 2007 15:42:03 +0200
parents 892b8f1c1916
children 59604f7d92e8
files src/imap-login/client-authenticate.c src/pop3-login/client-authenticate.c
diffstat 2 files changed, 28 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c	Fri Feb 16 15:40:48 2007 +0200
+++ b/src/imap-login/client-authenticate.c	Fri Feb 16 15:42:03 2007 +0200
@@ -168,10 +168,13 @@
 
 	i_assert(nologin);
 
-	/* get back to normal client input. */
-	if (client->io != NULL)
-		io_remove(&client->io);
-	client->io = io_add(client->common.fd, IO_READ, client_input, client);
+	if (!client->destroyed) {
+		/* get back to normal client input. */
+		if (client->io != NULL)
+			io_remove(&client->io);
+		client->io = io_add(client->common.fd, IO_READ,
+				    client_input, client);
+	}
 	return TRUE;
 }
 
@@ -209,11 +212,13 @@
 				  NULL);
 		client_send_tagline(client, msg);
 
-		/* get back to normal client input. */
-		if (client->io != NULL)
-			io_remove(&client->io);
-		client->io = io_add(client->common.fd, IO_READ,
-				    client_input, client);
+		if (!client->destroyed) {
+			/* get back to normal client input. */
+			if (client->io != NULL)
+				io_remove(&client->io);
+			client->io = io_add(client->common.fd, IO_READ,
+					    client_input, client);
+		}
 		break;
 	case SASL_SERVER_REPLY_MASTER_FAILED:
 		client_destroy_internal_failure(client);
--- a/src/pop3-login/client-authenticate.c	Fri Feb 16 15:40:48 2007 +0200
+++ b/src/pop3-login/client-authenticate.c	Fri Feb 16 15:42:03 2007 +0200
@@ -141,11 +141,13 @@
 
 	client_send_line(client, str_c(reply));
 
-	/* get back to normal client input. */
-	if (client->io != NULL)
-		io_remove(&client->io);
-	client->io = io_add(client->common.fd, IO_READ,
-			    client_input, client);
+	if (!client->destroyed) {
+		/* get back to normal client input. */
+		if (client->io != NULL)
+			io_remove(&client->io);
+		client->io = io_add(client->common.fd, IO_READ,
+				    client_input, client);
+	}
 	return TRUE;
 }
 
@@ -182,11 +184,13 @@
 				  data : AUTH_FAILED_MSG, NULL);
 		client_send_line(client, msg);
 
-		/* get back to normal client input. */
-		if (client->io != NULL)
-			io_remove(&client->io);
-		client->io = io_add(client->common.fd, IO_READ,
-				    client_input, client);
+		if (!client->destroyed) {
+			/* get back to normal client input. */
+			if (client->io != NULL)
+				io_remove(&client->io);
+			client->io = io_add(client->common.fd, IO_READ,
+					    client_input, client);
+		}
 		break;
 	case SASL_SERVER_REPLY_MASTER_FAILED:
 		client_destroy_internal_failure(client);