(1) Get rid of compiler warnings (a) in expand.c on 64-bit systems (b) in
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Thu, 13 Jan 2005 10:09:36 +0000 (10:09 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Thu, 13 Jan 2005 10:09:36 +0000 (10:09 +0000)
malware.c where there was a %hu and an int variable in sscanf(). (2)
Remove an email address from David Saez's email address in malware.c
(best not to have emails in public code these days). (3) Added a credit
to David S to ACKNOWLEDGMENTS.

src/ACKNOWLEDGMENTS
src/src/expand.c
src/src/malware.c

index d61c06ba003db369e49a8fdb0941dc43fc310d9d..0bc76a1ab5b5a1aeda20dde047ccee3f3c309e15 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.12 2005/01/11 15:17:52 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.13 2005/01/13 10:09:36 ph10 Exp $
 
 EXIM ACKNOWLEDGEMENTS
 
@@ -189,6 +189,7 @@ Larry Rosenman            OpenUNIX config files
 Alexander Sabourenkov     Patch to add saslauthd daemon support
                           Patch for MySQL non-data queries
 David Saez                Suggested patch for $sender_hostname lookup if needed
+                          Support for the clamd virus scanner
 Peter Savitch             Diagnosis of FPE bug when statvfs() fails on spool
 Harald Schueler           Patch for dn_expand() failure on truncated data
 Heiko Schlichting         Diagnosis of intermittent daemon crash bug
index f809fe5172dfb44dd2760054c0946c87c556bf15..9506d7ae004f4fb3ed031bda292f1f91aeec6f55 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.10 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.11 2005/01/13 10:09:36 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -1379,14 +1379,14 @@ while (last > first)
       {
       int inodes;
       sprintf(CS var_buffer, "%d", 
-        receive_statvfs((BOOL)(var_table[middle].value), &inodes));  
+        receive_statvfs(var_table[middle].value == (void *)TRUE, &inodes));  
       }
     return var_buffer;
     
     case vtype_pinodes:
       {
       int inodes;
-      (void) receive_statvfs((BOOL)(var_table[middle].value), &inodes);  
+      (void) receive_statvfs(var_table[middle].value == (void *)TRUE, &inodes);  
       sprintf(CS var_buffer, "%d", inodes);
       }
     return var_buffer;
index 4abf7d1f92723d63aab7327b909237ef646732cd..9e32ed59fa2c17cb4bc9e92cfb197a810a34c933 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/malware.c,v 1.5 2005/01/11 08:55:29 tom Exp $ */
+/* $Cambridge: exim/src/src/malware.c,v 1.6 2005/01/13 10:09:36 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -391,10 +391,10 @@ int malware(uschar **listptr) {
                         * DERR_CRC_ERROR, DERR_READSOCKET, DERR_WRITE_ERR
                         * and others are ignored */
                        if (drweb_s) {
-                               log_write(0, LOG_MAIN|LOG_PANIC,
-                                       "malware acl condition: drweb: drweb daemon retcode 0x%x (%s)", drweb_rc, drweb_s);
+                               log_write(0, LOG_MAIN|LOG_PANIC,
+                                       "malware acl condition: drweb: drweb daemon retcode 0x%x (%s)", drweb_rc, drweb_s);
                                close(sock);
-                               return DEFER;
+                               return DEFER;
                        }
                        /* no virus found */
                        malware_name = NULL;
