[exim-cvs] cvs commit: exim/exim-src/src globals.c globals.h…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Tom Kistner
Date:  
À: exim-cvs
Sujet: [exim-cvs] cvs commit: exim/exim-src/src globals.c globals.h malware.c mime.c mime.h regex.c spam.c spam.h spool_mbox.c
tom 2004/11/26 16:04:27 GMT

  Modified files:        (Branch: EXISCAN)
    exim-src/src         globals.c globals.h malware.c mime.c 
                         mime.h regex.c spam.c spam.h spool_mbox.c 
  Log:
  Weekend W.I.P. checkin


  Revision  Changes    Path
  1.6.2.2   +48 -0     exim/exim-src/src/globals.c
  1.6.2.1   +48 -0     exim/exim-src/src/globals.h
  1.1.2.2   +3 -3      exim/exim-src/src/malware.c
  1.1.2.2   +2 -3      exim/exim-src/src/mime.c
  1.1.2.2   +3 -2      exim/exim-src/src/mime.h
  1.1.2.2   +2 -2      exim/exim-src/src/regex.c
  1.1.2.2   +3 -2      exim/exim-src/src/spam.c
  1.1.2.2   +2 -4      exim/exim-src/src/spam.h
  1.1.2.2   +5 -33     exim/exim-src/src/spool_mbox.c


  Index: globals.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/globals.c,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- globals.c    25 Nov 2004 15:33:55 -0000    1.6.2.1
  +++ globals.c    26 Nov 2004 16:04:26 -0000    1.6.2.2
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/globals.c,v 1.6.2.1 2004/11/25 15:33:55 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/globals.c,v 1.6.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -164,6 +164,9 @@
   uschar *acl_smtp_helo          = NULL;
   uschar *acl_smtp_mail          = NULL;
   uschar *acl_smtp_mailauth      = NULL;
  +#ifdef WITH_CONTENT_SCAN
  +uschar *acl_smtp_mime          = NULL;
  +#endif
   uschar *acl_smtp_predata       = NULL;
   uschar *acl_smtp_quit          = NULL;
   uschar *acl_smtp_rcpt          = NULL;
  @@ -315,6 +318,9 @@
   uschar *auth_defer_msg         = US"reason not recorded";
   uschar *auth_defer_user_msg    = US"";
   int     auto_thaw              = 0;
  +#ifdef WITH_CONTENT_SCAN
  +uschar *av_scanner             = US"sophie:/var/run/sophie";  /* AV scanner */
  +#endif


   BOOL    background_daemon      = TRUE;
   uschar *base62_chars=
  @@ -479,6 +485,9 @@
   BOOL    extract_addresses_remove_arguments = TRUE;
   uschar *extra_local_interfaces = NULL;


  +#ifdef WITH_CONTENT_SCAN
  +BOOL    fake_reject            = FALSE;
  +#endif
   int     filter_n[FILTER_VARIABLE_COUNT];
   BOOL    filter_running         = FALSE;
   int     filter_sn[FILTER_VARIABLE_COUNT];
  @@ -639,6 +648,9 @@


   macro_item  *macros            = NULL;
   uschar *mailstore_basename     = NULL;
  +#ifdef WITH_CONTENT_SCAN
  +uschar *malware_name           = NULL;  /* Virus Name */
  +#endif
   int     max_username_length    = 0;
   int     message_age            = 0;
   uschar *message_body           = NULL;
  @@ -659,9 +671,33 @@
   uschar *message_size_limit     = US"50M";
   uschar  message_subdir[2]      = { 0, 0 };
   uschar *message_reference      = NULL;
  +
  +/* MIME ACL expandables */
  +#ifdef WITH_CONTENT_SCAN
  +uschar *mime_anomaly_level     = NULL;
  +uschar *mime_anomaly_text      = NULL;
  +uschar *mime_boundary          = NULL;
  +uschar *mime_charset           = NULL;
  +uschar *mime_content_description = NULL;
  +uschar *mime_content_disposition = NULL;
  +uschar *mime_content_id        = NULL;
  +unsigned int mime_content_size = 0;
  +uschar *mime_content_transfer_encoding = NULL;
  +uschar *mime_content_type      = NULL;
  +uschar *mime_decoded_filename  = NULL;
  +uschar *mime_filename          = NULL;
  +int     mime_is_multipart      = 0;
  +int     mime_is_coverletter    = 0;
  +int     mime_is_rfc822         = 0;
  +int     mime_part_count        = -1;
  +#endif
  +
   BOOL    mua_wrapper            = FALSE;


   uid_t  *never_users            = NULL;
  +#ifdef WITH_CONTENT_SCAN
  +BOOL    no_mbox_unspool        = FALSE;
  +#endif
   BOOL    no_multiline_responses = FALSE;


   uid_t   original_euid;
  @@ -762,6 +798,9 @@
   const pcre *regex_PIPELINING   = NULL;
   const pcre *regex_SIZE         = NULL;
   const pcre *regex_ismsgid      = NULL;
  +#ifdef WITH_CONTENT_SCAN
  +uschar *regex_match_string     = NULL;
  +#endif
   int     remote_delivery_count  = 0;
   int     remote_max_parallel    = 2;
   uschar *remote_sort_domains    = NULL;
  @@ -942,6 +981,15 @@
   int     smtp_rlr_threshold     = INT_MAX;
   BOOL    smtp_use_pipelining    = FALSE;
   BOOL    smtp_use_size          = FALSE;
  +
  +#ifdef WITH_CONTENT_SCAN
  +uschar *spamd_address          = US"127.0.0.1 783";
  +uschar *spam_bar               = NULL;
  +uschar *spam_report            = NULL;
  +uschar *spam_score             = NULL;
  +uschar *spam_score_int         = NULL;
  +#endif
  +
   BOOL    split_spool_directory  = FALSE;
   uschar *spool_directory        = US SPOOL_DIRECTORY
                              "\0<--------------Space to patch spool_directory->";


  Index: globals.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/globals.h,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- globals.h    10 Nov 2004 10:29:56 -0000    1.6
  +++ globals.h    26 Nov 2004 16:04:26 -0000    1.6.2.1
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/globals.h,v 1.6 2004/11/10 10:29:56 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/globals.h,v 1.6.2.1 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -106,6 +106,9 @@
   extern uschar *acl_smtp_helo;          /* ACL run for HELO/EHLO */
   extern uschar *acl_smtp_mail;          /* ACL run for MAIL */
   extern uschar *acl_smtp_mailauth;      /* ACL run for MAIL AUTH */
  +#ifdef WITH_CONTENT_SCAN
  +extern uschar *acl_smtp_mime;          /* ACL run after DATA, before acl_smtp_data, for each MIME part */
  +#endif
   extern uschar *acl_smtp_predata;       /* ACL run for DATA command */
   extern uschar *acl_smtp_quit;          /* ACL run for QUIT */
   extern uschar *acl_smtp_rcpt;          /* ACL run for RCPT */
  @@ -144,6 +147,9 @@
   extern uschar *auth_defer_msg;         /* Error message for log */
   extern uschar *auth_defer_user_msg;    /* Error message for user */
   extern int     auto_thaw;              /* Auto-thaw interval */
  +#ifdef WITH_CONTENT_SCAN
  +extern uschar *av_scanner;             /* AntiVirus scanner to use for the malware condition */
  +#endif


   extern BOOL    background_daemon;      /* Set FALSE to keep in foreground */
   extern uschar *base62_chars;           /* Table of base-62 characters */
  @@ -272,6 +278,9 @@
   extern BOOL    extract_addresses_remove_arguments; /* Controls -t behaviour */
   extern uschar *extra_local_interfaces; /* Local, non-listen interfaces */


  +#ifdef WITH_CONTENT_SCAN
  +extern BOOL    fake_reject;            /* TRUE if fake reject is to be given */
  +#endif
   extern int     filter_n[FILTER_VARIABLE_COUNT]; /* filter variables */
   extern BOOL    filter_running;         /* TRUE while running a filter */
   extern int     filter_sn[FILTER_VARIABLE_COUNT]; /* variables set by system filter */
  @@ -358,6 +367,9 @@


   extern macro_item *macros;             /* Configuration macros */
   extern uschar *mailstore_basename;     /* For mailstore deliveries */
  +#ifdef WITH_CONTENT_SCAN
  +extern uschar *malware_name;           /* Name of virus or malware ("W32/Klez-H") */
  +#endif
   extern int     max_username_length;    /* For systems with broken getpwnam() */
   extern int     message_age;            /* In seconds */
   extern uschar *message_body;           /* Start of message body for filter */
  @@ -377,9 +389,33 @@
   extern uschar *message_size_limit;     /* As it says */
   extern uschar  message_subdir[];       /* Subdirectory for messages */
   extern uschar *message_reference;      /* Reference for error messages */
  +
  +/* MIME ACL expandables */
  +#ifdef WITH_CONTENT_SCAN
  +extern uschar *mime_anomaly_level;
  +extern uschar *mime_anomaly_text;
  +extern uschar *mime_boundary;
  +extern uschar *mime_charset;
  +extern uschar *mime_content_description;
  +extern uschar *mime_content_disposition;
  +extern uschar *mime_content_id;
  +extern unsigned int mime_content_size;
  +extern uschar *mime_content_transfer_encoding;
  +extern uschar *mime_content_type;
  +extern uschar *mime_decoded_filename;
  +extern uschar *mime_filename;
  +extern int     mime_is_multipart;
  +extern int     mime_is_coverletter;
  +extern int     mime_is_rfc822;
  +extern int     mime_part_count;
  +#endif
  +
   extern BOOL    mua_wrapper;            /* TRUE when Exim is wrapping an MUA */


   extern uid_t  *never_users;            /* List of uids never to be used */
  +#ifdef WITH_CONTENT_SCAN
  +extern BOOL    no_mbox_unspool;        /* don't unlink files in /scan directory */
  +#endif
   extern BOOL    no_multiline_responses; /* For broken clients */


   extern optionlist optionlist_auths[];      /* These option lists are made */
  @@ -465,6 +501,9 @@
   extern const pcre  *regex_PIPELINING;  /* For recognizing PIPELINING */
   extern const pcre  *regex_SIZE;        /* For recognizing SIZE settings */
   extern const pcre  *regex_ismsgid;     /* Compiled r.e. for message it */
  +#ifdef WITH_CONTENT_SCAN
  +extern uschar *regex_match_string;     /* regex that matched a line (regex ACL condition) */
  +#endif
   extern int     remote_delivery_count;  /* Number of remote addresses */
   extern int     remote_max_parallel;    /* Maximum parallel delivery */
   extern uschar *remote_sort_domains;    /* Remote domain sorting order */
  @@ -556,6 +595,15 @@
   extern int     smtp_rlr_threshold;     /* Threshold for RCPT rate limit */
   extern BOOL    smtp_use_pipelining;    /* Global for passed connections */
   extern BOOL    smtp_use_size;          /* Global for passed connections */
  +
  +#ifdef WITH_CONTENT_SCAN
  +extern uschar *spamd_address;          /* address for the spamassassin daemon */
  +extern uschar *spam_bar;               /* the spam "bar" (textual representation of spam_score) */
  +extern uschar *spam_report;            /* the spamd report (multiline) */
  +extern uschar *spam_score;             /* the spam score (float) */
  +extern uschar *spam_score_int;         /* spam_score * 10 (int) */
  +#endif
  +
   extern BOOL    split_spool_directory;  /* TRUE to use multiple subdirs */
   extern uschar *spool_directory;        /* Name of spool directory */
   extern int     string_datestamp_offset;/* After insertion by string_format */


  Index: malware.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/malware.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- malware.c    26 Nov 2004 09:13:34 -0000    1.1.2.1
  +++ malware.c    26 Nov 2004 16:04:26 -0000    1.1.2.2
  @@ -1,11 +1,10 @@
  -/* $Cambridge: exim/exim-src/src/malware.c,v 1.1.2.1 2004/11/26 09:13:34 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/malware.c,v 1.1.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
   *************************************************/


