dovecot-1.0: If getpwuid() lookup fails but USER environment exi...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 7 12:41:15 EET 2008


details:   http://hg.dovecot.org/dovecot-1.0/rev/98b7335cb3be
changeset: 5509:98b7335cb3be
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jan 07 12:41:11 2008 +0200
description:
If getpwuid() lookup fails but USER environment exists, just user it instead
of failing.

diffstat:

1 file changed, 2 insertions(+), 1 deletion(-)
src/deliver/deliver.c |    3 ++-

diffs (18 lines):

diff -r 1e0b273d4d64 -r 98b7335cb3be src/deliver/deliver.c
--- a/src/deliver/deliver.c	Fri Jan 04 03:31:04 2008 +0200
+++ b/src/deliver/deliver.c	Mon Jan 07 12:41:11 2008 +0200
@@ -678,12 +678,13 @@ int main(int argc, char *argv[])
 		/* we're non-root. get our username and possibly our home. */
 		struct passwd *pw;
 
+		user = getenv("USER");
 		pw = getpwuid(process_euid);
 		if (pw != NULL) {
 			user = t_strdup(pw->pw_name);
 			if (getenv("HOME") == NULL)
 				env_put(t_strconcat("HOME=", pw->pw_dir, NULL));
-		} else {
+		} else if (user == NULL) {
 			i_fatal("Couldn't lookup our username (uid=%s)",
 				dec2str(process_euid));
 		}


More information about the dovecot-cvs mailing list