[dovecot-cvs] dovecot/src/imap-login client.c, 1.44, 1.45 client.h, 1.15, 1.16

cras at dovecot.org cras at dovecot.org
Fri Oct 28 19:52:22 EEST 2005


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

Modified Files:
	client.c client.h 
Log Message:
If capability is sent in greeting, don't send it before we have received
authentication capabilities from auth process.



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- client.c	18 Sep 2005 14:43:47 -0000	1.44
+++ client.c	28 Oct 2005 16:52:20 -0000	1.45
@@ -389,12 +389,27 @@
 	}
 }
 
+static void client_send_greeting(struct imap_client *client)
+{
+	string_t *greet;
+
+	greet = t_str_new(128);
+	str_append(greet, "* OK ");
+	if (greeting_capability) {
+		i_assert(auth_client_is_connected(auth_client));
+		str_printfa(greet, "[CAPABILITY %s] ", get_capability(client));
+	}
+	str_append(greet, greeting);
+
+	client_send_line(client, str_c(greet));
+	client->greeting_sent = TRUE;
+}
+
 struct client *client_create(int fd, int ssl, const struct ip_addr *local_ip,
 			     const struct ip_addr *ip)
 {
 	struct imap_client *client;
 	const char *addr;
-	string_t *greet;
 
 	if (max_logging_users > CLIENT_DESTROY_OLDEST_COUNT &&
 	    hash_size(clients) >= max_logging_users) {
@@ -429,13 +444,8 @@
 
 	main_ref();
 
-	greet = t_str_new(128);
-	str_append(greet, "* OK ");
-	if (greeting_capability)
-		str_printfa(greet, "[CAPABILITY %s] ", get_capability(client));
-	str_append(greet, greeting);
-
-	client_send_line(client, str_c(greet));
+	if (!greeting_capability || auth_client_is_connected(auth_client))
+                client_send_greeting(client);
 	client_set_title(client);
 
 	client->created = TRUE;
@@ -591,6 +601,8 @@
 	while (hash_iterate(iter, &key, &value)) {
 		struct imap_client *client = key;
 
+		if (!client->greeting_sent)
+			client_send_greeting(client);
 		if (client->input_blocked) {
 			client->input_blocked = FALSE;
 			client_input(client);

Index: client.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/client.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- client.h	27 Oct 2004 14:20:24 -0000	1.15
+++ client.h	28 Oct 2005 16:52:20 -0000	1.16
@@ -29,6 +29,7 @@
 	unsigned int skip_line:1;
 	unsigned int input_blocked:1;
 	unsigned int destroyed:1;
+	unsigned int greeting_sent:1;
 };
 
 void client_destroy(struct imap_client *client, const char *reason);



More information about the dovecot-cvs mailing list