[Dovecot] ntlm auth / usernames with white spaces

Matthias Lay matthias.lay at securepoint.de
Fri Jul 27 17:32:59 EEST 2012


Hi,

we experienced some problems with white spaces in usernames (this was
NOT our idea) authenticated bei dovecots ntlmhelper

I wrote a little patch fixing this, if you would like.

patch applies on 2.1.7 and 2.1.8 (tested those)


diff -up ./src/auth/mech-winbind.c.username ./src/auth/mech-winbind.c
--- ./src/auth/mech-winbind.c.username	2012-07-27 09:52:33.422553807
+0200
+++ ./src/auth/mech-winbind.c	2012-07-27 14:23:03.718619388 +0200
@@ -239,8 +239,16 @@ do_auth_continue(struct auth_request *au
 		return HR_FAIL;
 	} else if (strcmp(token[0], "AF") == 0) {
 		const char *user, *p, *error;
+		int ti=1;
+		
+		if(gss_spnego)
+		 ti=2;
+		/* some braindead administrators like spaces in usernames */
+		user = token[ti];
+		while(token[++ti]){
+		 user = t_strconcat(user, " ", token[ti], NULL);
+		}
 
-		user = gss_spnego ? token[2] : token[1];
 		i_assert(user != NULL);
 
 		p = strchr(user, '\\');




More information about the dovecot mailing list