Adapt PRVS BATV scheme address format to latest draft version
[exim.git] / src / src / daemon.c
index 1e639453cd1fc51fe39c520ee37fdf292d9da776..e844403a440e0b53e842a0507c1f59646d98a48a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/daemon.c,v 1.21 2007/01/17 11:29:39 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    *
@@ -369,6 +369,8 @@ if (pid == 0)
   struct sigaction act;
   #endif
 
+  smtp_accept_count++;    /* So that it includes this process */
+
   /* May have been modified for the subprocess */
 
   log_write_selector = use_log_write_selector;
@@ -459,7 +461,7 @@ if (pid == 0)
   configured value and may therefore already be TRUE. Leave logging
   till later so it will have a message id attached. */
 
-  if (smtp_accept_queue > 0 && smtp_accept_count >= smtp_accept_queue)
+  if (smtp_accept_queue > 0 && smtp_accept_count > smtp_accept_queue)
     {
     local_queue_only = TRUE;
     queue_only_reason = 1;
@@ -879,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;
@@ -1451,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). */