-/* This file is part of the exiscan-acl content scanner
-patch. It is NOT part of the standard exim distribution. */
+#ifdef WITH_CONTENT_SCAN

/* Copyright (c) Tom Kistner <tom@???> 2003-???? */
/* License: GPL */
@@ -18,7 +17,7 @@
int mksd_scan_packed(int sock);
int mksd_scan_unpacked(int sock, int maxproc);

  -/* SHUT_WR seems to be undefined on Unixware ? */
  +/* SHUT_WR seems to be undefined on Unixware? */
   #ifndef SHUT_WR
   #define SHUT_WR 1
   #endif
  @@ -1415,3 +1414,4 @@
     return OK;
   }


+#endif

  Index: mime.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/mime.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- mime.c    26 Nov 2004 09:13:34 -0000    1.1.2.1
  +++ mime.c    26 Nov 2004 16:04:26 -0000    1.1.2.2
  @@ -1,11 +1,10 @@
  -/* $Cambridge: exim/exim-src/src/mime.c,v 1.1.2.1 2004/11/26 09:13:34 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/mime.c,v 1.1.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
   *************************************************/


-/* This file is part of the exiscan-acl content scanner
-patch. It is NOT part of the standard exim distribution. */
+#ifdef WITH_CONTENT_SCAN

   /* Copyright (c) Tom Kistner <tom@???> 2004 */
   /* License: GPL */
  @@ -711,4 +710,4 @@
     return rc;
   }


