git-svn: trunk@3224
Nigel Horne authored on 2007/09/18 01:59:02... | ... |
@@ -2481,6 +2481,8 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re |
2481 | 2481 |
messageDestroy(messages[i]); |
2482 | 2482 |
free(messages); |
2483 | 2483 |
} |
2484 |
+ if(aText && (textIn == NULL)) |
|
2485 |
+ textDestroy(aText); |
|
2484 | 2486 |
|
2485 | 2487 |
/* |
2486 | 2488 |
* Nothing to do |
... | ... |
@@ -2828,17 +2830,25 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re |
2828 | 2828 |
if(l == NULL) |
2829 | 2829 |
break; |
2830 | 2830 |
s = lineGetData(l); |
2831 |
- if(strncasecmp(s, "Content-Type:", 13) == 0) |
|
2831 |
+ if(strncasecmp(s, "Content-Type:", 13) == 0) { |
|
2832 | 2832 |
/* |
2833 |
- * Don't bother with plain/text or |
|
2834 |
- * plain/html |
|
2833 |
+ * Don't bother with text/plain or |
|
2834 |
+ * text/html |
|
2835 | 2835 |
*/ |
2836 |
- if(strstr(s, "text/") == NULL) |
|
2836 |
+ if(strstr(s, "text/plain") != NULL) |
|
2837 | 2837 |
/* |
2838 |
- * Don't bother to save the unuseful |
|
2839 |
- * part |
|
2838 |
+ * Don't bother to save the |
|
2839 |
+ * unuseful part, read past |
|
2840 |
+ * the headers then we'll go |
|
2841 |
+ * on to look for the next |
|
2842 |
+ * bounce message |
|
2840 | 2843 |
*/ |
2841 |
- break; |
|
2844 |
+ continue; |
|
2845 |
+ if((!doPhishingScan) && |
|
2846 |
+ (strstr(s, "text/html") != NULL)) |
|
2847 |
+ continue; |
|
2848 |
+ break; |
|
2849 |
+ } |
|
2842 | 2850 |
} |
2843 | 2851 |
|
2844 | 2852 |
if(lookahead && (lookahead->t_line == NULL)) { |
... | ... |
@@ -3353,47 +3363,58 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c |
3353 | 3353 |
* and |
3354 | 3354 |
* Content-Type: multipart/mixed foo/bar |
3355 | 3355 |
*/ |
3356 |
- if(s && *s) for(;;) { |
|
3356 |
+ if(s && *s) { |
|
3357 |
+ char *buf2 = cli_strdup(buf); |
|
3358 |
+ |
|
3359 |
+ if(buf2 == NULL) { |
|
3360 |
+ if(copy) |
|
3361 |
+ free(copy); |
|
3362 |
+ free(buf); |
|
3363 |
+ return -1; |
|
3364 |
+ } |
|
3365 |
+ for(;;) { |
|
3357 | 3366 |
#ifdef CL_THREAD_SAFE |
3358 |
- int set = messageSetMimeType(m, strtok_r(s, "/", &strptr)); |
|
3367 |
+ int set = messageSetMimeType(m, strtok_r(s, "/", &strptr)); |
|
3359 | 3368 |
#else |
3360 |
- int set = messageSetMimeType(m, strtok(s, "/")); |
|
3369 |
+ int set = messageSetMimeType(m, strtok(s, "/")); |
|
3361 | 3370 |
#endif |
3362 | 3371 |
|
3363 |
- /* |
|
3364 |
- * Stephen White <stephen@earth.li> |
|
3365 |
- * Some clients put space after |
|
3366 |
- * the mime type but before |
|
3367 |
- * the ; |
|
3368 |
- */ |
|
3372 |
+ /* |
|
3373 |
+ * Stephen White <stephen@earth.li> |
|
3374 |
+ * Some clients put space after |
|
3375 |
+ * the mime type but before |
|
3376 |
+ * the ; |
|
3377 |
+ */ |
|
3369 | 3378 |
#ifdef CL_THREAD_SAFE |
3370 |
- s = strtok_r(NULL, ";", &strptr); |
|
3379 |
+ s = strtok_r(NULL, ";", &strptr); |
|
3371 | 3380 |
#else |
3372 |
- s = strtok(NULL, ";"); |
|
3381 |
+ s = strtok(NULL, ";"); |
|
3373 | 3382 |
#endif |
3374 |
- if(s == NULL) |
|
3375 |
- break; |
|
3376 |
- if(set) { |
|
3377 |
- size_t len = strstrip(s) - 1; |
|
3378 |
- if(s[len] == '\"') { |
|
3379 |
- s[len] = '\0'; |
|
3380 |
- len = strstrip(s); |
|
3381 |
- } |
|
3382 |
- if(len) { |
|
3383 |
- if(strchr(s, ' ')) |
|
3384 |
- messageSetMimeSubtype(m, |
|
3385 |
- cli_strtokbuf(s, 0, " ", buf)); |
|
3386 |
- else |
|
3387 |
- messageSetMimeSubtype(m, s); |
|
3383 |
+ if(s == NULL) |
|
3384 |
+ break; |
|
3385 |
+ if(set) { |
|
3386 |
+ size_t len = strstrip(s) - 1; |
|
3387 |
+ if(s[len] == '\"') { |
|
3388 |
+ s[len] = '\0'; |
|
3389 |
+ len = strstrip(s); |
|
3390 |
+ } |
|
3391 |
+ if(len) { |
|
3392 |
+ if(strchr(s, ' ')) |
|
3393 |
+ messageSetMimeSubtype(m, |
|
3394 |
+ cli_strtokbuf(s, 0, " ", buf2)); |
|
3395 |
+ else |
|
3396 |
+ messageSetMimeSubtype(m, s); |
|
3397 |
+ } |
|
3388 | 3398 |
} |
3389 |
- } |
|
3390 | 3399 |
|
3391 |
- while(*s && !isspace(*s)) |
|
3392 |
- s++; |
|
3393 |
- if(*s++ == '\0') |
|
3394 |
- break; |
|
3395 |
- if(*s == '\0') |
|
3396 |
- break; |
|
3400 |
+ while(*s && !isspace(*s)) |
|
3401 |
+ s++; |
|
3402 |
+ if(*s++ == '\0') |
|
3403 |
+ break; |
|
3404 |
+ if(*s == '\0') |
|
3405 |
+ break; |
|
3406 |
+ } |
|
3407 |
+ free(buf2); |
|
3397 | 3408 |
} |
3398 | 3409 |
} |
3399 | 3410 |
} |