-/* $Cambridge: exim/src/src/malware.c,v 1.19 2010/06/05 11:13:30 pdp Exp $ */
+/* $Cambridge: exim/src/src/malware.c,v 1.21 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
Returns: Exim message processing code (OK, FAIL, DEFER, ...)
where true means malware was found (condition applies)
*/
-int malware_in_file(uschar *eml_filename) {
+int
+malware_in_file(uschar *eml_filename) {
uschar *scan_options[2];
uschar message_id_buf[64];
int ret;
- scan_options[0] = "*";
+ scan_options[0] = US"*";
scan_options[1] = NULL;
/* 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),
- US"dummy-%d", pseudo_random_number(INT_MAX));
+ "dummy-%d", pseudo_random_number(INT_MAX));
message_id = message_id_buf;
- sender_address = "malware-sender@example.net";
- return_path = "";
+ sender_address = US"malware-sender@example.net";
+ return_path = US"";
recipients_list = NULL;
- receive_add_recipient("malware-victim@example.net", -1);
+ receive_add_recipient(US"malware-victim@example.net", -1);
enable_dollar_recipients = TRUE;
ret = malware_internal(scan_options, eml_filename, TRUE);
- strncpy(spooled_message_id, message_id, sizeof(spooled_message_id));
+ 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 */
log_write(0, LOG_MAIN|LOG_PANIC,
"malware filename does not fit in buffer [malware_internal() kavdaemon]");
}
- p = strrchr(scanrequest, '/');
+ p = Ustrrchr(scanrequest, '/');
if (p)
*p = '\0';
"malware filename does not fit in buffer [malware_internal() cmdline]");
return DEFER;
}
- p = strrchr(eml_filename, '/');
+ p = Ustrrchr(eml_filename, '/');
if (p)
*p = '\0';
fits = string_format(commandline, sizeof(commandline), CS cmdline_scanner, file_name);
struct sockaddr_un server;
int sock, len;
uschar *p;
- BOOL fits;
uschar file_name[1024];
uschar av_buffer[1024];
return DEFER;
}
memcpy(file_name, eml_filename, len);
- p = strrchr(file_name, '/');
+ p = Ustrrchr(file_name, '/');
if (p)
*p = '\0';
uschar clamd_options2_buffer[1024];
uschar clamd_options2_default[] = "";
uschar *clamav_fbuf;
- uschar scanrequest[1024];
- int sockData, clam_fd, result;
+ int clam_fd, result;
unsigned int fsize;
BOOL use_scan_command, fits;
#ifdef WITH_OLD_CLAMAV_STREAM
uschar av_buffer2[1024];
+ int sockData;
#else
uint32_t send_size, send_final_zeroblock;
#endif