@@ -971,7 +971,7 @@ int malware(uschar **listptr) {
     
 
     /* "clamd" scanner type ------------------------------------------------- */
-    /* This code was contributed by David Saez <david@ols.es> */
+    /* This code was contributed by David Saez */
     else if (strcmpic(scanner_name,US"clamd") == 0) {
       uschar *clamd_options;
       uschar clamd_options_buffer[1024];
@@ -1086,7 +1086,7 @@ int malware(uschar **listptr) {
           }
     
           av_buffer2[bread] = '\0';
-          if( sscanf(CS av_buffer2, "PORT %hu\n", &port) != 1 ) {
+          if( sscanf(CS av_buffer2, "PORT %u\n", &port) != 1 ) {
             log_write(0, LOG_MAIN|LOG_PANIC,
                     "malware acl condition: clamd: Expected port information from clamd, got '%s'", av_buffer2);
             return DEFER;
@@ -1107,57 +1107,57 @@ int malware(uschar **listptr) {
             return DEFER;
           }
 
-         snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml",
+         snprintf(CS scanrequest, 1024,CS"%s/scan/%s/%s.eml",
            spool_directory, message_id, message_id);
   
-         /* calc file size */
-         clam_fd = open(CS scanrequest, O_RDONLY);
-         if (clam_fd == -1) {
-           log_write(0, LOG_MAIN|LOG_PANIC,
-                   "malware acl condition: clamd: can't open spool file %s: %s", 
-                   scanrequest, strerror(errno));
-           return DEFER; 
-         }
+         /* calc file size */
+         clam_fd = open(CS scanrequest, O_RDONLY);
+         if (clam_fd == -1) {
+           log_write(0, LOG_MAIN|LOG_PANIC,
+                   "malware acl condition: clamd: can't open spool file %s: %s", 
+                   scanrequest, strerror(errno));
+           return DEFER; 
+         }
          fsize = lseek(clam_fd, 0, SEEK_END);
-         if (fsize == -1) {
-           log_write(0, LOG_MAIN|LOG_PANIC,
-                   "malware acl condition: clamd: can't seek spool file %s: %s", 
-                   scanrequest, strerror(errno));
-           return DEFER; 
-         }
-         lseek(clam_fd, 0, SEEK_SET);
+         if (fsize == -1) {
+           log_write(0, LOG_MAIN|LOG_PANIC,
+                   "malware acl condition: clamd: can't seek spool file %s: %s", 
+                   scanrequest, strerror(errno));
+           return DEFER; 
+         }
+         lseek(clam_fd, 0, SEEK_SET);
   
-         clamav_fbuf = (uschar *) malloc (fsize);
+         clamav_fbuf = (uschar *) malloc (fsize);
          if (!clamav_fbuf) {
            close(sockData);
-           close(clam_fd);
-           log_write(0, LOG_MAIN|LOG_PANIC,
+           close(clam_fd);
+           log_write(0, LOG_MAIN|LOG_PANIC,
                    "malware acl condition: clamd: unable to allocate memory %u for file (%s)", 
-                   fsize, scanrequest);
-           return DEFER;
-         }
+                   fsize, scanrequest);
+           return DEFER;
+         }
   
-         result = read (clam_fd, clamav_fbuf, fsize);
-         if (result == -1) {
-           close(sockData);
-           close(clam_fd);
-           free(clamav_fbuf);
-           log_write(0, LOG_MAIN|LOG_PANIC,
-                   "malware acl condition: clamd: can't read spool file %s: %s",
-                   scanrequest, strerror(errno));
-           return DEFER; 
-         }
-         close(clam_fd);
+         result = read (clam_fd, clamav_fbuf, fsize);
+         if (result == -1) {
+           close(sockData);
+           close(clam_fd);
+           free(clamav_fbuf);
+           log_write(0, LOG_MAIN|LOG_PANIC,
+                   "malware acl condition: clamd: can't read spool file %s: %s",
+                   scanrequest, strerror(errno));
+           return DEFER; 
+         }
+         close(clam_fd);
 
-         /* send file body to socket */
-         if (send(sockData, clamav_fbuf, fsize, 0) < 0) {
-           close(sockData);
-           free(clamav_fbuf);
-           log_write(0, LOG_MAIN|LOG_PANIC,
-             "malware acl condition: clamd: unable to send file body to socket (%s:%u)", hostname, port);
-           return DEFER;
-         }
-         free(clamav_fbuf);
+         /* send file body to socket */
+         if (send(sockData, clamav_fbuf, fsize, 0) < 0) {
+           close(sockData);
+           free(clamav_fbuf);
+           log_write(0, LOG_MAIN|LOG_PANIC,
+             "malware acl condition: clamd: unable to send file body to socket (%s:%u)", hostname, port);
+           return DEFER;
+         }
+         free(clamav_fbuf);
           close(sockData);
         }
       }