diff --git a/etc/example.conf b/etc/example.conf index 8d24b7b..190cfed 100644 --- a/etc/example.conf +++ b/etc/example.conf @@ -74,6 +74,9 @@ ; whether to enable writing folder_message table (1) or not (0) enable_folders=0 +; discard a message if it's shorter than this value (in bytes) +min_message_size=100 + ; ; starttls stuff ; diff --git a/src/cfg.c b/src/cfg.c index 7b70d45..a738013 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -83,6 +83,7 @@ { "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}, diff --git a/src/cfg.h b/src/cfg.h index 978254d..47d74a2 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -79,6 +79,8 @@ int min_word_len; + int min_message_size; + int tweak_sent_time_offset; int enable_cjk; diff --git a/src/config.h b/src/config.h index 6cc3c6e..2dbc94d 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "1.2.0-master" -#define BUILD 937 +#define BUILD 938 #define HOSTID "mailarchiver" diff --git a/src/import.c b/src/import.c index 621dd2f..6069496 100644 --- a/src/import.c +++ b/src/import.c @@ -63,7 +63,7 @@ } - 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; } diff --git a/src/session.c b/src/session.c index c39bf0b..4e27f74 100644 --- a/src/session.c +++ b/src/session.c @@ -209,6 +209,10 @@ 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++;