[dovecot-cvs] dovecot/src/auth checkpassword-reply.c, 1.3.2.1, 1.3.2.2

tss at dovecot.org tss at dovecot.org
Fri Feb 16 17:28:15 UTC 2007


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

Modified Files:
      Tag: branch_1_0
	checkpassword-reply.c 
Log Message:
If USER environment is set, return it in "user" field and not "userdb_user".
Also don't require that the USER environment exists.



Index: checkpassword-reply.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/checkpassword-reply.c,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -d -r1.3.2.1 -r1.3.2.2
--- checkpassword-reply.c	16 Feb 2007 17:13:04 -0000	1.3.2.1
+++ checkpassword-reply.c	16 Feb 2007 17:28:13 -0000	1.3.2.2
@@ -17,18 +17,14 @@
 	str = t_str_new(1024);
 
 	user = getenv("USER");
-	if (user == NULL)
-		i_fatal("checkpassword: USER environment missing");
-	if (strchr(user, '\t') != NULL) {
-		i_error("checkpassword: USER contains TAB");
-		return 1;
+	if (user != NULL) {
+		if (strchr(user, '\t') != NULL) {
+			i_error("checkpassword: USER contains TAB");
+			return 1;
+		}
+		str_printfa(str, "user=%s\t", user);
 	}
 
-	str_printfa(str, "userdb_user=%s\t"
-		    "userdb_uid=%s\t"
-		    "userdb_gid=%s\t",
-		    user, dec2str(getuid()), dec2str(getgid()));
-
 	home = getenv("HOME");
 	if (home != NULL) {
 		if (strchr(home, '\t') != NULL) {
@@ -38,6 +34,9 @@
 		str_printfa(str, "userdb_home=%s\t", home);
 	}
 
+	str_printfa(str, "userdb_uid=%s\tuserdb_gid=%s\t",
+		    dec2str(getuid()), dec2str(getgid()));
+
 	extra_env = getenv("EXTRA");
 	if (extra_env != NULL) {
 		for (tmp = t_strsplit(extra_env, " "); *tmp != NULL; tmp++) {



More information about the dovecot-cvs mailing list