Patch for long filenames on openTNEF-0.1-dev

openTNEF does not decode long filenames from Outlook's winmail.dat attachments.

This is because it uses the attachment title field to extract the attachment filename, and the title is restricted to 8 characters.
The following patch works for me:



cristi:~/Desktop/openTNEF-0.1-dev-patched diciu$ diff ~/Desktop/openTNEF-0.1-dev/tnef.c tnef.c
61a62,63
> static char attachment_filename[255];
>
293a296,304
>
> if(prop_tag == 0x3707001e)
> {
> char * longfilename = make_string(tsp+bytes,num);
> LOGGER_log("long filename: %s", longfilename);
> strcpy(attachment_filename, longfilename);
> }
>
>
525a537,538
> break;
> // this processing takes place in attAttachment
571c584,603
< default_handler(attribute, tsp+header, size);
---
> attachment_filename[0] = '\0';
> handle_props(tsp+header);
> if(attachment_filename[0] == '\0')
> break;
>
> strncpy(attach_title, attachment_filename, 255);
> if (TNEF_glb.savedata && strlen(attach_title)>0 && attach_size > 0) {
> if (!save_attach_data(attach_title, (uint8 *)attach_loc,attach_size))
> {
> if (TNEF_VERBOSE)
> {
> if (TNEF_glb.filename_decoded_report == NULL)
> LOGGER_log("Decoding: %s\n", attach_title);
> else
> TNEF_glb.filename_decoded_report( attach_title, (TNEF_glb.verbosity_contenttype>0?"tnef":NULL));
> }
> }
> else
> LOGGER_log("%s:%d:TNEF_read_attribute:ERROR: While saving attachment '%s'\n", FL, attach_title);
> }



References:
openTNEF site, MSDN: PR_ATTACH_LONG_FILENAME