[dovecot-cvs] dovecot/src/deliver deliver.c,1.20.2.18,1.20.2.19

tss at dovecot.org tss at dovecot.org
Sun Nov 5 20:47:16 UTC 2006


Update of /var/lib/cvs/dovecot/src/deliver
In directory talvi:/tmp/cvs-serv32681

Modified Files:
      Tag: branch_1_0
	deliver.c 
Log Message:
If we're executing as a normal system user, get the HOME environment from
passwd if it's not set. This makes it possible to run deliver from .forward.



Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/deliver.c,v
retrieving revision 1.20.2.18
retrieving revision 1.20.2.19
diff -u -d -r1.20.2.18 -r1.20.2.19
--- deliver.c	2 Nov 2006 20:05:22 -0000	1.20.2.18
+++ deliver.c	5 Nov 2006 20:47:14 -0000	1.20.2.19
@@ -462,13 +462,15 @@
 	if (destination != NULL)
 		user = destination;
 	else if (process_euid != 0) {
-		/* we're non-root. get our username. */
+		/* we're non-root. get our username and possibly our home. */
 		struct passwd *pw;
 
 		pw = getpwuid(process_euid);
-		if (pw != NULL)
+		if (pw != NULL) {
 			user = t_strdup(pw->pw_name);
-		else {
+			if (getenv("HOME") == NULL)
+				env_put(t_strconcat("HOME=", pw->pw_dir, NULL));
+		} else {
 			i_fatal("Couldn't lookup our username (uid=%s)",
 				dec2str(process_euid));
 		}



More information about the dovecot-cvs mailing list