improved piler own header line handling

This commit is contained in:
SJ 2015-05-17 21:41:13 +02:00
parent 0fe5c31d22
commit 7c3aa6b152
4 changed files with 25 additions and 13 deletions

View File

@ -83,7 +83,7 @@ cipher_list=ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+
; piler's own header to indicate previously archived messages ; piler's own header to indicate previously archived messages
piler_header_field=X-piler: piler already archived this email piler_header_field=X-piler-id:
; extra header field to treat as To: ; extra header field to treat as To:
; ;

View File

@ -94,7 +94,7 @@ struct _parse_rule config_parse_rules[] =
{ "number_of_worker_processes", "integer", (void*) int_parser, offsetof(struct __config, number_of_worker_processes), "10", sizeof(int)}, { "number_of_worker_processes", "integer", (void*) int_parser, offsetof(struct __config, number_of_worker_processes), "10", sizeof(int)},
{ "pemfile", "string", (void*) string_parser, offsetof(struct __config, pemfile), "", MAXVAL-1}, { "pemfile", "string", (void*) string_parser, offsetof(struct __config, pemfile), "", MAXVAL-1},
{ "pidfile", "string", (void*) string_parser, offsetof(struct __config, pidfile), PIDFILE, MAXVAL-1}, { "pidfile", "string", (void*) string_parser, offsetof(struct __config, pidfile), PIDFILE, MAXVAL-1},
{ "piler_header_field", "string", (void*) string_parser, offsetof(struct __config, piler_header_field), "", MAXVAL-1}, { "piler_header_field", "string", (void*) string_parser, offsetof(struct __config, piler_header_field), "X-piler-id:", MAXVAL-1},
{ "pilergetd_listen_addr", "string", (void*) string_parser, offsetof(struct __config, pilergetd_listen_addr), "127.0.0.1", MAXVAL-1}, { "pilergetd_listen_addr", "string", (void*) string_parser, offsetof(struct __config, pilergetd_listen_addr), "127.0.0.1", MAXVAL-1},
{ "pilergetd_listen_port", "integer", (void*) int_parser, offsetof(struct __config, pilergetd_listen_port), "10091", sizeof(int)}, { "pilergetd_listen_port", "integer", (void*) int_parser, offsetof(struct __config, pilergetd_listen_port), "10091", sizeof(int)},
{ "pilergetd_password", "string", (void*) string_parser, offsetof(struct __config, pilergetd_password), "xxxxxxxxxx", MAXVAL-1}, { "pilergetd_password", "string", (void*) string_parser, offsetof(struct __config, pilergetd_password), "xxxxxxxxxx", MAXVAL-1},

View File

@ -14,7 +14,7 @@
#define VERSION "1.2.0-master" #define VERSION "1.2.0-master"
#define BUILD 912 #define BUILD 913
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -181,21 +181,33 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
state->line_num++; state->line_num++;
len = strlen(buf); len = strlen(buf);
if(state->is_1st_header == 1 && (strncmp(buf, "Received: by piler", strlen("Received: by piler")) == 0 || strncmp(buf, "X-piler-id: ", strlen("X-piler-id: ")) == 0) ){ /*
* check a few things in the 1st header
*/
if(state->is_1st_header == 1){
if(strncmp(buf, "Received: by piler", strlen("Received: by piler")) == 0){
sdata->restored_copy = 1; sdata->restored_copy = 1;
} }
if(state->is_1st_header == 1 && *(cfg->spam_header_line) != '\0' && strncmp(buf, cfg->spam_header_line, strlen(cfg->spam_header_line)) == 0){ if(*(cfg->piler_header_field) != 0 && strncmp(buf, cfg->piler_header_field, strlen(cfg->piler_header_field)) == 0){
sdata->restored_copy = 1;
}
if(*(cfg->spam_header_line) != '\0' && strncmp(buf, cfg->spam_header_line, strlen(cfg->spam_header_line)) == 0){
sdata->spam_message = 1; sdata->spam_message = 1;
} }
if(state->is_1st_header == 1 && sdata->ms_journal == 0 && (strncmp(buf, "X-MS-Journal-Report:", strlen("X-MS-Journal-Report:")) == 0 || (sdata->import == 1 && strncmp(buf, "X-MS-Exchange-Organization-Auth", strlen("X-MS-Exchange-Organization-Auth")) == 0))){ if(sdata->ms_journal == 0 && (strncmp(buf, "X-MS-Journal-Report:", strlen("X-MS-Journal-Report:")) == 0 || (sdata->import == 1 && strncmp(buf, "X-MS-Exchange-Organization-Auth", strlen("X-MS-Exchange-Organization-Auth")) == 0))){
if(sdata->import == 0){ if(sdata->import == 0){
sdata->ms_journal = 1; sdata->ms_journal = 1;
memset(state->message_id, 0, SMALLBUFSIZE); memset(state->message_id, 0, SMALLBUFSIZE);
} }
} }
}
if(state->message_rfc822 == 0 && (buf[0] == '\r' || buf[0] == '\n') ){ if(state->message_rfc822 == 0 && (buf[0] == '\r' || buf[0] == '\n') ){
state->message_state = MSG_BODY; state->message_state = MSG_BODY;