[dovecot-cvs] dovecot/src/imap-login client-authenticate.c, 1.48, 1.49

tss at dovecot.org tss at dovecot.org
Tue Feb 20 11:51:15 UTC 2007


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

Modified Files:
	client-authenticate.c 
Log Message:
If authentication failed but it still returns proxy, don't do the proxying.



Index: client-authenticate.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap-login/client-authenticate.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- client-authenticate.c	16 Feb 2007 13:42:03 -0000	1.48
+++ client-authenticate.c	20 Feb 2007 11:51:11 -0000	1.49
@@ -82,12 +82,12 @@
 }
 
 static bool client_handle_args(struct imap_client *client,
-			       const char *const *args, bool nologin)
+			       const char *const *args, bool success)
 {
 	const char *reason = NULL, *host = NULL, *destuser = NULL, *pass = NULL;
 	string_t *reply;
 	unsigned int port = 143;
-	bool proxy = FALSE, temp = FALSE;
+	bool proxy = FALSE, temp = FALSE, nologin = !success;
 
 	for (; *args != NULL; args++) {
 		if (strcmp(*args, "nologin") == 0)
@@ -113,8 +113,12 @@
 
 	if (proxy) {
 		/* we want to proxy the connection to another server.
+		   don't do this unless authentication succeeded. with
+		   master user proxying we can get FAIL with proxy still set.
 
 		   proxy host=.. [port=..] [destuser=..] pass=.. */
+		if (!success)
+			return FALSE;
 		if (imap_proxy_new(client, host, port, destuser, pass) < 0)
 			client_destroy_internal_failure(client);
 		return TRUE;
@@ -193,7 +197,7 @@
 	switch (reply) {
 	case SASL_SERVER_REPLY_SUCCESS:
 		if (args != NULL) {
-			if (client_handle_args(client, args, FALSE))
+			if (client_handle_args(client, args, TRUE))
 				break;
 		}
 
@@ -203,7 +207,7 @@
 	case SASL_SERVER_REPLY_AUTH_FAILED:
 	case SASL_SERVER_REPLY_CLIENT_ERROR:
 		if (args != NULL) {
-			if (client_handle_args(client, args, TRUE))
+			if (client_handle_args(client, args, FALSE))
 				break;
 		}
 



More information about the dovecot-cvs mailing list