From effdc23547e89f8a21e72903868c44d29aa66b93 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 16 Oct 2020 13:24:46 +0000 Subject: revised log infrastructure for OpenSSH log functions receive function, filename and line number of caller. We can use this to selectively enable logging via pattern-lists. ok markus@ --- usr.bin/ssh/monitor_wrap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.bin/ssh/monitor_wrap.c') diff --git a/usr.bin/ssh/monitor_wrap.c b/usr.bin/ssh/monitor_wrap.c index a25efe9d61b..30a1217e39c 100644 --- a/usr.bin/ssh/monitor_wrap.c +++ b/usr.bin/ssh/monitor_wrap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_wrap.c,v 1.118 2020/08/27 01:06:18 djm Exp $ */ +/* $OpenBSD: monitor_wrap.c,v 1.119 2020/10/16 13:24:45 djm Exp $ */ /* * Copyright 2002 Niels Provos * Copyright 2002 Markus Friedl @@ -78,7 +78,8 @@ extern struct sshbuf *loginmsg; extern ServerOptions options; void -mm_log_handler(LogLevel level, const char *msg, void *ctx) +mm_log_handler(const char *file, const char *func, int line, + LogLevel level, const char *msg, void *ctx) { struct sshbuf *log_msg; struct monitor *mon = (struct monitor *)ctx; @@ -92,6 +93,9 @@ mm_log_handler(LogLevel level, const char *msg, void *ctx) fatal("%s: sshbuf_new failed", __func__); if ((r = sshbuf_put_u32(log_msg, 0)) != 0 || /* length; filled below */ + (r = sshbuf_put_cstring(log_msg, file)) != 0 || + (r = sshbuf_put_cstring(log_msg, func)) != 0 || + (r = sshbuf_put_u32(log_msg, (u_int)line)) != 0 || (r = sshbuf_put_u32(log_msg, level)) != 0 || (r = sshbuf_put_cstring(log_msg, msg)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); -- cgit v1.2.3