mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 09:10:12 +01:00
support longer attachment names
This commit is contained in:
parent
d8720cdda0
commit
319c9e9732
@ -14,7 +14,7 @@
|
||||
|
||||
#define VERSION "0.1.25-master-branch"
|
||||
|
||||
#define BUILD 860
|
||||
#define BUILD 861
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -109,7 +109,7 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi
|
||||
clearhash(state->journal_recipient);
|
||||
|
||||
trimBuffer(state->b_subject);
|
||||
fixupEncodedHeaderLine(state->b_subject);
|
||||
fixupEncodedHeaderLine(state->b_subject, MAXBUFSIZE);
|
||||
|
||||
|
||||
if(sdata->internal_sender == 0) sdata->direction = DIRECTION_INCOMING;
|
||||
@ -265,7 +265,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
||||
if(take_into_pieces == 1){
|
||||
state->fd = open(state->attachments[state->n_attachments].internalname, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
|
||||
|
||||
fixupEncodedHeaderLine(state->attachments[state->n_attachments].filename);
|
||||
fixupEncodedHeaderLine(state->attachments[state->n_attachments].filename, TINYBUFSIZE);
|
||||
|
||||
p = get_attachment_extractor_by_filename(state->attachments[state->n_attachments].filename);
|
||||
|
||||
@ -428,7 +428,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
||||
}
|
||||
|
||||
if(state->is_1st_header == 1){
|
||||
fixupEncodedHeaderLine(buf);
|
||||
fixupEncodedHeaderLine(buf, MAXBUFSIZE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ void init_state(struct _state *state);
|
||||
unsigned long parse_date_header(char *s, struct __config *cfg);
|
||||
int isHexNumber(char *p);
|
||||
int extract_boundary(char *p, struct _state *state);
|
||||
void fixupEncodedHeaderLine(char *buf);
|
||||
void fixupEncodedHeaderLine(char *buf, int buflen);
|
||||
void fixupSoftBreakInQuotedPritableLine(char *buf, struct _state *state);
|
||||
void fixupBase64EncodedLine(char *buf, struct _state *state);
|
||||
void markHTML(char *buf, struct _state *state);
|
||||
|
@ -315,7 +315,7 @@ int extract_boundary(char *p, struct _state *state){
|
||||
}
|
||||
|
||||
|
||||
void fixupEncodedHeaderLine(char *buf){
|
||||
void fixupEncodedHeaderLine(char *buf, int buflen){
|
||||
char *sb, *sq, *p, *q, *r, *s, *e, *start, *end;
|
||||
char v[SMALLBUFSIZE], puf[MAXBUFSIZE], encoding[SMALLBUFSIZE], tmpbuf[2*SMALLBUFSIZE];
|
||||
iconv_t cd;
|
||||
@ -323,6 +323,7 @@ void fixupEncodedHeaderLine(char *buf){
|
||||
char *inbuf, *outbuf;
|
||||
int need_encoding;
|
||||
|
||||
if(buflen < 5) return;
|
||||
|
||||
memset(puf, 0, sizeof(puf));
|
||||
|
||||
@ -412,7 +413,7 @@ void fixupEncodedHeaderLine(char *buf){
|
||||
|
||||
} while(q);
|
||||
|
||||
snprintf(buf, MAXBUFSIZE-1, "%s", puf);
|
||||
snprintf(buf, buflen-1, "%s", puf);
|
||||
}
|
||||
|
||||
|
||||
@ -740,7 +741,7 @@ void fixURL(char *url){
|
||||
|
||||
int extractNameFromHeaderLine(char *s, char *name, char *resultbuf){
|
||||
int rc=0;
|
||||
char buf[TINYBUFSIZE], *p, *q;
|
||||
char buf[SMALLBUFSIZE], puf[SMALLBUFSIZE], *p, *q;
|
||||
|
||||
snprintf(buf, sizeof(buf)-1, "%s", s);
|
||||
|
||||
@ -760,7 +761,13 @@ int extractNameFromHeaderLine(char *s, char *name, char *resultbuf){
|
||||
p++;
|
||||
}
|
||||
}
|
||||
snprintf(resultbuf, TINYBUFSIZE-1, "%s", p);
|
||||
|
||||
snprintf(puf, sizeof(puf)-1, "%s", p);
|
||||
|
||||
fixupEncodedHeaderLine(puf, sizeof(puf));
|
||||
|
||||
snprintf(resultbuf, TINYBUFSIZE-1, "%s", puf);
|
||||
|
||||
rc = 1;
|
||||
}
|
||||
}
|
||||
|
@ -164,6 +164,9 @@ int test_dates(){
|
||||
snprintf(datestr, sizeof(datestr)-2, "Date: 03 Jun 06 05:59:00 +0100");
|
||||
ts = parse_date_header(datestr, &cfg); printf("%s => %ld\n", datestr, ts);
|
||||
|
||||
snprintf(datestr, sizeof(datestr)-2, "Date: 03-Feb-2014 18:00:00");
|
||||
ts = parse_date_header(datestr, &cfg); printf("%s => %ld\n", datestr, ts);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user