1. Tidies to get rid of compiler warnings from the merged Exiscan files.
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Fri, 17 Dec 2004 14:52:43 +0000 (14:52 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Fri, 17 Dec 2004 14:52:43 +0000 (14:52 +0000)
2. Fixed a very old bug that sometimes lost the final 221 message after
QUIT.

17 files changed:
doc/doc-misc/WishList
doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
src/src/EDITME
src/src/acl.c
src/src/functions.h
src/src/globals.c
src/src/header.c
src/src/macros.h
src/src/malware.c
src/src/mime.c
src/src/receive.c
src/src/regex.c
src/src/spam.c
src/src/spool_mbox.c
src/src/srs.c
src/src/version.c

index 391bde97877d0538a8a5f6fca36f88ae7d2d727f..1704cdbb32283957387a0d50de49c340a8f26c46 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-misc/WishList,v 1.14 2004/12/07 14:23:56 ph10 Exp $
+$Cambridge: exim/doc/doc-misc/WishList,v 1.15 2004/12/17 14:52:43 ph10 Exp $
 
 EXIM 4 WISH LIST
 ----------------
@@ -880,6 +880,11 @@ cleanly.
 
 22-Apr-04: Implemented for domains, addresses, and local parts. Hosts are
 too messy!
+
+The only sensible approach seems to be to allow IP address arguments only.
+Anything else should be diagnosed as an error. However, if a name appears in
+the list, a PTR lookup should be done. This may require a lot of refactoring
+in the code.
 ------------------------------------------------------------------------------
 
 (74)  22-Jul-02 M  Extend -bV to do more semantic checking
@@ -1826,5 +1831,12 @@ instead of 550, and also vary the defer code. The first digit, however, should
 remain fixed. In addition to main codes, enhanced status codes (RFC 2034) were
 requested. (As far as I can tell, they have never been highly popular.)
 ------------------------------------------------------------------------------
---- HWM 311 ------------------------------------------------------------------
+
+(312) 10-Dec-04 ? Shadow remote transports
+
+Unless a lot of work is done, this would be restricted to another remote
+transport. A similar effect could therefore be achieved with "shadow_hosts"
+which are like fallback_hosts but which operate on success.
+------------------------------------------------------------------------------
+--- HWM 312 ------------------------------------------------------------------
 ---------------------------- End of WishList ---------------------------------
index c35a96f6568bc4b18108828045fb0b32863a3138..110a02f7de8ec9f97b72531b9dc80640eb7c4860 100644 (file)
@@ -1,10 +1,9 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.42 2004/11/25 15:29:36 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.43 2004/12/17 14:52:44 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
-
-Exim version 4.44
+Exim version 4.50
 -----------------
 
  1. Minor wording change to the doc/README.SIEVE file.
@@ -180,6 +179,14 @@ Exim version 4.44
 
 43. Did the same fix as 41 above for OpenSSL, which had the same infelicity.
 
+44. The "Exiscan patch" is now merged into the mainline Exim source.
+
+45. Sometimes the final signoff response after QUIT could fail to get
+    transmitted in the non-TLS case. Testing !tls_active instead of tls_active
+    < 0 before doing a fflush(). This bug looks as though it goes back to the
+    introduction of TLS in release 3.20, but "sometimes" must have been rare
+    because the tests only now provoked it.
+
 
 Exim version 4.43
 -----------------
index b4fda862d9e9886bbb700cc480f302ead5f5ac4c..16c9c465374ec3878ffa6d3197a9c31c7e140de6 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.19 2004/11/25 14:31:28 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.20 2004/12/17 14:52:44 ph10 Exp $
 
 New Features in Exim
 --------------------
@@ -9,7 +9,7 @@ updated when there is a relatively large batch of changes). The doc/ChangeLog
 file contains a listing of all changes, including bug fixes.
 
 
-Version 4.44
+Version 4.50
 ------------
 
  1. There is a new build-time option called CONFIGURE_GROUP which works like
@@ -219,6 +219,9 @@ Version 4.44
     This is helpful when the system filter adds header lines or sets filter
     variables that are used by the user filter.
 
+19. The Exiscan patch is now merged into the main source. See src/EDITME for
+    parameters for the build.
+
 
 Version 4.43
 ------------
index aefed22ce598c241ab33149d81c68436c0448d6e..b70c3272bab2272b131d84f421e6ec4b7b5839b0 100644 (file)
@@ -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
 
 
 
index 247ffbb62ebe13a7783d2571c9e858d445a6cb8d..128bde552963e499adf4efbc61249bd58631f71a 100644 (file)
@@ -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)|
index af84860ee207fc4c7e89257daca2f272b75c8bc1..de5f534f0b8ea2a56946f7ecc100f2c829805daa 100644 (file)
@@ -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 *);
index be70d489d04db899a4d45f971011d847256617dd..f94678fee709785f035c197f7ecc52a68954fae3 100644 (file)
@@ -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;
index a9d8e599c1e7066541cd6619e3b135cb04133ce1..55343206d17a18c8e5d5580be3384b84716a285f 100644 (file)
@@ -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;
index da96396f88fb69d7e60ba58113c97b591ebba9ed..8c76c89b83816194d91a04f7fab03f62fe2658c4 100644 (file)
@@ -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
index 9164801976fe5bf690bcc0c9f394534d4ceadd4f..82111557c9b39687516953989a097bfa87b9f585 100644 (file)
@@ -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;
index 1e8deec1bc00afef491b8892d487e6ccc51fe735..26caaacb3359c9133362feeecb01ee4e06983522 100644 (file)
@@ -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;
index 7b97b4b22ea7dbc3639c89a5940642d527d69913..f69e4b673c8a43b20552b20dbc064bf4cf88d4f7 100644 (file)
@@ -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;
index 5c008596d5be90519acd869d72997958ddceecba..b6d0badb6780981004d9296d15198c82cec4b14b 100644 (file)
@@ -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)
index 406daef000033bd5c5bd1682b5d1391e97777b82..3842efdcf12e68f8e9dc281ad3418c529ab3c12b 100644 (file)
@@ -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);
 
index c2799f5858f7bac497da76bdcc0f60bc0d2db9a4..bcad172206d35f73b8ba0e1121837cb56e02c1d7 100644 (file)
@@ -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);
     };
   };
 }
index a1e08c36e710a88a5be0f4af307e833089b6945c..f92c5a574588f81cf4838dc24f4120e3b69121e1 100644 (file)
@@ -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)
index 6391d13bf827b68a19c993fe2dd7461f051ec21b..839f5bdcaac2aae180b46c511bd85ebaaeaa3a52 100644 (file)
@@ -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