Avoid modifying global errno when raising event
[exim.git] / src / src / verify.c
index 07e663536268b3d8f70b4c005bd1d7c172a74897..6478a9e7e94072eeca52348cf7695c650ac86859 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 */
+/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Functions concerned with verifying things. The original code for callout
@@ -815,7 +815,7 @@ tls_retry_connection:
            sx->cctx.sock = -1;
 #ifndef DISABLE_EVENT
            (void) event_raise(addr->transport->event_action,
-                             US"tcp:close", NULL);
+                             US"tcp:close", NULL, NULL);
 #endif
            addr->address = main_address;
            addr->transport_return = PENDING_DEFER;
@@ -1127,7 +1127,7 @@ no_conn:
        (void)close(sx->cctx.sock);
        sx->cctx.sock = -1;
 #ifndef DISABLE_EVENT
-       (void) event_raise(addr->transport->event_action, US"tcp:close", NULL);
+       (void) event_raise(addr->transport->event_action, US"tcp:close", NULL, NULL);
 #endif
        }
       }
@@ -1685,7 +1685,8 @@ if (parse_find_at(address) == NULL)
     *failure_ptr = US"qualify";
     return FAIL;
     }
-  address = rewrite_address_qualify(address, options & vopt_is_recipient);
+  /* deconst ok as address was not const */
+  address = US rewrite_address_qualify(address, options & vopt_is_recipient);
   }
 
 DEBUG(D_verify)
@@ -1700,7 +1701,8 @@ may have been set by domains and local part tests during an ACL. */
 if (global_rewrite_rules)
   {
   uschar *old = address;
-  address = rewrite_address(address, options & vopt_is_recipient, FALSE,
+  /* deconst ok as address was not const */
+  address = US rewrite_address(address, options & vopt_is_recipient, FALSE,
     global_rewrite_rules, rewrite_existflags);
   if (address != old)
     {
@@ -3388,8 +3390,8 @@ if ((rc = verify_address(&vaddr, NULL, vopt_is_recipient | vopt_quota,
 
   len = 5 + Ustrlen(msg) + 1 + Ustrlen(where);
   msg = string_sprintf("%c%c%c%c%c%s%c%s", (uschar)rc,
-    (vaddr.basic_errno >> 24) && 0xff, (vaddr.basic_errno >> 16) && 0xff,
-    (vaddr.basic_errno >> 8) && 0xff, vaddr.basic_errno && 0xff,
+    (vaddr.basic_errno >> 24) & 0xff, (vaddr.basic_errno >> 16) & 0xff,
+    (vaddr.basic_errno >> 8) & 0xff, vaddr.basic_errno & 0xff,
     where, '\0', msg);
   }
 
@@ -3575,9 +3577,10 @@ else
 
 close(pfd[pipe_read]);
 errno = save_errno;
+return yield;
 
 fail:
-
+DEBUG(D_verify) debug_printf_indent("verify_quota_call fail in %s\n", where);
 return yield;
 }