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

cras at procontrol.fi cras at procontrol.fi
Wed Mar 5 00:38:10 EET 2003


Update of /home/cvs/dovecot/src/pop3-login
In directory danu:/tmp/cvs-serv3661/pop3-login

Modified Files:
	client.c client.h 
Log Message:
login: Wait until we're connected to auth process before executing command
from client.

inetd usage: --group=name can now specify which login group to use. Default
is the binary name before '-' character (ie. imap or pop3).



Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/pop3-login/client.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- client.c	23 Feb 2003 19:44:47 -0000	1.9
+++ client.c	4 Mar 2003 22:38:08 -0000	1.10
@@ -11,6 +11,7 @@
 #include "strescape.h"
 #include "client.h"
 #include "client-authenticate.h"
+#include "auth-connection.h"
 #include "ssl-proxy.h"
 
 /* max. length of input command line (spec says 512) */
@@ -157,6 +158,13 @@
 	if (!client_read(client))
 		return;
 
+	if (!auth_is_connected()) {
+		/* 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);
@@ -339,6 +347,22 @@
 unsigned int clients_get_count(void)
 {
 	return hash_size(clients);
+}
+
+static void client_hash_check_io(void *key, void *value __attr_unused__,
+				 void *context __attr_unused__)
+{
+	struct pop3_client *client = key;
+
+	if (client->input_blocked) {
+		client->input_blocked = FALSE;
+		client_input(client);
+	}
+}
+
+void clients_notify_auth_process(void)
+{
+	hash_foreach(clients, client_hash_check_io, NULL);
 }
 
 static void client_hash_destroy(void *key, void *value __attr_unused__,

Index: client.h
===================================================================
RCS file: /home/cvs/dovecot/src/pop3-login/client.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- client.h	11 Feb 2003 16:56:35 -0000	1.3
+++ client.h	4 Mar 2003 22:38:08 -0000	1.4
@@ -20,6 +20,7 @@
 	buffer_t *plain_login;
 
 	unsigned int tls:1;
+	unsigned int input_blocked:1;
 	unsigned int destroyed:1;
 };
 
@@ -34,9 +35,6 @@
 
 int client_read(struct pop3_client *client);
 void client_input(void *context);
-
-unsigned int clients_get_count(void);
-void clients_destroy_all(void);
 
 void clients_init(void);
 void clients_deinit(void);




More information about the dovecot-cvs mailing list