X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/90bd3832bc0ff090ac5e37dfc66b30cabb9cfc1a..a5e7a642059ee28d6d19c7a8f75d820b65c858b9:/src/src/receive.c diff --git a/src/src/receive.c b/src/src/receive.c index abac05c56..cc64f44f4 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -290,12 +290,11 @@ Returns: FALSE if there isn't enough space, or if the information cannot BOOL receive_check_fs(int msg_size) { -int_eximarith_t space; int inodes; if (check_spool_space > 0 || msg_size > 0 || check_spool_inodes > 0) { - space = receive_statvfs(TRUE, &inodes); + int_eximarith_t space = receive_statvfs(TRUE, &inodes); DEBUG(D_receive) debug_printf("spool directory space = " PR_EXIM_ARITH "K inodes = %d " @@ -313,7 +312,7 @@ if (check_spool_space > 0 || msg_size > 0 || check_spool_inodes > 0) if (check_log_space > 0 || check_log_inodes > 0) { - space = receive_statvfs(FALSE, &inodes); + int_eximarith_t space = receive_statvfs(FALSE, &inodes); DEBUG(D_receive) debug_printf("log directory space = " PR_EXIM_ARITH "K inodes = %d " @@ -1749,7 +1748,7 @@ uschar *user_msg, *log_msg; /* Working header pointers */ rmark reset_point; -header_line *next; +header_line * next; /* Flags for noting the existence of certain headers (only one left) */ @@ -1757,15 +1756,16 @@ BOOL date_header_exists = FALSE; /* Pointers to receive the addresses of headers whose contents we need. */ -header_line *from_header = NULL; -header_line *subject_header = NULL; -header_line *msgid_header = NULL; -header_line *received_header; +header_line * from_header = NULL; +#ifdef SUPPORT_DMARC +header_line * dmarc_from_header = NULL; +#endif +header_line * subject_header = NULL, * msgid_header = NULL, * received_header; BOOL msgid_header_newly_created = FALSE; /* Variables for use when building the Received: header. */ -uschar *timestamp; +uschar * timestamp; int tslen; /* Time of creation of message_id */ @@ -2252,8 +2252,7 @@ OVERSIZE: if (isspace(*p)) break; while (mac_isgraph(*p) && *p != ':') p++; - while (isspace(*p)) p++; - if (*p != ':') + if (Uskip_whitespace(&p) != ':') { body_zerocount = had_zero; break; @@ -2448,19 +2447,23 @@ for (header_line * h = header_list->next; h; h = h->next) case htype_from: h->type = htype_from; +#ifdef SUPPORT_DMARC + if (!is_resent) dmarc_from_header = h; +#endif if (!resents_exist || is_resent) { from_header = h; if (!smtp_input) { int len; - uschar *s = Ustrchr(h->text, ':') + 1; - while (isspace(*s)) s++; + uschar * s = Ustrchr(h->text, ':') + 1; + + Uskip_whitespace(&s); len = h->slen - (s - h->text) - 1; if (Ustrlen(originator_login) == len && strncmpic(s, originator_login, len) == 0) { - uschar *name = is_resent? US"Resent-From" : US"From"; + uschar * name = is_resent ? US"Resent-From" : US"From"; header_add(htype_from, "%s: %s <%s@%s>\n", name, originator_name, originator_login, qualify_domain_sender); from_header = header_last; @@ -2515,15 +2518,13 @@ for (header_line * h = header_list->next; h; h = h->next) if (filter_test != FTEST_NONE) { - uschar *start = h->text + 12; - uschar *end = start + Ustrlen(start); - while (isspace(*start)) start++; + uschar * start = h->text + 12; + uschar * end = start + Ustrlen(start); + + Uskip_whitespace(&start); while (end > start && isspace(end[-1])) end--; if (*start == '<' && end[-1] == '>') - { - start++; - end--; - } + { start++; end--; } return_path = string_copyn(start, end - start); printf("Return-path taken from \"Return-path:\" header line\n"); } @@ -2627,7 +2628,7 @@ if (extract_recip) (!contains_resent_headers || strncmpic(h->text, US"resent-", 7) == 0)) { uschar * s = Ustrchr(h->text, ':') + 1; - while (isspace(*s)) s++; + Uskip_whitespace(&s); f.parse_allow_group = TRUE; /* Allow address group syntax */ @@ -2707,7 +2708,7 @@ if (extract_recip) /* Move on past this address */ s = ss + (*ss ? 1 : 0); - while (isspace(*s)) s++; + Uskip_whitespace(&s); } /* Next address */ f.parse_allow_group = FALSE; /* Reset group syntax flags */ @@ -3517,7 +3518,7 @@ else #ifndef DISABLE_DKIM if (!f.dkim_disable_verify) { - /* Finish verification */ + /* Finish off the body hashes, calculate sigs and do compares */ dkim_exim_verify_finish(); /* Check if we must run the DKIM ACL */ @@ -3526,12 +3527,10 @@ else { uschar * dkim_verify_signers_expanded = expand_string(dkim_verify_signers); - gstring * results = NULL; - int signer_sep = 0; + gstring * results = NULL, * seen_items = NULL; + int signer_sep = 0, old_pool = store_pool; const uschar * ptr; uschar * item; - gstring * seen_items = NULL; - int old_pool = store_pool; store_pool = POOL_PERM; /* Allow created variables to live to data ACL */ @@ -3540,7 +3539,10 @@ else "expansion of dkim_verify_signers option failed: %s", expand_string_message); - /* Default to OK when no items are present */ + /* Loop over signers we want to verify, calling ACL. Default to OK + when no signers are present. Each call from here expands to a n ACL + call per matching sig in the message. */ + rc = OK; while ((item = string_nextinlist(&ptr, &signer_sep, NULL, 0))) { @@ -3585,6 +3587,9 @@ else cancel_cutthrough_connection(TRUE, US"dkim acl not ok"); break; } + else + if (dkim_verify_minimal && Ustrcmp(dkim_verify_status, "pass") == 0) + break; } dkim_verify_status = string_from_gstring(results); store_pool = old_pool; @@ -3605,7 +3610,7 @@ else goto NOT_ACCEPTED; /* Skip to end of function */ } } - else + else /* No acl or no wanted signers */ dkim_exim_verify_log_all(); } #endif /* DISABLE_DKIM */ @@ -3622,7 +3627,7 @@ else #endif /* WITH_CONTENT_SCAN */ #ifdef SUPPORT_DMARC - dmarc_store_data(from_header); + dmarc_store_data(dmarc_from_header); #endif #ifndef DISABLE_PRDR @@ -4625,3 +4630,5 @@ return yield; /* TRUE if more messages (SMTP only) */ } /* End of receive.c */ +/* vi: se aw ai sw=2 +*/