[exim-cvs] tidying

Góra strony
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
Dla: exim-cvs
Temat: [exim-cvs] tidying
Gitweb: https://git.exim.org/exim.git/commitdiff/d0c48016539a09140c45bc2b93e3c6cddf0b711d
Commit:     d0c48016539a09140c45bc2b93e3c6cddf0b711d
Parent:     a630c66b842bb8ca83f2716b5ae156598e823040
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Mon Jul 1 08:18:51 2024 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Jul 9 15:17:51 2024 +0100


    tidying
---
 src/src/daemon.c          | 25 ++++++++++++++-----------
 src/src/deliver.c         | 20 ++++++++++++--------
 src/src/transports/smtp.c |  9 +++++----
 3 files changed, 31 insertions(+), 23 deletions(-)


diff --git a/src/src/daemon.c b/src/src/daemon.c
index 16137f9f6..f3c49e25e 100644
--- a/src/src/daemon.c
+++ b/src/src/daemon.c
@@ -324,7 +324,8 @@ if (smtp_accept_max_per_host)
tedious per host_address checks. Note that at this stage smtp_accept_count
contains the count of *other* connections, not including this one. */

-if (max_for_this_host > 0 && smtp_accept_count >= max_for_this_host)
+if (  smtp_slots
+   && max_for_this_host > 0 && smtp_accept_count >= max_for_this_host)
   {
   int host_accept_count = 0;
   int other_host_count = 0;    /* keep a count of non matches to optimise */
@@ -392,9 +393,9 @@ if (pid == 0)
   arrange to unset the selector in the subprocess.


jgh 2023/08/08 :- moved this logging in from the parent process, just
- pre-fork. There was a claim back from 2004 that smtp_accept_count could have
- become out-of-date by the time the child could log it, and I can't see how
- that could happen. */
+ pre-fork. There was a claim back from 4.21 (when it was moved from
+ smtp_start_session()) that smtp_accept_count could have become out-of-date by
+ the time the child could log it, and I can't see how that could happen. */

   if (LOGGING(smtp_connection))
     {
@@ -404,7 +405,8 @@ if (pid == 0)
       save_log_selector &= ~L_smtp_connection;
     else if (LOGGING(connection_id))
       log_write(L_smtp_connection, LOG_MAIN, "SMTP connection from %Y "
-    "Ci=%lu (TCP/IP connection count = %d)", whofrom, connection_id, smtp_accept_count);
+    "Ci=%lu (TCP/IP connection count = %d)",
+    whofrom, connection_id, smtp_accept_count);
     else
       log_write(L_smtp_connection, LOG_MAIN, "SMTP connection from %Y "
     "(TCP/IP connection count = %d)", whofrom, smtp_accept_count);
@@ -752,7 +754,7 @@ remember the pid for ticking off when the child completes. */


 if (pid < 0)
   never_error(US"daemon: accept process fork failed", US"Fork failed", errno);
-else
+else if (smtp_slots)
   {
   for (int i = 0; i < smtp_accept_max; ++i)
     if (smtp_slots[i].pid <= 0)
@@ -912,12 +914,13 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
   if (smtp_slots)
     {
     int i;
-    for (i = 0; i < smtp_accept_max; i++)
-      if (smtp_slots[i].pid == pid)
+    smtp_slot * sp;
+    for (i = 0, sp = smtp_slots; i < smtp_accept_max; i++, sp++)
+      if (sp->pid == pid)
         {
-        if (smtp_slots[i].host_address)
-          store_free(smtp_slots[i].host_address);
-        smtp_slots[i] = empty_smtp_slot;
+        if (sp->host_address)
+          store_free(sp->host_address);
+        *sp = empty_smtp_slot;
         if (--smtp_accept_count < 0) smtp_accept_count = 0;
         DEBUG(D_any) debug_printf("%d SMTP accept process%s now running\n",
           smtp_accept_count, smtp_accept_count == 1 ? "" : "es");
diff --git a/src/src/deliver.c b/src/src/deliver.c
index b828f8094..33d833389 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -3660,16 +3660,20 @@ while (!done)
         h->dnssec = *ptr == '2' ? DS_YES
               : *ptr == '1' ? DS_NO
               : DS_UNK;
-        ptr++;
         addr->host_used = h;
         }
-      else ptr++;
+      ptr++;


       continue_flags = 0;
+#ifndef DISABLE_TLS
       if (testflag(addr, af_cert_verified)) continue_flags |= CTF_CV;
+# ifdef SUPPORT_DANE
       if (testflag(addr, af_dane_verified)) continue_flags |= CTF_DV;
+# endif
+# ifndef DISABLE_TLS_RESUME
       if (testflag(addr, af_tls_resume))    continue_flags |= CTF_TR;
-
+# endif
+#endif
       /* Finished with this address */


       addr = addr->next;
@@ -4912,17 +4916,17 @@ do_remote_deliveries par_reduce par_wait par_read_pipe
       {
       uschar * ptr;


+#ifndef DISABLE_TLS
       /* The certificate verification status goes into the flags, in A0 */
       if (tls_out.certificate_verified) setflag(addr, af_cert_verified);
-#ifdef SUPPORT_DANE
+# ifdef SUPPORT_DANE
       if (tls_out.dane_verified)        setflag(addr, af_dane_verified);
-#endif
-#ifndef DISABLE_TLS_RESUME
+# endif
+# ifndef DISABLE_TLS_RESUME
       if (tls_out.resumption & RESUME_USED) setflag(addr, af_tls_resume);
-#endif
+# endif


       /* Use an X item only if there's something to send */
-#ifndef DISABLE_TLS
       if (addr->cipher)
         {
         ptr = big_buffer + sprintf(CS big_buffer, "%.128s", addr->cipher) + 1;
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index 5d50715d6..3780f5ca9 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -4558,10 +4558,11 @@ if (!sx->ok)


       case ERRNO_SMTPCLOSED:
     /* If the peer closed the TCP connection after end-of-data, but before
-    we could send QUIT, do TLS close, etc - call it a message error.
-    Otherwise, if all the recipients have been dealt with, call a close no
-    error at all; each address_item should have a suitable result already
-    (2xx: PENDING_OK, 4xx: DEFER, 5xx: FAIL) */
+    we could send QUIT, do TLS close, etc - it is a message error.
+    If not, and all the recipients have been dealt with, call such a close
+    no error at all; each address_item should have a suitable result already
+    (2xx: PENDING_OK, 4xx: DEFER, 5xx: FAIL).
+    Otherwise, it is a non-message error. */


     if (!(message_error = Ustrncmp(smtp_command,"end ",4) == 0))
       {


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/