[dovecot-cvs] dovecot/src/imap-login client-authenticate.c,1.5,1.6 client-authenticate.h,1.1,1.2 client.c,1.9,1.10

cras at procontrol.fi cras at procontrol.fi
Fri May 16 21:05:44 EEST 2003


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

Modified Files:
	client-authenticate.c client-authenticate.h client.c 
Log Message:
Don't advertise AUTH=PLAIN in capability if disable_plaintext_auth = yes and
SSL/TLS is not yet negotiated.



Index: client-authenticate.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client-authenticate.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- client-authenticate.c	4 Mar 2003 22:38:07 -0000	1.5
+++ client-authenticate.c	16 May 2003 17:05:42 -0000	1.6
@@ -19,7 +19,7 @@
 static enum auth_mech auth_mechs = 0;
 static char *auth_mechs_capability = NULL;
 
-const char *client_authenticate_get_capabilities(void)
+const char *client_authenticate_get_capabilities(int tls)
 {
 	string_t *str;
 	int i;
@@ -34,7 +34,9 @@
 
 	for (i = 0; i < AUTH_MECH_COUNT; i++) {
 		if ((auth_mechs & auth_mech_desc[i].mech) &&
-		    auth_mech_desc[i].name != NULL) {
+		    auth_mech_desc[i].name != NULL &&
+		    (tls || !auth_mech_desc[i].plaintext ||
+		     !disable_plaintext_auth)) {
 			str_append_c(str, ' ');
 			str_append(str, "AUTH=");
 			str_append(str, auth_mech_desc[i].name);

Index: client-authenticate.h
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client-authenticate.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- client-authenticate.h	28 Jan 2003 21:35:25 -0000	1.1
+++ client-authenticate.h	16 May 2003 17:05:42 -0000	1.2
@@ -1,7 +1,7 @@
 #ifndef __CLIENT_AUTHENTICATE_H
 #define __CLIENT_AUTHENTICATE_H
 
-const char *client_authenticate_get_capabilities(void);
+const char *client_authenticate_get_capabilities(int tls);
 
 int cmd_login(struct imap_client *client, struct imap_arg *args);
 int cmd_authenticate(struct imap_client *client, struct imap_arg *args);

Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap-login/client.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- client.c	6 Mar 2003 21:44:31 -0000	1.9
+++ client.c	16 May 2003 17:05:42 -0000	1.10
@@ -89,14 +89,13 @@
 
 static int cmd_capability(struct imap_client *client)
 {
-	const char *capability;
+	const char *capability, *auths;
 
+	auths = client_authenticate_get_capabilities(client->tls);
 	capability = t_strconcat("* CAPABILITY " CAPABILITY_STRING,
 				 ssl_initialized ? " STARTTLS" : "",
 				 disable_plaintext_auth && !client->tls ?
-				 " LOGINDISABLED" : "",
-				 client_authenticate_get_capabilities(),
-				 NULL);
+				 " LOGINDISABLED" : "", auths, NULL);
 	client_send_line(client, capability);
 	client_send_tagline(client, "OK Capability completed.");
 	return TRUE;



More information about the dovecot-cvs mailing list