X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/3857519629ca8fbcf3466c3fc761a5bb6ed32d53..90bd3832bc0ff090ac5e37dfc66b30cabb9cfc1a:/src/src/moan.c diff --git a/src/src/moan.c b/src/src/moan.c index 9c30c8edd..6fe82b29c 100644 --- a/src/src/moan.c +++ b/src/src/moan.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) The Exim Maintainers 2020 - 2022 */ +/* Copyright (c) The Exim Maintainers 2020 - 2023 */ /* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ /* SPDX-License-Identifier: GPL-2.0-or-later */ @@ -30,8 +30,9 @@ Returns: nothing void moan_write_from(FILE *f) { -uschar * s = expand_string(dsn_from); -if (!s) +uschar * s; +GET_OPTION("dsn_from"); +if (!(s = expand_string(dsn_from))) { log_write(0, LOG_MAIN|LOG_PANIC, "Failed to expand dsn_from (using default): %s", expand_string_message); @@ -158,8 +159,8 @@ Returns: TRUE if message successfully sent */ BOOL -moan_send_message(uschar *recipient, int ident, error_block *eblock, - header_line *headers, FILE *message_file, uschar *firstline) +moan_send_message(const uschar * recipient, int ident, error_block * eblock, + header_line * headers, FILE * message_file, uschar * firstline) { int written = 0; int fd; @@ -175,6 +176,7 @@ uschar * s, * s2; /* For DMARC if there is a specific sender set, expand the variable for the header From: and grab the address from that for the envelope FROM. */ +GET_OPTION("dmarc_forensic_sender"); if ( ident == ERRMESS_DMARC_FORENSIC && dmarc_forensic_sender && (s = expand_string(dmarc_forensic_sender)) @@ -513,9 +515,12 @@ if (check_sender && message_file && f.trusted_caller && { uschar *new_sender = NULL; if (regex_match_and_setup(regex_From, big_buffer, 0, -1)) + { + GET_OPTION("uucp_from_sender"); new_sender = expand_string(uucp_from_sender); + } if (new_sender) sender_address = new_sender; - else firstline = big_buffer; + else firstline = big_buffer; } /* If viable sender address, send a message */ @@ -561,7 +566,7 @@ switch(ident) case ERRMESS_TOOMANYRECIP: log_write(0, LOG_MAIN, "%s: too many recipients (max set to %d)", msg, - recipients_max); + recipients_max_expanded); break; case ERRMESS_LOCAL_SCAN: @@ -631,7 +636,7 @@ if (addr) fprintf(f, "\nThe following address(es) have yet to be delivered:\n"); for (; addr; addr = addr->next) { - uschar * parent = addr->parent ? addr->parent->address : NULL; + const uschar * parent = addr->parent ? addr->parent->address : NULL; fprintf(f, " %s", addr->address); if (parent) fprintf(f, " <%s>", parent); if (addr->basic_errno > 0) fprintf(f, ": %s", strerror(addr->basic_errno)); @@ -734,22 +739,23 @@ Returns: additional recipient list or NULL */ uschar * -moan_check_errorcopy(uschar *recipient) +moan_check_errorcopy(const uschar * recipient) { -uschar *item, *localpart, *domain; -const uschar *listptr = errors_copy; +uschar * item; +const uschar * localpart, * domain; +const uschar * listptr = errors_copy; uschar *yield = NULL; int sep = 0; int llen; -if (errors_copy == NULL) return NULL; +if (!errors_copy) return NULL; /* Set up pointer to the local part and domain, and compute the length of the local part. */ localpart = recipient; domain = Ustrrchr(recipient, '@'); -if (domain == NULL) return NULL; /* should not occur, but avoid crash */ +if (!domain) return NULL; /* should not occur, but avoid crash */ llen = domain++ - recipient; /* Scan through the configured items */