summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2007-03-14 12:15:56 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2007-03-14 12:15:56 +0000
commitebeaf99687d0fd6545c95983f0d91e2ddee7fbb7 (patch)
treea10d870a11a5a2d0c05254a7b040cb80c99d2fd2 /src
parentcd9868ec7872447f31efd5f175c7f3e90ac92657 (diff)
Change originator_xxx fields in the daemon when it gives up root so that
the -H files are always consistent.
Diffstat (limited to 'src')
-rw-r--r--src/src/daemon.c11
1 files changed, 10 insertions, 1 deletions
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). */