-
+#endif

  Index: mime.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/mime.h,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- mime.h    26 Nov 2004 09:13:34 -0000    1.1.2.1
  +++ mime.h    26 Nov 2004 16:04:26 -0000    1.1.2.2
  @@ -1,11 +1,10 @@
  -/* $Cambridge: exim/exim-src/src/mime.h,v 1.1.2.1 2004/11/26 09:13:34 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/mime.h,v 1.1.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
   *************************************************/


-/* This file is part of the exiscan-acl content scanner
-patch. It is NOT part of the standard exim distribution. */
+#ifdef WITH_CONTENT_SCAN

/* Copyright (c) Tom Kistner <tom@???> 2004 */
/* License: GPL */
@@ -77,3 +76,5 @@
/* 224 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
/* 240 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128
};
+
+#endif

  Index: regex.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/regex.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- regex.c    26 Nov 2004 09:24:05 -0000    1.1.2.1
  +++ regex.c    26 Nov 2004 16:04:26 -0000    1.1.2.2
  @@ -1,11 +1,10 @@
  -/* $Cambridge: exim/exim-src/src/regex.c,v 1.1.2.1 2004/11/26 09:24:05 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/regex.c,v 1.1.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
   *************************************************/


-/* This file is part of the exiscan-acl content scanner
-patch. It is NOT part of the standard exim distribution. */
+#ifdef WITH_CONTENT_SCAN

   /* Copyright (c) Tom Kistner <tom@???> 2003-???? */
   /* License: GPL */
  @@ -246,3 +245,4 @@
     return FAIL;
   }


