Removed bad memoryhole implementation

merge-experiment
Krista Bennett 5 years ago
parent cc4c5c5e3e
commit 8070e68ac4

@ -7785,52 +7785,3 @@ mailimf_optional_fields_parse(const char * message, size_t length,
return res;
}
LIBETPAN_EXPORT
int
mailimf_memoryhole_fields_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_fields ** result)
{
size_t cur_token;
clist * list;
struct mailimf_fields * fields;
int r = MAILIMF_ERROR_PARSE;
int res;
cur_token = * indx;
list = NULL;
const char* rfc822_header_string = "Content-Type: text/rfc822-headers;";
const size_t rfc822_header_strlen = 34;
const char* cur_char = message + cur_token;
if ((cur_token + rfc822_header_strlen) <= length &&
strncmp(cur_char, rfc822_header_string, rfc822_header_strlen) == 0) {
r = mailimf_envelope_fields_parse(message, length, &cur_token,
result);
}
switch (r) {
case MAILIMF_NO_ERROR:
/* do nothing */
break;
default:
res = r;
goto err;
}
* indx = cur_token;
return MAILIMF_NO_ERROR;
free:
if (list != NULL) {
clist_foreach(list, (clist_func) mailimf_field_free, NULL);
clist_free(list);
}
err:
return res;
}

@ -111,12 +111,6 @@ int mailmime_language_parse(const char * message, size_t length,
size_t * indx,
struct mailmime_language ** result);
LIBETPAN_EXPORT
int
mailimf_memoryhole_fields_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_fields ** result);
#ifdef __cplusplus
}
#endif

@ -831,7 +831,6 @@ int mailmime_multipart_next_parse(const char * message, size_t length,
return MAILIMF_NO_ERROR;
}
/* N.B. Modified to allow add enigmail memoryhole Subject header to fields. */
static int
mailmime_multipart_body_parse(const char * message, size_t length,
size_t * indx, char * boundary,
@ -967,38 +966,25 @@ mailmime_multipart_body_parse(const char * message, size_t length,
if (r == MAILIMF_NO_ERROR) {
bp_token = 0;
struct mailimf_fields * envelope_fields = NULL;
int is_memoryhole_part = 0;
r = mailimf_memoryhole_fields_parse(data_str, data_size,
r = mailimf_optional_fields_parse(data_str, data_size,
&bp_token, &fields);
if (r == MAILIMF_NO_ERROR) {
is_memoryhole_part = 1;
}
else {
r = mailimf_optional_fields_parse(data_str, data_size,
&bp_token, &fields);
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
res = r;
goto free;
}
r = mailimf_crlf_parse(data_str, data_size, &bp_token);
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
mailimf_fields_free(fields);
res = r;
goto free;
}
}
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
res = r;
goto free;
}
r = mailimf_crlf_parse(data_str, data_size, &bp_token);
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
mailimf_fields_free(fields);
res = r;
goto free;
}
mime_fields = NULL;
r = mailmime_fields_parse(fields, &mime_fields);
/* mailimf_fields_free(fields); */ /* we don't do this now to preserve for memoryhole */
mailimf_fields_free(fields);
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
res = r;
@ -1026,8 +1012,6 @@ mailmime_multipart_body_parse(const char * message, size_t length,
goto free;
}
mime_bp->mm_imf_fields = fields;
r = mailmime_multipart_next_parse(message, length, &cur_token);
if (r == MAILIMF_NO_ERROR) {
/* do nothing */
@ -2233,4 +2217,4 @@ int mailmime_get_section_id(struct mailmime * mime,
mailmime_section_free(section_id);
err:
return res;
}
}

@ -436,7 +436,6 @@ struct mailmime * mailmime_new(int mm_type,
mime->mm_mime_fields = mm_mime_fields;
mime->mm_content_type = mm_content_type;
mime->mm_imf_fields = NULL;
mime->mm_body = mm_body;
switch (mm_type) {
@ -506,8 +505,6 @@ void mailmime_free(struct mailmime * mime)
if (mime->mm_mime_fields != NULL)
mailmime_fields_free(mime->mm_mime_fields);
if (mime->mm_imf_fields != NULL)
mailimf_fields_free(mime->mm_imf_fields);
if (mime->mm_content_type != NULL)
mailmime_content_free(mime->mm_content_type);
free(mime);

@ -322,7 +322,6 @@ struct mailmime {
struct mailmime_fields * mm_mime_fields;
struct mailmime_content * mm_content_type;
struct mailimf_fields * mm_imf_fields; /* preserves the whole set of fields from a part for memoryhole */
struct mailmime_data * mm_body;
union {

Loading…
Cancel
Save