summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/monitor_wrap.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2020-10-16 13:24:46 +0000
committerDamien Miller <djm@cvs.openbsd.org>2020-10-16 13:24:46 +0000
commiteffdc23547e89f8a21e72903868c44d29aa66b93 (patch)
tree3cf1f2ee4db354967fea20915c5145d8c0df890f /usr.bin/ssh/monitor_wrap.c
parentf5a0ce89e9bcddedac89ee63ac2435f3b73c5466 (diff)
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@
Diffstat (limited to 'usr.bin/ssh/monitor_wrap.c')
-rw-r--r--usr.bin/ssh/monitor_wrap.c8
1 files changed, 6 insertions, 2 deletions
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 <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -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));