diff options
Diffstat (limited to 'clientloop.c')
| -rw-r--r-- | clientloop.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/clientloop.c b/clientloop.c index 6a0e7b6b8234..49950ceccfe0 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.422 2026/03/05 05:40:35 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.425 2026/07/01 01:08:51 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -107,6 +107,8 @@ /* Uncertainty (in percent) of keystroke timing intervals */ #define SSH_KEYSTROKE_TIMING_FUZZ 10 +extern char *__progname; + /* import options */ extern Options options; @@ -1594,8 +1596,12 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg, if (sigprocmask(SIG_BLOCK, &bsigset, &osigset) == -1) error_f("bsigset sigprocmask: %s", strerror(errno)); if (siginfo_received) { + char ident[256]; + + sshpkt_fmt_connection_id(ssh, ident, sizeof(ident)); + logit("%s: connection to %s, up %.1f seconds", + __progname, ident, monotime_double() - start_time); siginfo_received = 0; - channel_report_open(ssh, SYSLOG_LEVEL_INFO); } if (quit_pending) break; @@ -2711,7 +2717,7 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem, { size_t i, j, len; int matched, r; - char *name, *val; + char *type = NULL, *cmdstring = NULL, *name, *val; Channel *c = NULL; debug2_f("id %d", id); @@ -2786,19 +2792,21 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem, len = sshbuf_len(cmd); if (len > 0) { + if ((cmdstring = sshbuf_dup_string(cmd)) == NULL) + fatal_f("sshbuf_dup_string failed"); if (len > 900) len = 900; if (want_subsystem) { - debug("Sending subsystem: %.*s", - (int)len, (const u_char*)sshbuf_ptr(cmd)); + debug("Sending subsystem: %.*s", (int)len, cmdstring); channel_request_start(ssh, id, "subsystem", 1); client_expect_confirm(ssh, id, "subsystem", CONFIRM_CLOSE); + xasprintf(&type, "session:subsystem:%s", cmdstring); } else { - debug("Sending command: %.*s", - (int)len, (const u_char*)sshbuf_ptr(cmd)); + debug("Sending command: %.*s", (int)len, cmdstring); channel_request_start(ssh, id, "exec", 1); client_expect_confirm(ssh, id, "exec", CONFIRM_CLOSE); + xasprintf(&type, "session:command"); } if ((r = sshpkt_put_stringb(ssh, cmd)) != 0 || (r = sshpkt_send(ssh)) != 0) @@ -2808,7 +2816,11 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem, client_expect_confirm(ssh, id, "shell", CONFIRM_CLOSE); if ((r = sshpkt_send(ssh)) != 0) fatal_fr(r, "send shell"); + xasprintf(&type, "session:shell"); } + channel_set_xtype(ssh, id, type); + free(cmdstring); + free(type); session_setup_complete = 1; client_repledge(); |