+#endif

  Index: spam.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/spam.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- spam.c    26 Nov 2004 09:13:34 -0000    1.1.2.1
  +++ spam.c    26 Nov 2004 16:04:26 -0000    1.1.2.2
  @@ -1,11 +1,10 @@
  -/* $Cambridge: exim/exim-src/src/spam.c,v 1.1.2.1 2004/11/26 09:13:34 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/spam.c,v 1.1.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
   *************************************************/


-/* This file is part of the exiscan-acl content scanner
-patch. It is NOT part of the standard exim distribution. */
+#ifdef WITH_CONTENT_SCAN

   /* Copyright (c) Tom Kistner <tom@???> 2003-???? */
   /* License: GPL */
  @@ -338,3 +337,5 @@
       return spam_rc;
     };
   }
  +
  +#endif


  Index: spam.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/spam.h,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- spam.h    26 Nov 2004 09:13:34 -0000    1.1.2.1
  +++ spam.h    26 Nov 2004 16:04:26 -0000    1.1.2.2
  @@ -1,11 +1,10 @@
  -/* $Cambridge: exim/exim-src/src/spam.h,v 1.1.2.1 2004/11/26 09:13:34 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/spam.h,v 1.1.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
   *************************************************/


-/* This file is part of the exiscan-acl content scanner
-patch. It is NOT part of the standard exim distribution. */
+#ifdef WITH_CONTENT_SCAN

   /* Copyright (c) Tom Kistner <tom@???> 2003-???? */
   /* License: GPL */
  @@ -28,5 +27,4 @@
     unsigned int tcp_port;
   } spamd_address_container;


