mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-10-31 05:22:26 +01:00 
			
		
		
		
	discard messages shorter than 100 bytes
This commit is contained in:
		| @@ -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_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)}, | ||||
|    { "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)}, | ||||
|    { "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}, | ||||
|   | ||||
| @@ -79,6 +79,8 @@ struct __config { | ||||
|  | ||||
|    int min_word_len; | ||||
|  | ||||
|    int min_message_size; | ||||
|  | ||||
|    int tweak_sent_time_offset; | ||||
|  | ||||
|    int enable_cjk; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
|  | ||||
| #define VERSION "1.2.0-master" | ||||
|  | ||||
| #define BUILD 937 | ||||
| #define BUILD 938 | ||||
|  | ||||
| #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); | ||||
|       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); | ||||
|                         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){ | ||||
|                         syslog(LOG_PRIORITY, "%s: found virus: %s", sdata.ttmpfile, virusinfo); | ||||
|                         counters.c_virus++; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user