[dovecot-cvs] dovecot/src/pop3-login client.c, 1.22, 1.23 client.h, 1.9, 1.10

cras at procontrol.fi cras at procontrol.fi
Sat Jul 3 12:44:23 EEST 2004


Update of /home/cvs/dovecot/src/pop3-login
In directory talvi:/tmp/cvs-serv19448

Modified Files:
	client.c client.h 
Log Message:
If we're not connected to all auth sockets, wait before sending greeting so
APOP challenge gets sent.



Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3-login/client.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- client.c	2 Jul 2004 22:03:37 -0000	1.22
+++ client.c	3 Jul 2004 09:44:21 -0000	1.23
@@ -163,13 +163,6 @@
 	if (!client_read(client))
 		return;
 
-	if (!auth_client_is_connected(auth_client)) {
-		/* we're not yet connected to auth process -
-		   don't allow any commands */
-		client->input_blocked = TRUE;
-		return;
-	}
-
 	client_ref(client);
 
 	o_stream_cork(client->output);
@@ -236,8 +229,6 @@
 {
 	struct auth_connect_id id;
 
-	/* FIXME: breaks if we're not connected! */
-
 	if (!auth_client_reserve_connection(auth_client, "APOP", &id))
 		return NULL;
 
@@ -245,6 +236,16 @@
 			       dec2str(ioloop_time), my_hostname);
 }
 
+static void client_auth_ready(struct pop3_client *client)
+{
+	client->common.io =
+		io_add(client->common.fd, IO_READ, client_input, client);
+
+	client->apop_challenge = get_apop_challenge();
+	client_send_line(client, t_strconcat("+OK " PACKAGE " ready.",
+					     client->apop_challenge, NULL));
+}
+
 struct client *client_create(int fd, int ssl, const struct ip_addr *local_ip,
 			     const struct ip_addr *ip)
 {
@@ -274,7 +275,6 @@
 	client->common.local_ip = *local_ip;
 	client->common.ip = *ip;
 	client->common.fd = fd;
-	client->common.io = io_add(fd, IO_READ, client_input, client);
 	client_open_streams(client, fd);
 
 	client->last_input = ioloop_time;
@@ -282,9 +282,9 @@
 
 	main_ref();
 
-	client->apop_challenge = get_apop_challenge();
-	client_send_line(client, t_strconcat("+OK " PACKAGE " ready.",
-					     client->apop_challenge, NULL));
+	client->auth_connected = auth_client_is_connected(auth_client);
+	if (client->auth_connected)
+		client_auth_ready(client);
 	client_set_title(client);
 	return &client->common;
 }
@@ -396,9 +396,9 @@
 	while (hash_iterate(iter, &key, &value)) {
 		struct pop3_client *client = key;
 
-		if (client->input_blocked) {
-			client->input_blocked = FALSE;
-			client_input(client);
+		if (!client->auth_connected) {
+			client->auth_connected = TRUE;
+			client_auth_ready(client);
 		}
 	}
 	hash_iterate_deinit(iter);

Index: client.h
===================================================================
RCS file: /home/cvs/dovecot/src/pop3-login/client.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- client.h	2 Jul 2004 22:03:37 -0000	1.9
+++ client.h	3 Jul 2004 09:44:21 -0000	1.10
@@ -25,7 +25,7 @@
 
 	unsigned int tls:1;
 	unsigned int secured:1;
-	unsigned int input_blocked:1;
+	unsigned int auth_connected:1;
 	unsigned int destroyed:1;
 };
 



More information about the dovecot-cvs mailing list