Page MenuHomeFreeBSD

D32630.id97376.diff
No OneTemporary

D32630.id97376.diff

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 "&lt;";
+ case '>':
+ return "&gt;";
+ case '&':
+ return "&amp;";
+ 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

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)

Event Timeline