[openssh-commits] [openssh] 04/06: upstream: add channel_report_open() to report (to logs) open

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Aug 18 13:56:50 AEST 2025


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 9b61679d73a8a001c25ab308db8a3162456010cf
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Mon Aug 18 03:28:02 2025 +0000

    upstream: add channel_report_open() to report (to logs) open
    
    channels; ok deraadt@ (as part of bigger diff)
    
    OpenBSD-Commit-ID: 7f691e25366c5621d7ed6f7f9018d868f7511c0d
---
 channels.c | 17 ++++++++++++++++-
 channels.h |  3 ++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/channels.c b/channels.c
index 0efbd8d17..9d5631017 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.446 2025/06/02 14:09:34 dtucker Exp $ */
+/* $OpenBSD: channels.c,v 1.447 2025/08/18 03:28:02 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1096,6 +1096,21 @@ channel_open_message(struct ssh *ssh)
 	return ret;
 }
 
+void
+channel_report_open(struct ssh *ssh, int level)
+{
+	char *open, *oopen, *cp, ident[256];
+
+	sshpkt_fmt_connection_id(ssh, ident, sizeof(ident));
+	do_log2(level, "Connection: %s (pid %ld)", ident, (long)getpid());
+	open = oopen = channel_open_message(ssh);
+	while ((cp = strsep(&open, "\r\n")) != NULL) {
+		if (*cp != '\0')
+			do_log2(level, "%s", cp);
+	}
+	free(oopen);
+}
+
 static void
 open_preamble(struct ssh *ssh, const char *where, Channel *c, const char *type)
 {
diff --git a/channels.h b/channels.h
index 134528d59..1bfade4c5 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.h,v 1.158 2024/10/13 22:20:06 djm Exp $ */
+/* $OpenBSD: channels.h,v 1.159 2025/08/18 03:28:02 djm Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
@@ -344,6 +344,7 @@ int      channel_still_open(struct ssh *);
 int	 channel_tty_open(struct ssh *);
 const char *channel_format_extended_usage(const Channel *);
 char	*channel_open_message(struct ssh *);
+void	 channel_report_open(struct ssh *, int);
 int	 channel_find_open(struct ssh *);
 
 /* tcp forwarding */

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list