[dovecot-cvs] dovecot/src/imap-login client-authenticate.c, 1.39.2.3, 1.39.2.4 client.c, 1.51.2.6, 1.51.2.7 imap-proxy.c, 1.7.2.3, 1.7.2.4

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


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

Modified Files:
      Tag: branch_1_0
	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.39.2.3
retrieving revision 1.39.2.4
diff -u -d -r1.39.2.3 -r1.39.2.4
--- client-authenticate.c	17 Jun 2006 19:48:35 -0000	1.39.2.3
+++ client-authenticate.c	7 Nov 2006 15:06:17 -0000	1.39.2.4
@@ -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.51.2.6
retrieving revision 1.51.2.7
diff -u -d -r1.51.2.6 -r1.51.2.7
--- client.c	13 Oct 2006 23:52:01 -0000	1.51.2.6
+++ client.c	7 Nov 2006 15:06:17 -0000	1.51.2.7
@@ -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.7.2.3
retrieving revision 1.7.2.4
diff -u -d -r1.7.2.3 -r1.7.2.4
--- imap-proxy.c	7 Nov 2006 14:01:14 -0000	1.7.2.3
+++ imap-proxy.c	7 Nov 2006 15:06:17 -0000	1.7.2.4
@@ -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