mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-10-31 02:12:27 +01:00 
			
		
		
		
	discard messages shorter than 100 bytes
This commit is contained in:
		| @@ -74,6 +74,9 @@ workdir=/var/piler/tmp | |||||||
| ; whether to enable writing folder_message table (1) or not (0) | ; whether to enable writing folder_message table (1) or not (0) | ||||||
| enable_folders=0 | enable_folders=0 | ||||||
|  |  | ||||||
|  | ; discard a message if it's shorter than this value (in bytes) | ||||||
|  | min_message_size=100 | ||||||
|  |  | ||||||
| ; | ; | ||||||
| ; starttls stuff | ; starttls stuff | ||||||
| ; | ; | ||||||
|   | |||||||
| @@ -83,6 +83,7 @@ struct _parse_rule config_parse_rules[] = | |||||||
|    { "memcached_servers", "string", (void*) string_parser, offsetof(struct __config, memcached_servers), "127.0.0.1", MAXVAL-1}, |    { "memcached_servers", "string", (void*) string_parser, offsetof(struct __config, memcached_servers), "127.0.0.1", MAXVAL-1}, | ||||||
|    { "memcached_to_db_interval", "integer", (void*) int_parser, offsetof(struct __config, memcached_to_db_interval), "900", sizeof(int)}, |    { "memcached_to_db_interval", "integer", (void*) int_parser, offsetof(struct __config, memcached_to_db_interval), "900", sizeof(int)}, | ||||||
|    { "memcached_ttl", "integer", (void*) int_parser, offsetof(struct __config, memcached_ttl), "86400", sizeof(int)}, |    { "memcached_ttl", "integer", (void*) int_parser, offsetof(struct __config, memcached_ttl), "86400", sizeof(int)}, | ||||||
|  |    { "min_message_size", "integer", (void*) int_parser, offsetof(struct __config, min_message_size), "100", sizeof(int)}, | ||||||
|    { "min_word_len", "integer", (void*) int_parser, offsetof(struct __config, min_word_len), "1", sizeof(int)}, |    { "min_word_len", "integer", (void*) int_parser, offsetof(struct __config, min_word_len), "1", sizeof(int)}, | ||||||
|    { "mmap_dedup_test", "integer", (void*) int_parser, offsetof(struct __config, mmap_dedup_test), "0", sizeof(int)}, |    { "mmap_dedup_test", "integer", (void*) int_parser, offsetof(struct __config, mmap_dedup_test), "0", sizeof(int)}, | ||||||
|    { "mysqlhost", "string", (void*) string_parser, offsetof(struct __config, mysqlhost), "", MAXVAL-1}, |    { "mysqlhost", "string", (void*) string_parser, offsetof(struct __config, mysqlhost), "", MAXVAL-1}, | ||||||
|   | |||||||
| @@ -79,6 +79,8 @@ struct __config { | |||||||
|  |  | ||||||
|    int min_word_len; |    int min_word_len; | ||||||
|  |  | ||||||
|  |    int min_message_size; | ||||||
|  |  | ||||||
|    int tweak_sent_time_offset; |    int tweak_sent_time_offset; | ||||||
|  |  | ||||||
|    int enable_cjk; |    int enable_cjk; | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ | |||||||
|  |  | ||||||
| #define VERSION "1.2.0-master" | #define VERSION "1.2.0-master" | ||||||
|  |  | ||||||
| #define BUILD 937 | #define BUILD 938 | ||||||
|  |  | ||||||
| #define HOSTID "mailarchiver" | #define HOSTID "mailarchiver" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -63,7 +63,7 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da | |||||||
|    } |    } | ||||||
|  |  | ||||||
|  |  | ||||||
|    if(sdata->tot_len < 30){ |    if(sdata->tot_len < cfg->min_message_size){ | ||||||
|       printf("%s is too short: %d bytes\n", sdata->filename, sdata->tot_len); |       printf("%s is too short: %d bytes\n", sdata->filename, sdata->tot_len); | ||||||
|       return rc; |       return rc; | ||||||
|    } |    } | ||||||
|   | |||||||
| @@ -209,6 +209,10 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){ | |||||||
|                         syslog(LOG_PRIORITY, "%s: discarding: restored copy", sdata.ttmpfile); |                         syslog(LOG_PRIORITY, "%s: discarding: restored copy", sdata.ttmpfile); | ||||||
|                         inj = OK; |                         inj = OK; | ||||||
|                      } |                      } | ||||||
|  |                      else if(sdata.tot_len < cfg->min_message_size){ | ||||||
|  |                         syslog(LOG_PRIORITY, "%s: discarding: too short message (%d bytes)", sdata.ttmpfile, sdata.tot_len); | ||||||
|  |                         inj = OK; | ||||||
|  |                      } | ||||||
|                      else if(AVIR_VIRUS == sdata.rav){ |                      else if(AVIR_VIRUS == sdata.rav){ | ||||||
|                         syslog(LOG_PRIORITY, "%s: found virus: %s", sdata.ttmpfile, virusinfo); |                         syslog(LOG_PRIORITY, "%s: found virus: %s", sdata.ttmpfile, virusinfo); | ||||||
|                         counters.c_virus++; |                         counters.c_virus++; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user