Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157463671
D32630.id97376.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D32630.id97376.diff
View Options
diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c
--- a/usr.sbin/cron/cron/do_command.c
+++ b/usr.sbin/cron/cron/do_command.c
@@ -84,6 +84,20 @@
Debug(DPROC, ("[%d] main process returning to work\n", getpid()))
}
+static char* escape_html(int ch, char* tempbuf) {
+
+ switch (ch) {
+ case '<':
+ return "<";
+ case '>':
+ return ">";
+ case '&':
+ return "&";
+ default:
+ tempbuf[0] = ch;
+ return tempbuf;
+ }
+}
static void
child_process(e, u)
@@ -524,7 +538,10 @@
for (env = e->envp; *env; env++)
fprintf(mail, "X-Cron-Env: <%s>\n",
*env);
+
+ fprintf(mail, "Content-Type: text/html\n");
fprintf(mail, "\n");
+ fprintf(mail, "<html><pre style=\"white-space: pre;\">\n");
/* this was the first char from the pipe
*/
@@ -538,8 +555,15 @@
while (EOF != (ch = getc(in))) {
bytes++;
- if (mail)
- putc(ch, mail);
+ if (mail) {
+ char tempbuf[2] = {0, 0};
+ char* escapedstring = escape_html(ch, &tempbuf[0]);
+ fputs(escapedstring, mail);
+ }
+ }
+
+ if (mailto) {
+ fprintf(mail, "</pre></html>\n");
}
}
/*if data from grandchild*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 22, 6:10 PM (5 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33426904
Default Alt Text
D32630.id97376.diff (1 KB)
Attached To
Mode
D32630: HTML pre-formatted cron's emails
Attached
Detach File
Event Timeline
Log In to Comment