From ebeaf99687d0fd6545c95983f0d91e2ddee7fbb7 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Wed, 14 Mar 2007 12:15:56 +0000 Subject: Change originator_xxx fields in the daemon when it gives up root so that the -H files are always consistent. --- src/src/daemon.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/src/daemon.c b/src/src/daemon.c index 4c6c90878..e844403a4 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/daemon.c,v 1.22 2007/01/23 14:34:02 ph10 Exp $ */ +/* $Cambridge: exim/src/src/daemon.c,v 1.23 2007/03/14 12:15:56 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -881,6 +881,7 @@ There are no arguments to this function, and it never returns. */ void daemon_go(void) { +struct passwd *pw; int *listen_sockets = NULL; int listen_socket_count = 0; ip_address_item *addresses = NULL; @@ -1453,6 +1454,14 @@ cannot do this. */ exim_setugid(exim_uid, exim_gid, geteuid()==root_uid, US"running as a daemon"); +/* Update the originator_xxx fields so that received messages as listed as +coming from Exim, not whoever started the daemon. */ + +originator_uid = exim_uid; +originator_gid = exim_gid; +originator_login = ((pw = getpwuid(exim_uid)) != NULL)? + string_copy_malloc(US pw->pw_name) : US"exim"; + /* Get somewhere to keep the list of queue-runner pids if we are keeping track of them (and also if we are doing queue runs). */ -- cgit v1.2.3