mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 04:30:12 +01:00
improved piler own header line handling
This commit is contained in:
parent
0fe5c31d22
commit
7c3aa6b152
@ -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_header_field=X-piler: piler already archived this email
|
||||
piler_header_field=X-piler-id:
|
||||
|
||||
; extra header field to treat as To:
|
||||
;
|
||||
|
@ -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)},
|
||||
{ "pemfile", "string", (void*) string_parser, offsetof(struct __config, pemfile), "", 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_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},
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#define VERSION "1.2.0-master"
|
||||
|
||||
#define BUILD 912
|
||||
#define BUILD 913
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
32
src/parser.c
32
src/parser.c
@ -181,19 +181,31 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
||||
state->line_num++;
|
||||
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) ){
|
||||
sdata->restored_copy = 1;
|
||||
}
|
||||
/*
|
||||
* check a few things in the 1st header
|
||||
*/
|
||||
|
||||
if(state->is_1st_header == 1 && *(cfg->spam_header_line) != '\0' && strncmp(buf, cfg->spam_header_line, strlen(cfg->spam_header_line)) == 0){
|
||||
sdata->spam_message = 1;
|
||||
}
|
||||
if(state->is_1st_header == 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->import == 0){
|
||||
sdata->ms_journal = 1;
|
||||
memset(state->message_id, 0, SMALLBUFSIZE);
|
||||
if(strncmp(buf, "Received: by piler", strlen("Received: by piler")) == 0){
|
||||
sdata->restored_copy = 1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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){
|
||||
sdata->ms_journal = 1;
|
||||
memset(state->message_id, 0, SMALLBUFSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user