--- mm2.7/src/src/metamail/metamail.c.orig 2006-03-20 14:07:16.689062000 +0100 +++ mm2.7/src/src/metamail/metamail.c 2006-03-21 14:18:29.529062000 +0100 @@ -67,6 +67,7 @@ char *ContentType = NULL, *ContentEncoding = NULL, + *ContentDisposition = NULL, *MailerName = "unknown", *MailSubject = "Mail message", *MailFrom = "unknown sender", @@ -157,6 +158,7 @@ ContentType = NULL; ContentEncoding = NULL; + ContentDisposition = NULL; MailSubject = "Mail message"; MailFrom = "unknown sender"; MailSummary = "non-text mail message"; @@ -385,6 +387,7 @@ Fname[0] = 0; suggestedname = FindParam("name"); + if (!suggestedname) suggestedname = FindParam("filename"); if (strlen(suggestedname) > NAME_MAX - 50) suggestedname[NAME_MAX - 50] = '\0'; if (!suggestedname) { @@ -574,7 +577,7 @@ /* strip leading white space */ while (*ContentType && isspace((unsigned char) *ContentType)) ++ContentType; StripTrailingSpace(ContentType); - ParseContentParameters(ContentType); + ParseContentParameters(0, ContentType); break; case 'd': MightAskBeforeExecuting = 0; @@ -1237,6 +1240,7 @@ BoundaryCt=0; return -1; } + ContentDisposition = NULL; for (s=mailheaders+oldbytes; *s; ++s) { if (*s == '\n' && (*(s+1) != ' ') && (*(s+1) != '\t')) { if (!ContentType && !lc2strncmp(s, "\ncontent-type:", 14)) { @@ -1259,7 +1263,7 @@ } } StripTrailingSpace(ContentType); - ParseContentParameters(ContentType); + ParseContentParameters(0, ContentType); if (PrintHeads) maybephead(s+1); } else if (!ContentEncoding && !lc2strncmp(s, "\ncontent-transfer-encoding:", 27)) { ContentEncoding = FreshHeaderCopy(s+27); @@ -1270,9 +1274,13 @@ } else if (!lc2strncmp(s, "\nfrom:", 6)) { if (PrintHeads) maybephead(s+1); MailFrom = FreshHeaderCopy(s+6); - } else if (!lc2strncmp(s, "\ncontent-description:", 4)) { + } else if (!lc2strncmp(s, "\ncontent-description:", 21)) { if(PrintHeads) maybephead(s+1); MailSubject = FreshHeaderCopy(s+21); + } else if (!ContentDisposition && !lc2strncmp(s, "\ncontent-disposition:", 21)) { + ContentDisposition = FreshHeaderCopy(s+21); + StripTrailingSpace(ContentDisposition); + ParseContentParameters(CParamsUsed, ContentDisposition); } else { /* Print any with encoded variables */ char *dum = s; @@ -2111,12 +2119,13 @@ } void -ParseContentParameters(ct) +ParseContentParameters(pc, ct) +int pc; char *ct; { char *s, *t, *eq; - CParamsUsed = 0; + CParamsUsed = pc; s = index(ct, ';'); if (!s) return; *s++ = 0;