mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 10:02:00 +01:00
parser: fixed aaa+bbb@aaa.fu recipient address
Change-Id: Ia638fdd4c740261b423dd0e03b528e2b3c39f3d8 Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
parent
78d52fe06c
commit
9a98571f2a
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#define VERSION "1.2.0"
|
#define VERSION "1.2.0"
|
||||||
|
|
||||||
#define BUILD 952
|
#define BUILD 953
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
|
19
src/parser.c
19
src/parser.c
@ -172,10 +172,10 @@ void storno_attachment(struct parser_state *state){
|
|||||||
|
|
||||||
|
|
||||||
int parse_line(char *buf, struct parser_state *state, struct session_data *sdata, int take_into_pieces, char *writebuffer, int writebuffersize, char *abuffer, int abuffersize, struct __data *data, struct __config *cfg){
|
int parse_line(char *buf, struct parser_state *state, struct session_data *sdata, int take_into_pieces, char *writebuffer, int writebuffersize, char *abuffer, int abuffersize, struct __data *data, struct __config *cfg){
|
||||||
char *p, *q, puf[SMALLBUFSIZE];
|
char *p, *q, *r, puf[SMALLBUFSIZE];
|
||||||
unsigned char b64buffer[MAXBUFSIZE];
|
unsigned char b64buffer[MAXBUFSIZE];
|
||||||
char tmpbuf[MAXBUFSIZE];
|
char tmpbuf[MAXBUFSIZE];
|
||||||
int n64, writelen, boundary_line=0, result;
|
int n, n64, writelen, boundary_line=0, result;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
||||||
if(cfg->debug == 1) printf("line: %s", buf);
|
if(cfg->debug == 1) printf("line: %s", buf);
|
||||||
@ -739,15 +739,28 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata
|
|||||||
|
|
||||||
/* skip any address matching ...@cfg->hostid, 2013.10.29, SJ */
|
/* skip any address matching ...@cfg->hostid, 2013.10.29, SJ */
|
||||||
q = strchr(puf, '@');
|
q = strchr(puf, '@');
|
||||||
if(q && strncmp(q+1, cfg->hostid, cfg->hostid_len) == 0){
|
if(q){
|
||||||
|
if(strncmp(q+1, cfg->hostid, cfg->hostid_len) == 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fix aaa+bbb@ccc.fu address to aaa@ccc.fu, 2017.01.31, SJ */
|
||||||
|
|
||||||
|
r = strchr(puf, '+');
|
||||||
|
if(r){
|
||||||
|
n = strlen(q);
|
||||||
|
memmove(r, q, n);
|
||||||
|
*(r+n) = '\0';
|
||||||
|
q = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addnode(state->rcpt, puf);
|
addnode(state->rcpt, puf);
|
||||||
memcpy(&(state->b_to[state->tolen]), puf, len);
|
memcpy(&(state->b_to[state->tolen]), puf, len);
|
||||||
state->tolen += len;
|
state->tolen += len;
|
||||||
|
|
||||||
if(does_it_seem_like_an_email_address(puf) == 1){
|
if(does_it_seem_like_an_email_address(puf) == 1){
|
||||||
|
|
||||||
if(is_email_address_on_my_domains(puf, data) == 1) sdata->internal_recipient = 1;
|
if(is_email_address_on_my_domains(puf, data) == 1) sdata->internal_recipient = 1;
|
||||||
else sdata->external_recipient = 1;
|
else sdata->external_recipient = 1;
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ void translateLine(unsigned char *p, struct parser_state *state){
|
|||||||
if(*p == '\'' && prev == '"') { *p = ' '; }
|
if(*p == '\'' && prev == '"') { *p = ' '; }
|
||||||
if(*p == '\'' && *(p+1) == '"'){ *p = ' '; }
|
if(*p == '\'' && *(p+1) == '"'){ *p = ' '; }
|
||||||
|
|
||||||
if(*p == '_' || *p == '\'' || *p == '&'){ continue; }
|
if(*p == '_' || *p == '\'' || *p == '&' || *p == '+'){ continue; }
|
||||||
|
|
||||||
prev = *p;
|
prev = *p;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user