[dovecot-cvs] dovecot/src/deliver deliver.c,1.35,1.36

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


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

Modified Files:
	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.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- deliver.c	2 Nov 2006 20:05:24 -0000	1.35
+++ deliver.c	5 Nov 2006 20:47:16 -0000	1.36
@@ -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