mime_content_type[i] = 0;
}
}
+ for (i=0; i<strlen(mime_charset); ++i) {
+ if (mime_charset[i] == ';') {
+ mime_charset[i] = 0;
+ }
+ }
}
}
char mime_charset[256];
char mime_disposition[256];
int mime_length;
- char mime_http[SIZ];
char *attachments = NULL;
char *ptr = NULL;
int num_attachments = 0;
strcpy(node, "");
strcpy(rfca, "");
strcpy(reply_to, "");
- strcpy(mime_http, "");
strcpy(mime_content_type, "text/plain");
strcpy(mime_charset, "us-ascii");
* yet because we're in the middle of a server transaction.
*/
if (!strncasecmp(buf, "part=", 5)) {
- ptr = realloc(attachments, ((num_attachments+1) * 1024));
+ ptr = malloc( (strlen(buf) + ((attachments != NULL) ? strlen(attachments) : 0)) ) ;
if (ptr != NULL) {
++num_attachments;
+ sprintf(ptr, "%s%s\n",
+ ((attachments != NULL) ? attachments : ""),
+ &buf[5]
+ );
+ free(attachments);
attachments = ptr;
- strcat(attachments, &buf[5]);
- strcat(attachments, "\n");
+ lprintf(9, "attachments=<%s>\n", attachments);
}
}
/*
* tracing ... uncomment if necessary
*
+ */
lprintf(9, "fwd filename: %s\n", mime_filename);
lprintf(9, "fwd partnum : %s\n", mime_partnum);
lprintf(9, "fwd conttype: %s\n", mime_content_type);
lprintf(9, "fwd dispose : %s\n", mime_disposition);
lprintf(9, "fwd length : %d\n", mime_length);
- */
if ( (!strcasecmp(mime_disposition, "inline"))
|| (!strcasecmp(mime_disposition, "attachment")) ) {
}
}
- if (attachments != NULL) {
- free(attachments);
- }
}
#ifdef HAVE_ICONV
iconv_close(ic);
}
#endif
+
+ if (attachments != NULL) {
+ free(attachments);
+ }
}
/**