add a global extractor enable/disable option to piler.conf

This commit is contained in:
SJ
2015-02-14 19:47:40 +01:00
parent abf656d102
commit c01f0afc18
13 changed files with 20 additions and 109 deletions

View File

@ -289,8 +289,9 @@ int retrieve_email_from_archive(struct session_data *sdata, struct __data *data,
int i, attachments;
char *buffer=NULL, *saved_buffer, *p, filename[SMALLBUFSIZE], pointer[SMALLBUFSIZE];
struct ptr_array ptr_arr[MAX_ATTACHMENTS];
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
struct stat st;
#endif
if(strlen(sdata->ttmpfile) != RND_STR_LEN){
printf("invalid piler-id: %s\n", sdata->ttmpfile);

View File

@ -71,6 +71,7 @@ struct _parse_rule config_parse_rules[] =
{ "enable_cjk", "integer", (void*) int_parser, offsetof(struct __config, enable_cjk), "0", sizeof(int)},
{ "encrypt_messages", "integer", (void*) int_parser, offsetof(struct __config, encrypt_messages), "1", sizeof(int)},
{ "extra_to_field", "string", (void*) string_parser, offsetof(struct __config, extra_to_field), "", MAXVAL-1},
{ "extract_attachments", "integer", (void*) int_parser, offsetof(struct __config, extract_attachments), "1", sizeof(int)},
{ "helper_timeout", "integer", (void*) int_parser, offsetof(struct __config, helper_timeout), "20", sizeof(int)},
{ "hostid", "string", (void*) string_parser, offsetof(struct __config, hostid), HOSTID, MAXVAL-1},
{ "iv", "string", (void*) string_parser, offsetof(struct __config, iv), "", MAXVAL-1},
@ -99,7 +100,6 @@ struct _parse_rule config_parse_rules[] =
{ "pilergetd_pidfile", "string", (void*) string_parser, offsetof(struct __config, pilergetd_pidfile), PILERGETD_PIDFILE, MAXVAL-1},
{ "queuedir", "string", (void*) string_parser, offsetof(struct __config, queuedir), QUEUE_DIR, MAXVAL-1},
{ "server_id", "integer", (void*) int_parser, offsetof(struct __config, server_id), "0", sizeof(int)},
{ "session_timeout", "integer", (void*) int_parser, offsetof(struct __config, session_timeout), "420", sizeof(int)},
{ "spam_header_line", "string", (void*) string_parser, offsetof(struct __config, spam_header_line), "", MAXVAL-1},
{ "syslog_recipients", "integer", (void*) int_parser, offsetof(struct __config, syslog_recipients), "0", sizeof(int)},
{ "tls_enable", "integer", (void*) int_parser, offsetof(struct __config, tls_enable), "0", sizeof(int)},

View File

@ -51,8 +51,8 @@ struct __config {
int verbosity;
char locale[MAXVAL];
int session_timeout;
int helper_timeout;
int extract_attachments;
char piler_header_field[MAXVAL];
char extra_to_field[MAXVAL];

View File

@ -14,7 +14,7 @@
#define VERSION "1.1.1"
#define BUILD 902
#define BUILD 903
#define HOSTID "mailarchiver"

View File

@ -130,7 +130,7 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi
if(state->attachments[i].dumped == 1){
rec = 0;
if(state->bodylen < BIGBUFSIZE-1024) extract_attachment_content(sdata, state, state->attachments[i].aname, get_attachment_extractor_by_filename(state->attachments[i].filename), &rec, cfg);
if(cfg->extract_attachments == 1 && state->bodylen < BIGBUFSIZE-1024) extract_attachment_content(sdata, state, state->attachments[i].aname, get_attachment_extractor_by_filename(state->attachments[i].filename), &rec, cfg);
unlink(state->attachments[i].aname);
}

View File

@ -19,7 +19,9 @@
int main(int argc, char **argv){
int readkey=1;
char filename[SMALLBUFSIZE];
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
struct stat st;
#endif
struct __config cfg;

View File

@ -60,7 +60,9 @@ ENDE:
int remove_message_frame_files(char *s, char *update_meta_sql, struct session_data *sdata, struct __config *cfg){
char *p, puf[SMALLBUFSIZE], filename[SMALLBUFSIZE];
int n=0, result;
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
struct stat st;
#endif
p = s;
do {
@ -105,8 +107,9 @@ int remove_attachments(char *in, struct session_data *sdata, struct __data *data
char *a, buf[BIGBUFSIZE-300], update_meta_sql[BIGBUFSIZE], delete_attachment_stmt[BIGBUFSIZE];
char piler_id[SMALLBUFSIZE], i[BUFLEN];
int n=0, len, attachment_id;
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
struct stat st;
#endif
if(strlen(in) < 10) return 0;