summaryrefslogtreecommitdiffstats
path: root/log.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2004-07-21 02:52:13 +0200
committerDamien Miller <djm@mindrot.org>2004-07-21 02:52:13 +0200
commit23a7027e48c1b8d7f54c04319a6e0433d1c19e23 (patch)
tree96b8258ef2c991390fe8d3cf4e7b239313d3d622 /log.c
parent - (tim) [configure.ac] updwtmpx() on OpenServer seems to add duplicate entry. (diff)
downloadopenssh-23a7027e48c1b8d7f54c04319a6e0433d1c19e23.tar.xz
openssh-23a7027e48c1b8d7f54c04319a6e0433d1c19e23.zip
- (djm) [log.c] bz #111: Escape more control characters when sending data
to syslog; from peak AT argo.troja.mff.cuni.cz
Diffstat (limited to 'log.c')
-rw-r--r--log.c6
1 files changed, 5 insertions, 1 deletions
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));