Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178279055
D32630.1796409538.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D32630.1796409538.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, Dec 4, 6:38 PM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42211602
Default Alt Text
D32630.1796409538.diff (1 KB)
Attached To
Mode
D32630: HTML pre-formatted cron's emails
Attached
Detach File
Event Timeline