aboutsummaryrefslogtreecommitdiffstats
path: root/sink.c
diff options
context:
space:
mode:
Diffstat (limited to 'sink.c')
-rw-r--r--sink.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/sink.c b/sink.c
index 5d92556f..7b1226f3 100644
--- a/sink.c
+++ b/sink.c
@@ -1562,12 +1562,12 @@ int open_warning_by_mail(struct query *ctl)
else /* send to postmaster */
status = open_sink(ctl, &reply, &good, &bad);
if (status == 0) {
- stuff_warning(NULL, ctl, "From: FETCHMAIL-DAEMON@%s",
+ stuff_warning(NULL, ctl, "From: ", "FETCHMAIL-DAEMON@%s",
ctl->smtpaddress ? ctl->smtpaddress : fetchmailhost);
- stuff_warning(NULL, ctl, "Date: %s", rfc822timestamp());
- stuff_warning(NULL, ctl, "MIME-Version: 1.0");
- stuff_warning(NULL, ctl, "Content-Transfer-Encoding: 8bit");
- stuff_warning(NULL, ctl, "Content-Type: text/plain; charset=\"%s\"", iana_charset);
+ stuff_warning(NULL, ctl, "Date: ", "%s", rfc822timestamp());
+ stuff_warning(NULL, ctl, "MIME-Version: ", "1.0");
+ stuff_warning(NULL, ctl, "Content-Transfer-Encoding: ", "8bit");
+ stuff_warning(NULL, ctl, "Content-Type: ", "text/plain; charset=\"%s\"", iana_charset);
}
return(status);
}
@@ -1577,19 +1577,22 @@ int open_warning_by_mail(struct query *ctl)
* a header line) as per RFC-2047 using rfc2047charset as the character
* set field */
#if defined(HAVE_STDARG_H)
-void stuff_warning(const char *rfc2047charset, struct query *ctl, const char *fmt, ... )
+void stuff_warning(const char *rfc2047charset, struct query *ctl, const char *pfx, const char *fmt, ... )
#else
-void stuff_warning(rfc2047charset, ctl, fmt, va_alist)
+void stuff_warning(rfc2047charset, ctl, pfx, fmt, va_alist)
const char *charset;
+const char *pfx; /* constant, non-translated prefix (such as "Subject: ") */
struct query *ctl;
const char *fmt; /* printf-style format */
va_dcl
#endif
{
/* make huge -- i18n can bulk up error messages a lot */
- char buf[2*MSGBUFSIZE+4];
+ char buf[3*MSGBUFSIZE+4];
va_list ap;
+ snprintf(buf, sizeof(buf), "%s", pfx);
+
/*
* stuffline() requires its input to be writeable (for CR stripping),
* so we needed to copy the message to a writeable buffer anyway in
@@ -1601,7 +1604,7 @@ va_dcl
#else
va_start(ap);
#endif
- vsnprintf(buf, sizeof(buf) - 2, fmt, ap);
+ vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf)-2, fmt, ap);
va_end(ap);
snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "\r\n");
@@ -1617,7 +1620,7 @@ va_dcl
void close_warning_by_mail(struct query *ctl, struct msgblk *msg)
/* sign and send mailed warnings */
{
- stuff_warning(NULL, ctl, GT_("-- \nThe Fetchmail Daemon"));
+ stuff_warning(NULL, ctl, "-- \n", GT_("The Fetchmail Daemon"));
close_sink(ctl, msg, TRUE);
}