[dovecot-cvs] dovecot/src/auth auth-request.c,1.56,1.57

cras at dovecot.org cras at dovecot.org
Wed Apr 12 14:27:19 EEST 2006


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv29774

Modified Files:
	auth-request.c 
Log Message:
Master login fixes, PLAIN authentication was still broken..



Index: auth-request.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- auth-request.c	9 Apr 2006 13:54:46 -0000	1.56
+++ auth-request.c	12 Apr 2006 11:27:17 -0000	1.57
@@ -561,7 +561,7 @@
 bool auth_request_set_username(struct auth_request *request,
 			       const char *username, const char **error_r)
 {
-	const char *p;
+	const char *p, *login_username = NULL;
 
 	if (request->original_username == NULL) {
 		/* the username may change later, but we need to use this
@@ -579,13 +579,7 @@
 		p = strchr(username, request->auth->master_user_separator);
 		if (p != NULL) {
 			/* it does, set it. */
-			const char *login_username;
-
 			login_username = t_strdup_until(username, p);
-			if (!auth_request_set_login_username(request,
-							     login_username,
-							     error_r))
-				return FALSE;
 
 			/* username is the master user */
 			username = p + 1;
@@ -599,7 +593,16 @@
 	}
 
         request->user = auth_request_fix_username(request, username, error_r);
-        return request->user != NULL;
+	if (request->user == NULL)
+		return FALSE;
+
+	if (login_username != NULL) {
+		if (!auth_request_set_login_username(request,
+						     login_username,
+						     error_r))
+			return FALSE;
+	}
+	return TRUE;
 }
 
 bool auth_request_set_login_username(struct auth_request *request,
@@ -608,17 +611,17 @@
 {
         i_assert(*username != '\0');
 
+	if (strcmp(username, request->user) == 0) {
+		/* The usernames are the same, we don't really wish to log
+		   in as someone else */
+		return TRUE;
+	}
+
         /* lookup request->user from masterdb first */
         request->passdb = request->auth->masterdbs;
 
         request->requested_login_user =
                 auth_request_fix_username(request, username, error_r);
-	if (request->user != NULL &&
-	    strcmp(request->requested_login_user, request->user) == 0) {
-		/* The usernames are the same, we don't really wish to log
-		   in as someone else */
-		request->requested_login_user = NULL;
-	}
 	return request->requested_login_user != NULL;
 }
 



More information about the dovecot-cvs mailing list