]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: add channel_report_open() to report (to logs) open
authordjm@openbsd.org <djm@openbsd.org>
Mon, 18 Aug 2025 03:28:02 +0000 (03:28 +0000)
committerDamien Miller <djm@mindrot.org>
Mon, 18 Aug 2025 03:50:30 +0000 (13:50 +1000)
channels; ok deraadt@ (as part of bigger diff)

OpenBSD-Commit-ID: 7f691e25366c5621d7ed6f7f9018d868f7511c0d

channels.c
channels.h

index 0efbd8d174c7d838f70705006c953ec611d9bcc8..9d56310172f3971846ac1abde0c8a26996de8933 100644 (file)
@@ -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@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@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)
 {
index 134528d59c725aba5018dfc55758723697dd9a85..1bfade4c5c77ba6357d3302c86a652224df03163 100644 (file)
@@ -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@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 */