[dovecot-cvs] dovecot/src/imap-login client-authenticate.c,1.1,1.2 client.c,1.2,1.3

cras at procontrol.fi cras at procontrol.fi
Sun Feb 2 12:16:44 EET 2003


Update of /home/cvs/dovecot/src/imap-login
In directory danu:/tmp/cvs-serv24541/imap-login

Modified Files:
	client-authenticate.c client.c 
Log Message:
auth: kill login connection if it leaves requests hanging too long.



Index: client-authenticate.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client-authenticate.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- client-authenticate.c	28 Jan 2003 21:35:25 -0000	1.1
+++ client-authenticate.c	2 Feb 2003 10:16:42 -0000	1.2
@@ -61,6 +61,7 @@
 {
 	if (client->auth_request != NULL) {
 		auth_abort_request(client->auth_request);
+                auth_request_unref(client->auth_request);
 		client->auth_request = NULL;
 	}
 
@@ -136,6 +137,7 @@
 
 	if (reply == NULL) {
 		/* failed */
+                auth_request_unref(client->auth_request);
 		client->auth_request = NULL;
 		client_auth_abort(client, "NO Authentication process died.");
 		return FALSE;
@@ -143,10 +145,14 @@
 
 	switch (reply->result) {
 	case AUTH_LOGIN_RESULT_CONTINUE:
+		i_assert(client->auth_request == NULL);
+
 		client->auth_request = request;
+                auth_request_ref(client->auth_request);
 		return TRUE;
 
 	case AUTH_LOGIN_RESULT_SUCCESS:
+                auth_request_unref(client->auth_request);
 		client->auth_request = NULL;
 
 		user = auth_login_get_str(reply, data, reply->username_idx);
@@ -172,6 +178,7 @@
 
 	case AUTH_LOGIN_RESULT_FAILURE:
 		/* see if we have error message */
+                auth_request_unref(client->auth_request);
 		client->auth_request = NULL;
 
 		if (reply->data_size > 0 && data[reply->data_size-1] == '\0') {

Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- client.c	2 Feb 2003 07:10:45 -0000	1.2
+++ client.c	2 Feb 2003 10:16:42 -0000	1.3
@@ -34,6 +34,10 @@
    client hash, it's faster if we disconnect multiple clients. */
 #define CLIENT_DESTROY_OLDEST_COUNT 16
 
+#if CLIENT_LOGIN_IDLE_TIMEOUT >= AUTH_REQUEST_TIMEOUT
+#  error client idle timeout must be smaller than authentication timeout
+#endif
+
 static struct hash_table *clients;
 static struct timeout *to_idle;
 




More information about the dovecot-cvs mailing list