diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-07-07 20:48:53 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-07-07 20:52:42 +0100 |
commit | 55240832db97f7a16fd6ef2e2bb8d899897a1347 (patch) | |
tree | 8d7aeb4cbea5a2a6fa1df70225c5c6f86b061830 | |
parent | 59f02c29435a81d2689bf5c8c1165bc90f1b7589 (diff) |
tidying
-rw-r--r-- | src/exim_monitor/em_queue.c | 17 | ||||
-rw-r--r-- | src/src/malware.c | 71 |
2 files changed, 42 insertions, 46 deletions
diff --git a/src/exim_monitor/em_queue.c b/src/exim_monitor/em_queue.c index 103e63dd4..4bdc57ab9 100644 --- a/src/exim_monitor/em_queue.c +++ b/src/exim_monitor/em_queue.c @@ -659,19 +659,12 @@ domains are lower cased. */ if (recipients_list) for (i = 0; i < recipients_count; i++) { - uschar *pp; - uschar *r = recipients_list[i].address; - tree_node *node = tree_search(tree_nonrecipients, r); + uschar * pp; + uschar * r = recipients_list[i].address; + tree_node * node; - if (!node) - { - uschar temp[256]; - uschar *rr = temp; - Ustrncpy(temp, r, sizeof(temp)); - while (*rr && *rr != '@') rr++; - while (*rr) { *rr = tolower(*rr); rr++; } - node = tree_search(tree_nonrecipients, temp); - } + if (!(node = tree_search(tree_nonrecipients, r))) + node = tree_search(tree_nonrecipients, string_copylc(r)); if ((pp = strstric(r+1, qualify_domain, FALSE)) && *(--pp) == '@') *pp = 0; diff --git a/src/src/malware.c b/src/src/malware.c index b67f31598..a5944cafb 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -108,7 +108,7 @@ BOOL malware_ok = FALSE; the scan directory normally for that case, but look into rigging up the needed header variables if not already set on the command-line? */ extern int spool_mbox_ok; -extern uschar spooled_message_id[17]; +extern uschar spooled_message_id[MESSAGE_ID_LENGTH+1]; @@ -1947,15 +1947,15 @@ Returns: Exim message processing code (OK, FAIL, DEFER, ...) int malware(const uschar * malware_re, int timeout) { - uschar * scan_filename; - int ret; +uschar * scan_filename; +int ret; - scan_filename = string_sprintf("%s/scan/%s/%s.eml", - spool_directory, message_id, message_id); - ret = malware_internal(malware_re, scan_filename, timeout, FALSE); - if (ret == DEFER) av_failed = TRUE; +scan_filename = string_sprintf("%s/scan/%s/%s.eml", + spool_directory, message_id, message_id); +ret = malware_internal(malware_re, scan_filename, timeout, FALSE); +if (ret == DEFER) av_failed = TRUE; - return ret; +return ret; } @@ -1977,32 +1977,35 @@ Returns: Exim message processing code (OK, FAIL, DEFER, ...) int malware_in_file(uschar *eml_filename) { - uschar message_id_buf[64]; - int ret; - - /* spool_mbox() assumes various parameters exist, when creating - the relevant directory and the email within */ - (void) string_format(message_id_buf, sizeof(message_id_buf), - "dummy-%d", vaguely_random_number(INT_MAX)); - message_id = message_id_buf; - sender_address = US"malware-sender@example.net"; - return_path = US""; - recipients_list = NULL; - receive_add_recipient(US"malware-victim@example.net", -1); - enable_dollar_recipients = TRUE; - - ret = malware_internal(US"*", eml_filename, 0, TRUE); - - Ustrncpy(spooled_message_id, message_id, sizeof(spooled_message_id)); - spool_mbox_ok = 1; - /* don't set no_mbox_unspool; at present, there's no way for it to become - set, but if that changes, then it should apply to these tests too */ - unspool_mbox(); - - /* silence static analysis tools */ - message_id = NULL; - - return ret; +uschar message_id_buf[64]; +int ret; + +/* spool_mbox() assumes various parameters exist, when creating +the relevant directory and the email within */ + +(void) string_format(message_id_buf, sizeof(message_id_buf), + "dummy-%d", vaguely_random_number(INT_MAX)); +message_id = message_id_buf; +sender_address = US"malware-sender@example.net"; +return_path = US""; +recipients_list = NULL; +receive_add_recipient(US"malware-victim@example.net", -1); +enable_dollar_recipients = TRUE; + +ret = malware_internal(US"*", eml_filename, 0, TRUE); + +Ustrncpy(spooled_message_id, message_id, sizeof(spooled_message_id)); +spool_mbox_ok = 1; + +/* don't set no_mbox_unspool; at present, there's no way for it to become +set, but if that changes, then it should apply to these tests too */ + +unspool_mbox(); + +/* silence static analysis tools */ +message_id = NULL; + +return ret; } |