-
-
+#endif

  Index: spool_mbox.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/Attic/spool_mbox.c,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- spool_mbox.c    26 Nov 2004 09:13:34 -0000    1.1.2.1
  +++ spool_mbox.c    26 Nov 2004 16:04:26 -0000    1.1.2.2
  @@ -1,11 +1,10 @@
  -/* $Cambridge: exim/exim-src/src/spool_mbox.c,v 1.1.2.1 2004/11/26 09:13:34 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/spool_mbox.c,v 1.1.2.2 2004/11/26 16:04:26 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
   *************************************************/


-/* This file is part of the exiscan-acl content scanner
-patch. It is NOT part of the standard exim distribution. */
+#ifdef WITH_CONTENT_SCAN

/* Copyright (c) Tom Kistner <tom@???> 2003-???? */
/* License: GPL */
@@ -17,9 +16,10 @@

/* externals, we must reset them on unspooling */
extern int demime_ok;
+extern struct file_extension *file_extensions;
+
extern int malware_ok;
extern int spam_ok;
-extern struct file_extension *file_extensions;

   int spool_mbox_ok = 0;
   uschar spooled_message_id[17];
  @@ -36,11 +36,6 @@
     struct stat statbuf;
     int i,j;


  -  /*
  -  uschar *received;
  -  uschar *timestamp;
  -  */
  -  
     if (!spool_mbox_ok) {
       /* create scan directory, if not present */
       if (!directory_make(spool_directory, US "scan", 0750, FALSE)) {
  @@ -64,31 +59,6 @@
         return NULL;
       };


  -    /* Generate a preliminary Received: header and put it in the file.
  -       We need to do this so SA can do DNS list checks */
  -       
  -    /* removed for 4.34
  -    
  -    timestamp = expand_string(US"${tod_full}");
  -    received = expand_string(received_header_text);
  -    if (received != NULL) {
  -      uschar *my_received;
  -      if (received[0] == 0) {
  -        my_received = string_sprintf("Received: ; %s\n", timestamp);
  -      }
  -      else {
  -        my_received = string_sprintf("%s; %s\n", received, timestamp);
  -      }
  -      i = fwrite(my_received, 1, Ustrlen(my_received), mbox_file);
  -      if (i != Ustrlen(my_received)) {
  -        debug_printf("error/short write on writing in: %s", mbox_path);
  -        fclose(mbox_file);
  -        return NULL;
  -      };
  -    };
  -    
  -    */
  -    
       /* write all header lines to mbox file */
       my_headerlist = header_list;
       while (my_headerlist != NULL) {
  @@ -196,3 +166,5 @@
       };
     };
   }
  +
  +#endif