comparison src/readpst.c @ 282:57c3bcf22c4f

ignore internet headers that don't seem to be real rfc822 headers
author Carl Byington <carl@five-ten-sg.com>
date Sun, 22 May 2011 16:40:01 -0700
parents d9b1e2e0f25a
children 898118c3675e
comparison
equal deleted inserted replaced
281:d9b1e2e0f25a 282:57c3bcf22c4f
1087 1087
1088 int valid_headers(char *header) 1088 int valid_headers(char *header)
1089 { 1089 {
1090 // headers are sometimes really bogus - they seem to be fragments of the 1090 // headers are sometimes really bogus - they seem to be fragments of the
1091 // message body, so we only use them if they seem to be real rfc822 headers. 1091 // message body, so we only use them if they seem to be real rfc822 headers.
1092 // this list is composed of ones that we have seen in real pst files.
1093 // there are surely others. the problem is - given an arbitrary character
1094 // string, is it a valid (or even reasonable) set of rfc822 headers?
1092 if (header) { 1095 if (header) {
1093 if ((strncasecmp(header, "Return-Path: ", 13) == 0) || 1096 if ((strncasecmp(header, "X-Barracuda-URL: ", 17) == 0) ||
1094 (strncasecmp(header, "Received: ", 10) == 0) || 1097 (strncasecmp(header, "X-ASG-Debug-ID: ", 16) == 0) ||
1095 (strncasecmp(header, "Subject: ", 9) == 0) || 1098 (strncasecmp(header, "Return-Path: ", 13) == 0) ||
1096 (strncasecmp(header, "Date: ", 6) == 0) || 1099 (strncasecmp(header, "Received: ", 10) == 0) ||
1097 (strncasecmp(header, "From: ", 6) == 0) || 1100 (strncasecmp(header, "Subject: ", 9) == 0) ||
1098 (strncasecmp(header, "X-x: ", 5) == 0) || 1101 (strncasecmp(header, "Date: ", 6) == 0) ||
1102 (strncasecmp(header, "From: ", 6) == 0) ||
1103 (strncasecmp(header, "X-x: ", 5) == 0) ||
1099 (strncasecmp(header, "Microsoft Mail Internet Headers", 31) == 0)) { 1104 (strncasecmp(header, "Microsoft Mail Internet Headers", 31) == 0)) {
1100 return 1; 1105 return 1;
1101 } 1106 }
1102 else { 1107 else {
1103 if (strlen(header) > 2) { 1108 if (strlen(header) > 2) {