diff --git a/ChangeLog b/ChangeLog index 6dcf19989..a4c59d413 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20040719 + - (djm) [log.c] bz #111: Escape more control characters when sending data + to syslog; from peak AT argo.troja.mff.cuni.cz + 20040719 - (djm) [openbsd-compat/bsd-arc4random.c] Discard early keystream, like OpenBSD ok dtucker@ @@ -1535,4 +1539,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3480 2004/07/19 17:19:26 tim Exp $ +$Id: ChangeLog,v 1.3481 2004/07/21 00:52:13 djm Exp $ diff --git a/log.c b/log.c index 0c4d5123a..5d8625d15 100644 --- a/log.c +++ b/log.c @@ -51,6 +51,9 @@ static char *argv0; extern char *__progname; +#define LOG_SYSLOG_VIS (VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL) +#define LOG_STDERR_VIS (VIS_SAFE|VIS_OCTAL) + /* textual representation of log-facilities/levels */ static struct { @@ -316,7 +319,8 @@ do_log(LogLevel level, const char *fmt, va_list args) } else { vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); } - strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL); + strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), + log_on_stderr ? LOG_STDERR_VIS : LOG_SYSLOG_VIS); if (log_on_stderr) { snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf); write(STDERR_FILENO, msgbuf, strlen(msgbuf));