diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/src/EDITME | 33 | ||||
-rw-r--r-- | src/src/acl.c | 4 | ||||
-rw-r--r-- | src/src/functions.h | 4 | ||||
-rw-r--r-- | src/src/globals.c | 4 | ||||
-rw-r--r-- | src/src/header.c | 3 | ||||
-rw-r--r-- | src/src/macros.h | 4 | ||||
-rw-r--r-- | src/src/malware.c | 471 | ||||
-rw-r--r-- | src/src/mime.c | 10 | ||||
-rw-r--r-- | src/src/receive.c | 4 | ||||
-rw-r--r-- | src/src/regex.c | 6 | ||||
-rw-r--r-- | src/src/spam.c | 6 | ||||
-rw-r--r-- | src/src/spool_mbox.c | 36 | ||||
-rw-r--r-- | src/src/srs.c | 6 | ||||
-rw-r--r-- | src/src/version.c | 4 |
14 files changed, 300 insertions, 295 deletions
diff --git a/src/src/EDITME b/src/src/EDITME index aefed22ce..b70c3272b 100644 --- a/src/src/EDITME +++ b/src/src/EDITME @@ -1,4 +1,4 @@ -# $Cambridge: exim/src/src/EDITME,v 1.5 2004/12/16 15:11:47 tom Exp $ +# $Cambridge: exim/src/src/EDITME,v 1.6 2004/12/17 14:52:44 ph10 Exp $ ################################################## # The Exim mail transport agent # @@ -321,42 +321,45 @@ EXIM_MONITOR=eximon.bin # and the MIME ACL. Please read the documentation to learn more about these # features. -#WITH_CONTENT_SCAN=yes +# WITH_CONTENT_SCAN=yes # If you want to use the deprecated "demime" condition in the DATA ACL, # uncomment the line below. Doing so will also explicitly turn on the # WITH_CONTENT_SCAN option. If possible, use the MIME ACL instead of # the "demime" condition. -#WITH_OLD_DEMIME=yes +# WITH_OLD_DEMIME=yes #------------------------------------------------------------------------------ # Compiling Exim with experimental features. These are documented in # experimental-spec.txt. "Experimental" means that the way these features are -# implemented may still change. Backward compatability is not guaranteed. +# implemented may still change. Backward compatibility is not guaranteed. # Uncomment the following lines to add SPF support. You need to have libspf2 # installed on your system (www.libspf2.org). Depending on where it is installed # you may have to edit the CFLAGS and LDFLAGS lines. -#EXPERIMENTAL_SPF=yes -#CFLAGS += -I/usr/local/include -#LDFLAGS += -lspf2 -# Uncommend the following lines to add SRS (Sender rewriting scheme) support. +# EXPERIMENTAL_SPF=yes +# CFLAGS += -I/usr/local/include +# LDFLAGS += -lspf2 + +# Uncomment the following lines to add SRS (Sender rewriting scheme) support. # You need to have libsrs_alt installed on your system (srs.mirtol.com). # Depending on where it is installed you may have to edit the CFLAGS and # LDFLAGS lines. -#EXPERIMENTAL_SRS=yes -#CFLAGS += -I/usr/local/include -#LDFLAGS += -lsrs_alt -# Uncommend the following lines to add Brightmail AntiSpam support. You need +# EXPERIMENTAL_SRS=yes +# CFLAGS += -I/usr/local/include +# LDFLAGS += -lsrs_alt + +# Uncomment the following lines to add Brightmail AntiSpam support. You need # to have the Brightmail client SDK installed. Please check the experimental # documentation for implementation details. You need to edit the CFLAGS and # LDFLAGS lines. -#EXPERIMENTAL_BRIGHTMAIL=yes -#CFLAGS += -I/opt/brightmail/bsdk-6.0/include -#LDFLAGS += -lxml2 -lbmiclient_single -L/opt/brightmail/bsdk-6.0/lib + +# EXPERIMENTAL_BRIGHTMAIL=yes +# CFLAGS += -I/opt/brightmail/bsdk-6.0/include +# LDFLAGS += -lxml2 -lbmiclient_single -L/opt/brightmail/bsdk-6.0/lib diff --git a/src/src/acl.c b/src/src/acl.c index 247ffbb62..128bde552 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/acl.c,v 1.6 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/acl.c,v 1.7 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -248,7 +248,7 @@ static unsigned int cond_forbids[] = { 0, /* delay */ -#ifdef WITH_CONTENT_SCAN +#ifdef WITH_OLD_DEMIME (1<<ACL_WHERE_NOTSMTP)|(1<<ACL_WHERE_AUTH)| /* demime */ (1<<ACL_WHERE_CONNECT)|(1<<ACL_WHERE_HELO)| (1<<ACL_WHERE_RCPT)|(1<<ACL_WHERE_PREDATA)| diff --git a/src/src/functions.h b/src/src/functions.h index af84860ee..de5f534f0 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/functions.h,v 1.7 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/functions.h,v 1.8 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -264,7 +264,7 @@ extern int smtp_ungetc(int); extern int smtp_write_command(smtp_outblock *, BOOL, char *, ...); #ifdef WITH_CONTENT_SCAN extern int spam(uschar **); -extern FILE *spool_mbox(unsigned long long *); +extern FILE *spool_mbox(unsigned long *); #endif extern BOOL spool_move_message(uschar *, uschar *, uschar *, uschar *); extern BOOL spool_open_datafile(uschar *); diff --git a/src/src/globals.c b/src/src/globals.c index be70d489d..f94678fee 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.9 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.10 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -695,7 +695,7 @@ uschar *message_reference = NULL; /* MIME ACL expandables */ #ifdef WITH_CONTENT_SCAN -int mime_anomaly_level = NULL; +int mime_anomaly_level = 0; uschar *mime_anomaly_text = NULL; uschar *mime_boundary = NULL; uschar *mime_charset = NULL; diff --git a/src/src/header.c b/src/src/header.c index a9d8e599c..55343206d 100644 --- a/src/src/header.c +++ b/src/src/header.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/header.c,v 1.2 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/header.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -48,7 +48,6 @@ return *tt == ':'; BOOL header_testname_incomplete(header_line *h, uschar *name, int len, BOOL notdel) { -uschar *tt; if (h->type == '*' && notdel) return FALSE; if (h->text == NULL || strncmpic(h->text, name, len) != 0) return FALSE; return TRUE; diff --git a/src/src/macros.h b/src/src/macros.h index da96396f8..8c76c89b8 100644 --- a/src/src/macros.h +++ b/src/src/macros.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/macros.h,v 1.5 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/macros.h,v 1.6 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -72,7 +72,7 @@ as unsigned. */ a no-op once an SSL session is in progress. */ #ifdef SUPPORT_TLS -#define mac_smtp_fflush() if (!tls_active) fflush(smtp_out); +#define mac_smtp_fflush() if (tls_active < 0) fflush(smtp_out); #else #define mac_smtp_fflush() fflush(smtp_out); #endif diff --git a/src/src/malware.c b/src/src/malware.c index 916480197..82111557c 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/malware.c,v 1.2 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/malware.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -48,7 +48,7 @@ int malware(uschar **listptr) { uschar *malware_regex; uschar malware_regex_buffer[64]; uschar malware_regex_default[] = ".+"; - unsigned long long mbox_size; + unsigned long mbox_size; FILE *mbox_file; int roffset; const pcre *re; @@ -127,258 +127,257 @@ int malware(uschar **listptr) { return DEFER; }; - /* "drweb" scanner type ----------------------------------------------- */ - /* v0.1 - added support for tcp sockets */ - /* v0.0 - initial release -- support for unix sockets */ - if (strcmpic(scanner_name,US"drweb") == 0) { - uschar *drweb_options; - uschar drweb_options_buffer[1024]; - uschar drweb_options_default[] = "/usr/local/drweb/run/drwebd.sock"; - struct sockaddr_un server; - int sock, port, result, ovector[30]; - unsigned int fsize; - uschar tmpbuf[1024], *drweb_fbuf; - uschar scanrequest[1024]; - uschar drweb_match_string[128]; - int drweb_rc, drweb_cmd, drweb_flags = 0x0000, drweb_fd, - drweb_vnum, drweb_slen, drweb_fin = 0x0000; - unsigned long bread; - uschar hostname[256]; - struct hostent *he; - struct in_addr in; - pcre *drweb_re; + /* "drweb" scanner type ----------------------------------------------- */ + /* v0.1 - added support for tcp sockets */ + /* v0.0 - initial release -- support for unix sockets */ + if (strcmpic(scanner_name,US"drweb") == 0) { + uschar *drweb_options; + uschar drweb_options_buffer[1024]; + uschar drweb_options_default[] = "/usr/local/drweb/run/drwebd.sock"; + struct sockaddr_un server; + int sock, result, ovector[30]; + unsigned int port, fsize; + uschar tmpbuf[1024], *drweb_fbuf; + uschar scanrequest[1024]; + uschar drweb_match_string[128]; + int drweb_rc, drweb_cmd, drweb_flags = 0x0000, drweb_fd, + drweb_vnum, drweb_slen, drweb_fin = 0x0000; + unsigned long bread; + uschar hostname[256]; + struct hostent *he; + struct in_addr in; + pcre *drweb_re; - if ((drweb_options = string_nextinlist(&av_scanner_work, &sep, - drweb_options_buffer, sizeof(drweb_options_buffer))) == NULL) { - /* no options supplied, use default options */ - drweb_options = drweb_options_default; - }; + if ((drweb_options = string_nextinlist(&av_scanner_work, &sep, + drweb_options_buffer, sizeof(drweb_options_buffer))) == NULL) { + /* no options supplied, use default options */ + drweb_options = drweb_options_default; + }; - if (*drweb_options != '/') { + if (*drweb_options != '/') { - /* extract host and port part */ - if( sscanf(CS drweb_options, "%s %u", hostname, &port) != 2 ) { - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: invalid socket '%s'", drweb_options); - return DEFER; - } + /* extract host and port part */ + if( sscanf(CS drweb_options, "%s %u", hostname, &port) != 2 ) { + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: invalid socket '%s'", drweb_options); + return DEFER; + } - /* Lookup the host */ - if((he = gethostbyname(CS hostname)) == 0) { - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: failed to lookup host '%s'", hostname); - return DEFER; - } + /* Lookup the host */ + if((he = gethostbyname(CS hostname)) == 0) { + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: failed to lookup host '%s'", hostname); + return DEFER; + } - in = *(struct in_addr *) he->h_addr_list[0]; + in = *(struct in_addr *) he->h_addr_list[0]; - /* Open the drwebd TCP socket */ - if ( (sock = ip_socket(SOCK_STREAM, AF_INET)) < 0) { - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to acquire socket (%s)", - strerror(errno)); - return DEFER; - } + /* Open the drwebd TCP socket */ + if ( (sock = ip_socket(SOCK_STREAM, AF_INET)) < 0) { + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to acquire socket (%s)", + strerror(errno)); + return DEFER; + } - if (ip_connect(sock, AF_INET, (uschar*)inet_ntoa(in), port, 5) < 0) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: connection to %s, port %u failed (%s)", - inet_ntoa(in), port, strerror(errno)); - return DEFER; - } + if (ip_connect(sock, AF_INET, (uschar*)inet_ntoa(in), port, 5) < 0) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: connection to %s, port %u failed (%s)", + inet_ntoa(in), port, strerror(errno)); + return DEFER; + } - /* prepare variables */ - drweb_cmd = htonl(DRWEBD_SCAN_CMD); - drweb_flags = htonl(DRWEBD_RETURN_VIRUSES | DRWEBD_IS_MAIL); - snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml", - spool_directory, message_id, message_id); + /* prepare variables */ + drweb_cmd = htonl(DRWEBD_SCAN_CMD); + drweb_flags = htonl(DRWEBD_RETURN_VIRUSES | DRWEBD_IS_MAIL); + snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml", + spool_directory, message_id, message_id); - /* calc file size */ - drweb_fd = open(CS scanrequest, O_RDONLY); - if (drweb_fd == -1) { - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: can't open spool file %s: %s", - scanrequest, strerror(errno)); - return DEFER; - } - fsize = lseek(drweb_fd, 0, SEEK_END); - if (fsize == -1) { - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: can't seek spool file %s: %s", - scanrequest, strerror(errno)); - return DEFER; - } - drweb_slen = htonl(fsize); - lseek(drweb_fd, 0, SEEK_SET); + /* calc file size */ + drweb_fd = open(CS scanrequest, O_RDONLY); + if (drweb_fd == -1) { + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: can't open spool file %s: %s", + scanrequest, strerror(errno)); + return DEFER; + } + fsize = lseek(drweb_fd, 0, SEEK_END); + if (fsize == -1) { + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: can't seek spool file %s: %s", + scanrequest, strerror(errno)); + return DEFER; + } + drweb_slen = htonl(fsize); + lseek(drweb_fd, 0, SEEK_SET); - /* send scan request */ - if ((send(sock, &drweb_cmd, sizeof(drweb_cmd), 0) < 0) || - (send(sock, &drweb_flags, sizeof(drweb_flags), 0) < 0) || - (send(sock, &drweb_fin, sizeof(drweb_fin), 0) < 0) || - (send(sock, &drweb_slen, sizeof(drweb_slen), 0) < 0)) { - close(sock); - close(drweb_fd); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to send commands to socket (%s)", drweb_options); - return DEFER; - } + /* send scan request */ + if ((send(sock, &drweb_cmd, sizeof(drweb_cmd), 0) < 0) || + (send(sock, &drweb_flags, sizeof(drweb_flags), 0) < 0) || + (send(sock, &drweb_fin, sizeof(drweb_fin), 0) < 0) || + (send(sock, &drweb_slen, sizeof(drweb_slen), 0) < 0)) { + close(sock); + close(drweb_fd); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to send commands to socket (%s)", drweb_options); + return DEFER; + } - drweb_fbuf = (uschar *) malloc (fsize); - if (!drweb_fbuf) { - close(sock); - close(drweb_fd); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to allocate memory %u for file (%s)", - fsize, scanrequest); - return DEFER; - } + drweb_fbuf = (uschar *) malloc (fsize); + if (!drweb_fbuf) { + close(sock); + close(drweb_fd); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to allocate memory %u for file (%s)", + fsize, scanrequest); + return DEFER; + } - result = read (drweb_fd, drweb_fbuf, fsize); - if (result == -1) { - close(sock); - close(drweb_fd); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: can't read spool file %s: %s", - scanrequest, strerror(errno)); - return DEFER; - } - - /* send file body to socket */ - if (send(sock, drweb_fbuf, fsize, 0) < 0) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to send file body to socket (%s)", drweb_options); - return DEFER; - } - close(drweb_fd); - free(drweb_fbuf); - } - else { - /* open the drwebd UNIX socket */ - sock = socket(AF_UNIX, SOCK_STREAM, 0); - if (sock < 0) { - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: can't open UNIX socket"); - return DEFER; - } - server.sun_family = AF_UNIX; - Ustrcpy(server.sun_path, drweb_options); - if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to connect to socket (%s). errno=%d", drweb_options, errno); - return DEFER; - } + result = read (drweb_fd, drweb_fbuf, fsize); + if (result == -1) { + close(sock); + close(drweb_fd); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: can't read spool file %s: %s", + scanrequest, strerror(errno)); + return DEFER; + } + + /* send file body to socket */ + if (send(sock, drweb_fbuf, fsize, 0) < 0) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to send file body to socket (%s)", drweb_options); + return DEFER; + } + close(drweb_fd); + free(drweb_fbuf); + } + else { + /* open the drwebd UNIX socket */ + sock = socket(AF_UNIX, SOCK_STREAM, 0); + if (sock < 0) { + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: can't open UNIX socket"); + return DEFER; + } + server.sun_family = AF_UNIX; + Ustrcpy(server.sun_path, drweb_options); + if (connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)) < 0) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to connect to socket (%s). errno=%d", drweb_options, errno); + return DEFER; + } - /* prepare variables */ - drweb_cmd = htonl(DRWEBD_SCAN_CMD); - drweb_flags = htonl(DRWEBD_RETURN_VIRUSES | DRWEBD_IS_MAIL); - snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml", spool_directory, message_id, message_id); - drweb_slen = htonl(Ustrlen(scanrequest)); + /* prepare variables */ + drweb_cmd = htonl(DRWEBD_SCAN_CMD); + drweb_flags = htonl(DRWEBD_RETURN_VIRUSES | DRWEBD_IS_MAIL); + snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml", spool_directory, message_id, message_id); + drweb_slen = htonl(Ustrlen(scanrequest)); - /* send scan request */ - if ((send(sock, &drweb_cmd, sizeof(drweb_cmd), 0) < 0) || - (send(sock, &drweb_flags, sizeof(drweb_flags), 0) < 0) || - (send(sock, &drweb_slen, sizeof(drweb_slen), 0) < 0) || - (send(sock, scanrequest, Ustrlen(scanrequest), 0) < 0) || - (send(sock, &drweb_fin, sizeof(drweb_fin), 0) < 0)) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to send commands to socket (%s)", drweb_options); - return DEFER; - } - } + /* send scan request */ + if ((send(sock, &drweb_cmd, sizeof(drweb_cmd), 0) < 0) || + (send(sock, &drweb_flags, sizeof(drweb_flags), 0) < 0) || + (send(sock, &drweb_slen, sizeof(drweb_slen), 0) < 0) || + (send(sock, scanrequest, Ustrlen(scanrequest), 0) < 0) || + (send(sock, &drweb_fin, sizeof(drweb_fin), 0) < 0)) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to send commands to socket (%s)", drweb_options); + return DEFER; + } + } - /* wait for result */ - if ((bread = recv(sock, &drweb_rc, sizeof(drweb_rc), 0) != sizeof(drweb_rc))) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to read return code"); - return DEFER; - } - drweb_rc = ntohl(drweb_rc); + /* wait for result */ + if ((bread = recv(sock, &drweb_rc, sizeof(drweb_rc), 0) != sizeof(drweb_rc))) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to read return code"); + return DEFER; + } + drweb_rc = ntohl(drweb_rc); - if ((bread = recv(sock, &drweb_vnum, sizeof(drweb_vnum), 0) != sizeof(drweb_vnum))) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: unable to read the number of viruses"); - return DEFER; - } - drweb_vnum = ntohl(drweb_vnum); - - /* "virus(es) found" if virus number is > 0 */ - if (drweb_vnum) - { - int i; - uschar pre_malware_nb[256]; - - malware_name = malware_name_buffer; - - /* setup default virus name */ - Ustrcpy(malware_name_buffer,"unknown"); - - /* read and concatenate virus names into one string */ - for (i=0;i<drweb_vnum;i++) - { - /* read the size of report */ - if ((bread = recv(sock, &drweb_slen, sizeof(drweb_slen), 0) != sizeof(drweb_slen))) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: cannot read report size"); - return DEFER; - }; - drweb_slen = ntohl(drweb_slen); - - /* read report body */ - if ((bread = recv(sock, tmpbuf, drweb_slen, 0)) != drweb_slen) { - close(sock); - log_write(0, LOG_MAIN|LOG_PANIC, - "malware acl condition: drweb: cannot read report string"); - return DEFER; - }; - tmpbuf[drweb_slen] = '\0'; + if ((bread = recv(sock, &drweb_vnum, sizeof(drweb_vnum), 0) != sizeof(drweb_vnum))) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: unable to read the number of viruses"); + return DEFER; + } + drweb_vnum = ntohl(drweb_vnum); + + /* "virus(es) found" if virus number is > 0 */ + if (drweb_vnum) + { + int i; + uschar pre_malware_nb[256]; + + malware_name = malware_name_buffer; + + /* setup default virus name */ + Ustrcpy(malware_name_buffer,"unknown"); + + /* read and concatenate virus names into one string */ + for (i=0;i<drweb_vnum;i++) + { + /* read the size of report */ + if ((bread = recv(sock, &drweb_slen, sizeof(drweb_slen), 0) != sizeof(drweb_slen))) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: cannot read report size"); + return DEFER; + }; + drweb_slen = ntohl(drweb_slen); + + /* read report body */ + if ((bread = recv(sock, tmpbuf, drweb_slen, 0)) != drweb_slen) { + close(sock); + log_write(0, LOG_MAIN|LOG_PANIC, + "malware acl condition: drweb: cannot read report string"); + return DEFER; + }; + tmpbuf[drweb_slen] = '\0'; - /* set up match regex, depends on retcode */ - Ustrcpy(drweb_match_string, "infected\\swith\\s*(.+?)$"); + /* set up match regex, depends on retcode */ + Ustrcpy(drweb_match_string, "infected\\swith\\s*(.+?)$"); - drweb_re = pcre_compile( CS drweb_match_string, - PCRE_COPT, - (const char **)&rerror, - &roffset, - NULL ); + drweb_re = pcre_compile( CS drweb_match_string, + PCRE_COPT, + (const char **)&rerror, + &roffset, + NULL ); - /* try matcher on the line, grab substring */ - result = pcre_exec(drweb_re, NULL, CS tmpbuf, Ustrlen(tmpbuf), 0, 0, ovector, 30); - if (result >= 2) { - pcre_copy_substring(CS tmpbuf, ovector, result, 1, CS pre_malware_nb, 255); - } - /* the first name we just copy to malware_name */ - if (i==0) - Ustrcpy(CS malware_name_buffer, CS pre_malware_nb); - else { - /* concatenate each new virus name to previous */ - int slen = Ustrlen(malware_name_buffer); - if (slen < (slen+Ustrlen(pre_malware_nb))) { - Ustrcat(malware_name_buffer, "/"); - Ustrcat(malware_name_buffer, pre_malware_nb); - } - } - } - } - else { - /* no virus found */ - malware_name = NULL; - }; - close(sock); - } - /* ----------------------------------------------------------------------- */ + /* try matcher on the line, grab substring */ + result = pcre_exec(drweb_re, NULL, CS tmpbuf, Ustrlen(tmpbuf), 0, 0, ovector, 30); + if (result >= 2) { + pcre_copy_substring(CS tmpbuf, ovector, result, 1, CS pre_malware_nb, 255); + } + /* the first name we just copy to malware_name */ + if (i==0) + Ustrcpy(CS malware_name_buffer, CS pre_malware_nb); + else { + /* concatenate each new virus name to previous */ + int slen = Ustrlen(malware_name_buffer); + if (slen < (slen+Ustrlen(pre_malware_nb))) { + Ustrcat(malware_name_buffer, "/"); + Ustrcat(malware_name_buffer, pre_malware_nb); + } + } + } + } + else { + /* no virus found */ + malware_name = NULL; + }; + close(sock); + } + /* ----------------------------------------------------------------------- */ else if (strcmpic(scanner_name,US"aveserver") == 0) { uschar *kav_options; uschar kav_options_buffer[1024]; uschar kav_options_default[] = "/var/run/aveserver"; uschar buf[32768]; - uschar *p; struct sockaddr_un server; int sock; @@ -452,7 +451,10 @@ int malware(uschar **listptr) { uschar file_name[1024]; uschar av_buffer[1024]; pcre *fs_inf; - static uschar *cmdoptions[] = { "CONFIGURE\tARCHIVE\t1\n","CONFIGURE\tTIMEOUT\t0\n","CONFIGURE\tMAXARCH\t5\n","CONFIGURE\tMIME\t1\n" }; + static uschar *cmdoptions[] = { US"CONFIGURE\tARCHIVE\t1\n", + US"CONFIGURE\tTIMEOUT\t0\n", + US"CONFIGURE\tMAXARCH\t5\n", + US"CONFIGURE\tMIME\t1\n" }; malware_name = NULL; if ((fsecure_options = string_nextinlist(&av_scanner_work, &sep, @@ -947,7 +949,8 @@ int malware(uschar **listptr) { uschar clamd_options_default[] = "/tmp/clamd"; uschar *p,*vname; struct sockaddr_un server; - int sock,port,bread=0; + int sock,bread=0; + unsigned int port; uschar file_name[1024]; uschar av_buffer[1024]; uschar hostname[256]; @@ -1058,7 +1061,7 @@ int malware(uschar **listptr) { /* Check the result. ClamAV Returns infected: -> "<filename>: <virusname> FOUND" not-infected: -> "<filename>: OK" - error: -> "<filename>: <errcode> ERROR */ + error: -> "<filename>: <errcode> ERROR */ if (!(*av_buffer)) { log_write(0, LOG_MAIN|LOG_PANIC, @@ -1123,7 +1126,7 @@ int malware(uschar **listptr) { sizeof(mksd_options_buffer))) != NULL) { mksd_maxproc = (int) strtol(CS mksd_options, &mksd_options_end, 10); if ((*mksd_options == '\0') || (*mksd_options_end != '\0') || - (mksd_maxproc < 1) || (mksd_maxproc > 32)) { + (mksd_maxproc < 1) || (mksd_maxproc > 32)) { log_write(0, LOG_MAIN|LOG_PANIC, "malware acl condition: mksd: invalid option '%s'", mksd_options); return DEFER; diff --git a/src/src/mime.c b/src/src/mime.c index 1e8deec1b..26caaacb3 100644 --- a/src/src/mime.c +++ b/src/src/mime.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/mime.c,v 1.2 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/mime.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -25,8 +25,8 @@ uschar *mime_current_boundary = NULL; void mime_set_anomaly(int level, char *text) { mime_anomaly_level = level; - mime_anomaly_text = text; -}; + mime_anomaly_text = US text; +} /************************************************* @@ -240,7 +240,7 @@ uschar *mime_parse_line(uschar *buffer, uschar *encoding, int *num_decoded) { FILE *mime_get_decode_file(uschar *pname, uschar *fname) { - FILE *f; + FILE *f = NULL; uschar *filename; filename = (uschar *)malloc(2048); @@ -519,7 +519,7 @@ int mime_acl_check(FILE *f, struct mime_boundary_context *context, uschar while(1) { /* reset all per-part mime variables */ - mime_anomaly_level = NULL; + mime_anomaly_level = 0; mime_anomaly_text = NULL; mime_boundary = NULL; mime_charset = NULL; diff --git a/src/src/receive.c b/src/src/receive.c index 7b97b4b22..f69e4b673 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/receive.c,v 1.6 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/receive.c,v 1.7 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2743,7 +2743,7 @@ else { FILE *mbox_file; uschar rfc822_file_path[2048]; - unsigned long long mbox_size; + unsigned long mbox_size; header_line *my_headerlist; uschar *user_msg, *log_msg; int mime_part_count_buffer = -1; diff --git a/src/src/regex.c b/src/src/regex.c index 5c008596d..b6d0badb6 100644 --- a/src/src/regex.c +++ b/src/src/regex.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/regex.c,v 1.2 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/regex.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -32,7 +32,7 @@ int regex(uschar **listptr) { uschar *list = *listptr; uschar *regex_string; uschar regex_string_buffer[1024]; - unsigned long long mbox_size; + unsigned long mbox_size; FILE *mbox_file; pcre *re; pcre_list *re_list_head = NULL; @@ -113,7 +113,7 @@ int regex(uschar **listptr) { do { /* try matcher on the line */ if (pcre_exec(re_list_item->re, NULL, CS linebuffer, - (int)Ustrlen(linebuffer), 0, 0, NULL, 0) >= 0) { + (int)Ustrlen(linebuffer), 0, 0, NULL, 0) >= 0) { Ustrncpy(regex_match_string_buffer, re_list_item->pcre_text, 1023); regex_match_string = regex_match_string_buffer; if (mime_stream == NULL) diff --git a/src/src/spam.c b/src/src/spam.c index 406daef00..3842efdcf 100644 --- a/src/src/spam.c +++ b/src/src/spam.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spam.c,v 1.2 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/spam.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -26,7 +26,7 @@ int spam(uschar **listptr) { uschar *list = *listptr; uschar *user_name; uschar user_name_buffer[128]; - unsigned long long mbox_size; + unsigned long mbox_size; FILE *mbox_file; int spamd_sock; uschar spamd_buffer[32600]; @@ -188,7 +188,7 @@ int spam(uschar **listptr) { /* now we are connected to spamd on spamd_sock */ snprintf(CS spamd_buffer, sizeof(spamd_buffer), - "REPORT SPAMC/1.2\r\nUser: %s\r\nContent-length: %lld\r\n\r\n", + "REPORT SPAMC/1.2\r\nUser: %s\r\nContent-length: %ld\r\n\r\n", user_name, mbox_size); diff --git a/src/src/spool_mbox.c b/src/src/spool_mbox.c index c2799f585..bcad17220 100644 --- a/src/src/spool_mbox.c +++ b/src/src/spool_mbox.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/spool_mbox.c,v 1.2 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/spool_mbox.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -27,7 +27,7 @@ uschar spooled_message_id[17]; /* returns a pointer to the FILE, and puts the size in bytes into mbox_file_size */ -FILE *spool_mbox(unsigned long long *mbox_file_size) { +FILE *spool_mbox(unsigned long *mbox_file_size) { uschar mbox_path[1024]; uschar message_subdir[2]; uschar data_buffer[65535]; @@ -149,24 +149,24 @@ void unspool_mbox(void) { DIR *tempdir; snprintf(CS mbox_path, 1024, "%s/scan/%s", spool_directory, spooled_message_id); - - tempdir = opendir(CS mbox_path); - /* loop thru dir & delete entries */ - n = 0; - do { - entry = readdir(tempdir); - if (entry == NULL) break; - snprintf(CS file_path, 1024,"%s/scan/%s/%s", spool_directory, spooled_message_id, entry->d_name); - if ( (Ustrcmp(entry->d_name,"..") != 0) && (Ustrcmp(entry->d_name,".") != 0) ) { - debug_printf("unspool_mbox(): unlinking '%s'\n", file_path); + + tempdir = opendir(CS mbox_path); + /* loop thru dir & delete entries */ + n = 0; + do { + entry = readdir(tempdir); + if (entry == NULL) break; + snprintf(CS file_path, 1024,"%s/scan/%s/%s", spool_directory, spooled_message_id, entry->d_name); + if ( (Ustrcmp(entry->d_name,"..") != 0) && (Ustrcmp(entry->d_name,".") != 0) ) { + debug_printf("unspool_mbox(): unlinking '%s'\n", file_path); n = unlink(CS file_path); }; - } while (n > -1); - - closedir(tempdir); - - /* remove directory */ - n = rmdir(CS mbox_path); + } while (n > -1); + + closedir(tempdir); + + /* remove directory */ + n = rmdir(CS mbox_path); }; }; } diff --git a/src/src/srs.c b/src/src/srs.c index a1e08c36e..f92c5a574 100644 --- a/src/src/srs.c +++ b/src/src/srs.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/srs.c,v 1.2 2004/12/16 15:11:47 tom Exp $ */ +/* $Cambridge: exim/src/src/srs.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -35,7 +35,7 @@ int eximsrs_init() if(!srs) { - // Check config + /* Check config */ if(!srs_config) { log_write(0, LOG_MAIN | LOG_PANIC, @@ -43,7 +43,7 @@ int eximsrs_init() return DEFER; } - // Get config + /* Get config */ co = 0; if((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) == NULL) diff --git a/src/src/version.c b/src/src/version.c index 6391d13bf..839f5bdca 100644 --- a/src/src/version.c +++ b/src/src/version.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/version.c,v 1.2 2004/10/14 11:21:02 ph10 Exp $ */ +/* $Cambridge: exim/src/src/version.c,v 1.3 2004/12/17 14:52:44 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -12,7 +12,7 @@ #include "exim.h" -#define THIS_VERSION "4.44" +#define THIS_VERSION "4.45" /* The header file cnumber.h contains a single line containing the |