[dovecot-cvs] dovecot/src/imap-login client-authenticate.c, 1.42, 1.43 client.c, 1.57, 1.58 imap-proxy.c, 1.10, 1.11

tss at dovecot.org tss at dovecot.org
Tue Nov 7 15:06:26 UTC 2006


Update of /var/lib/cvs/dovecot/src/imap-login
In directory talvi:/tmp/cvs-serv19167/imap-login

Modified Files:
	client-authenticate.c client.c imap-proxy.c 
Log Message:
Crashfixes and more asserts. Mostly related to use of AUTHENTICATE/AUTH
commands.



Index: client-authenticate.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/client-authenticate.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- client-authenticate.c	17 Jun 2006 19:48:36 -0000	1.42
+++ client-authenticate.c	7 Nov 2006 15:06:23 -0000	1.43
@@ -68,12 +68,12 @@
 		return;
 	}
 
-	if (client->common.auth_request == NULL) {
+	if (client->common.waiting_auth_reply) {
 		sasl_server_auth_client_error(&client->common,
 					      "Don't send unrequested data");
 	} else {
 		auth_client_request_continue(client->common.auth_request, line);
-		client->common.auth_request = NULL;
+		client->common.waiting_auth_reply = TRUE;
 	}
 
 	/* clear sensitive data */
@@ -182,6 +182,8 @@
 	const char *msg;
 	size_t data_len;
 
+	i_assert(!client->destroyed || reply == SASL_SERVER_REPLY_CLIENT_ERROR);
+
 	switch (reply) {
 	case SASL_SERVER_REPLY_SUCCESS:
 		if (args != NULL) {

Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- client.c	13 Oct 2006 23:52:02 -0000	1.57
+++ client.c	7 Nov 2006 15:06:23 -0000	1.58
@@ -469,8 +469,10 @@
 		o_stream_close(client->output);
 
 	if (client->common.auth_request != NULL) {
-		auth_client_request_abort(client->common.auth_request);
-                client->common.auth_request = NULL;
+		i_assert(client->common.authenticating);
+		sasl_server_auth_client_error(&client->common, NULL);
+	} else {
+		i_assert(!client->common.authenticating);
 	}
 
 	if (client->common.master_tag != 0)

Index: imap-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/imap-proxy.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- imap-proxy.c	7 Nov 2006 14:01:19 -0000	1.10
+++ imap-proxy.c	7 Nov 2006 15:06:23 -0000	1.11
@@ -15,14 +15,7 @@
 {
 	string_t *str;
 
-	if (client->destroyed) {
-		/* client already disconnected. */
-		login_proxy_free(client->proxy);
-		client->proxy = NULL;
-
-		client_unref(client);
-		return -1;
-	}
+	i_assert(!client->destroyed);
 
 	if (!client->proxy_login_sent) {
 		/* this is a banner */
@@ -132,6 +125,7 @@
 		   unsigned int port, const char *user, const char *password)
 {
 	i_assert(user != NULL);
+	i_assert(!client->destroyed);
 
 	if (password == NULL) {
 		i_error("proxy(%s): password not given",
@@ -142,6 +136,12 @@
 	i_assert(client->refcount > 1);
 	connection_queue_add(1);
 
+	if (client->destroyed) {
+		/* connection_queue_add() decided that we were the oldest
+		   connection and killed us. */
+		return -1;
+	}
+
 	client_ref(client);
 	client->proxy = login_proxy_new(&client->common, host, port,
 					proxy_input, client);



More information about the dovecot-cvs mailing list