ph10 2007/03/14 12:15:56 GMT
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src daemon.c
exim-test runtest
exim-test/stdout 0035 3415
Log:
Change originator_xxx fields in the daemon when it gives up root so that
the -H files are always consistent.
Revision Changes Path
1.496 +7 -0 exim/exim-doc/doc-txt/ChangeLog
1.23 +9 -0 exim/exim-src/src/daemon.c
1.25 +6 -3 exim/exim-test/runtest
1.2 +7 -7 exim/exim-test/stdout/0035
1.2 +5 -5 exim/exim-test/stdout/3415
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.495
retrieving revision 1.496
diff -u -r1.495 -r1.496
--- ChangeLog 14 Mar 2007 11:22:23 -0000 1.495
+++ ChangeLog 14 Mar 2007 12:15:56 -0000 1.496
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.495 2007/03/14 11:22:23 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.496 2007/03/14 12:15:56 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -174,6 +174,13 @@
all the secondary addresses of the first item were incorrectly removed
from the list, along with the local host and any following hosts (which
is what is supposed to happen).
+
+PH/40 When Exim receives a message, it writes the login name, uid, and gid of
+ whoever called Exim into the -H file. In the case of the daemon it was
+ behaving confusingly. When first started, it used values for whoever
+ started the daemon, but after a SIGHUP it used the Exim user (because it
+ calls itself on a restart). I have changed the code so that it now always
+ uses the Exim user.
Exim version 4.66
Index: daemon.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/daemon.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- daemon.c 23 Jan 2007 14:34:02 -0000 1.22
+++ daemon.c 14 Mar 2007 12:15:56 -0000 1.23
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/daemon.c,v 1.22 2007/01/23 14:34:02 ph10 Exp $ */
+/* $Cambridge: exim/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 @@
void
daemon_go(void)
{
+struct passwd *pw;
int *listen_sockets = NULL;
int listen_socket_count = 0;
ip_address_item *addresses = NULL;
@@ -1452,6 +1453,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). */
Index: runtest
===================================================================
RCS file: /home/cvs/exim/exim-test/runtest,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- runtest 8 Feb 2007 15:16:19 -0000 1.24
+++ runtest 14 Mar 2007 12:15:56 -0000 1.25
@@ -1,6 +1,6 @@
#! /usr/bin/perl -w
-# $Cambridge: exim/exim-test/runtest,v 1.24 2007/02/08 15:16:19 ph10 Exp $
+# $Cambridge: exim/exim-test/runtest,v 1.25 2007/03/14 12:15:56 ph10 Exp $
###############################################################################
# This is the controlling script for the "new" test suite for Exim. It should #
@@ -463,9 +463,10 @@
# ======== Exim's login ========
- # For bounce messages, this will appear on the U= lines in logs and also
- # after Received: and in addresses. In one pipe test it appears after
- # "Running as:". It also appears in addresses, and in the names of lock
+ # For messages received by the daemon, this is in the -H file, which some
+ # tests inspect. For bounce messages, this will appear on the U= lines in
+ # logs and also after Received: and in addresses. In one pipe test it appears
+ # after "Running as:". It also appears in addresses, and in the names of lock
# files.
s/U=$parm_eximuser/U=EXIMUSER/;
@@ -481,6 +482,8 @@
s/\buid=$parm_exim_uid\b/uid=EXIM_UID/g;
s/\bgid=$parm_exim_gid\b/gid=EXIM_GID/g;
+
+ s/^$parm_eximuser $parm_exim_uid $parm_exim_gid/EXIMUSER EXIM_UID EXIM_GID/;
# ======== General uids, gids, and pids ========
Index: 0035
===================================================================
RCS file: /home/cvs/exim/exim-test/stdout/0035,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0035 7 Feb 2006 10:47:37 -0000 1.1
+++ 0035 14 Mar 2007 12:15:56 -0000 1.2
@@ -135,7 +135,7 @@
<<< 221 myhost.test.ex closing connection
End of script
10HmaX-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<notsubmit@y>
ddddddddd 0
-helo_name rhu.barb
@@ -154,7 +154,7 @@
id 10HmaX-0005vi-00
for x@y; Tue, 2 Mar 1999 09:44:33 +0000
10HmaY-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<a@y>
ddddddddd 0
-helo_name rhu.barb
@@ -176,7 +176,7 @@
dddF From: a@y
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmaZ-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<>
ddddddddd 0
-helo_name rhu.barb
@@ -196,7 +196,7 @@
047I Message-Id: <E10HmaZ-0005vi-00@???>
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmbA-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<notsubmit@y>
ddddddddd 0
-helo_name rhu.barb
@@ -216,7 +216,7 @@
for x@y; Tue, 2 Mar 1999 09:44:33 +0000
dddS Sender: sender@???
10HmbB-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<a@y>
ddddddddd 0
-helo_name rhu.barb
@@ -239,7 +239,7 @@
dddF From: a@y
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmbC-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<a@y>
ddddddddd 0
-helo_name rhu.barb
@@ -262,7 +262,7 @@
dddF From: a@y
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmbD-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<a@y>
ddddddddd 0
-helo_name rhu.barb
Index: 3415
===================================================================
RCS file: /home/cvs/exim/exim-test/stdout/3415,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 3415 7 Feb 2006 10:47:37 -0000 1.1
+++ 3415 14 Mar 2007 12:15:56 -0000 1.2
@@ -144,7 +144,7 @@
<<< 221 myhost.test.ex closing connection
End of script
10HmaX-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<username@???>
ddddddddd 0
-helo_name rhu.barb
@@ -169,7 +169,7 @@
dddS Sender: username@???
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmaY-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<>
ddddddddd 0
-helo_name rhu.barb
@@ -192,7 +192,7 @@
dddF From: username@???
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmaZ-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<>
ddddddddd 0
-helo_name rhu.barb
@@ -215,7 +215,7 @@
dddF From: username@???
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmbA-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<>
ddddddddd 0
-helo_name rhu.barb
@@ -238,7 +238,7 @@
dddF From: username@???
038 Date: Tue, 2 Mar 1999 09:44:33 +0000
10HmbB-0005vi-00-H
-CALLER UID GID
+EXIMUSER EXIM_UID EXIM_GID
<>
ddddddddd 0
-helo_name rhu.barb