summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2023-01-06 02:42:35 +0000
committerDamien Miller <djm@cvs.openbsd.org>2023-01-06 02:42:35 +0000
commit3198280fe232d181851903461553beabd4293d59 (patch)
tree65bef955a569f946ce3d9b2fc05b5dceced01c35 /usr.bin/ssh/session.c
parent82fcd474e4a22ff5964de9c80e6354f6998e7327 (diff)
Add channel_set_xtype()
This sets an "extended" channel type after channel creation (e.g. "session:subsystem:sftp") that will be used for setting channel inactivity timeouts. ok markus dtucker
Diffstat (limited to 'usr.bin/ssh/session.c')
-rw-r--r--usr.bin/ssh/session.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index 95f19d44c85..8d9bd02d45c 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.332 2023/01/06 02:41:49 djm Exp $ */
+/* $OpenBSD: session.c,v 1.333 2023/01/06 02:42:34 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1637,7 +1637,7 @@ session_subsystem_req(struct ssh *ssh, Session *s)
{
struct stat st;
int r, success = 0;
- char *prog, *cmd;
+ char *prog, *cmd, *type;
u_int i;
if ((r = sshpkt_get_cstring(ssh, &s->subsys, NULL)) != 0 ||
@@ -1660,6 +1660,10 @@ session_subsystem_req(struct ssh *ssh, Session *s)
s->is_subsystem = SUBSYSTEM_EXT;
debug("subsystem: exec() %s", cmd);
}
+ xasprintf(&type, "session:subsystem:%s",
+ options.subsystem_name[i]);
+ channel_set_xtype(ssh, s->chanid, type);
+ free(type);
success = do_exec(ssh, s, cmd) == 0;
break;
}
@@ -1715,6 +1719,9 @@ session_shell_req(struct ssh *ssh, Session *s)
if ((r = sshpkt_get_end(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
+
+ channel_set_xtype(ssh, s->chanid, "session:shell");
+
return do_exec(ssh, s, NULL) == 0;
}
@@ -1729,6 +1736,8 @@ session_exec_req(struct ssh *ssh, Session *s)
(r = sshpkt_get_end(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
+ channel_set_xtype(ssh, s->chanid, "session:command");
+
success = do_exec(ssh, s, command) == 0;
free(command);
return success;