[Dovecot] Problem with Dovecot LDA / Postfix

Peter Fern dovecot at obfusc8.org
Sun Jun 18 08:44:49 EEST 2006


Timo Sirainen wrote:
> Unless your mails are owned by root user, that's not really the problem.
> Rather it looks like your userdb query returns user's UID as 0. I guess
> I'll have to add some extra code to give nicer error message in that
> case.
>
>   

Nope, here's the output after an upgrade to beta9:

Jun 18 15:18:23 [dovecot] auth(default): master out: USER_1_postmaster at obfusc8.org_uid=10006_gid=10001_home=/users/obfusc8.org/postmaster
Jun 18 15:18:23 [dovecot] auth(default):
Jun 18 15:18:23 [deliver(postmaster at obfusc8.org)] uid: (null), gid: 10001, chroot: (null)
Jun 18 15:18:23 [deliver(postmaster at obfusc8.org)] Running as root isn't permitted


The attached patch solves the problem


-------------- next part --------------
--- src/deliver/auth-client.c.orig	2006-06-11 21:37:10.000000000 +1000
+++ src/deliver/auth-client.c	2006-06-18 15:24:19.000000000 +1000
@@ -49,7 +49,9 @@
 
 	for (tmp = t_strsplit(args, "\t"); *tmp != NULL; tmp++) {
 		if (strncmp(*tmp, "uid=", 4) == 0) {
-			if (conn->euid != strtoul(*tmp + 3, NULL, 10)) {
+			uid_t uid = strtoul(*tmp + 4, NULL, 10);
+
+			if (conn->euid == 0 || geteuid() != uid) {
 				env_put(t_strconcat("RESTRICT_SETUID=",
 						    *tmp + 4, NULL));
 			}


More information about the dovecot mailing list