]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: correctly set extended type for client-side channels. master anongit/master
authordjm@openbsd.org <djm@openbsd.org>
Sun, 19 Apr 2026 23:37:22 +0000 (23:37 +0000)
committerDamien Miller <djm@mindrot.org>
Sun, 19 Apr 2026 23:38:26 +0000 (09:38 +1000)
Fixes interactive vs bulk IPQoS for client->server traffic. ok job@

OpenBSD-Commit-ID: 34f5131face8d6dc4ae6955196e5fcafb3570cfe

clientloop.c

index 6a0e7b6b82348268aab93ff46fbd97a4874f43cc..8f9d16ca867cfb881073d2cdac69858cc5ea1220 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.422 2026/03/05 05:40:35 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.423 2026/04/19 23:37:22 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2711,7 +2711,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 +2786,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 +2810,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();