]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: all state related to the ssh connection should live in master anongit/master
authordjm@openbsd.org <djm@openbsd.org>
Wed, 6 Aug 2025 23:44:09 +0000 (23:44 +0000)
committerDamien Miller <djm@mindrot.org>
Wed, 6 Aug 2025 23:45:02 +0000 (09:45 +1000)
struct ssh or struct packet_state; one static int escaped this rule, so move
it to struct packet_state now.

ok millert tb

OpenBSD-Commit-ID: bd6737168bf61a836ffbdc99ee4803468db90a53

packet.c

index 9dea2cfc5188fb27c4ed6ebed0365defeae8a62e..7f67f4fcd55e8ee29f28e9be41ca0617f4b75158 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.318 2025/02/18 08:02:12 djm Exp $ */
+/* $OpenBSD: packet.c,v 1.319 2025/08/06 23:44:09 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -219,6 +219,12 @@ struct session_state {
        /* One-off warning about weak ciphers */
        int cipher_warning_done;
 
+       /*
+        * Disconnect in progress. Used to prevent reentry in
+        * ssh_packet_disconnect()
+        */
+       int disconnecting;
+
        /* Hook for fuzzing inbound packets */
        ssh_packet_hook_fn *hook_in;
        void *hook_in_ctx;
@@ -2064,12 +2070,12 @@ ssh_packet_disconnect(struct ssh *ssh, const char *fmt,...)
 {
        char buf[1024], remote_id[512];
        va_list args;
-       static int disconnecting = 0;
        int r;
 
-       if (disconnecting)      /* Guard against recursive invocations. */
+       /* Guard against recursive invocations. */
+       if (ssh->state->disconnecting)
                fatal("packet_disconnect called recursively.");
-       disconnecting = 1;
+       ssh->state->disconnecting = 1;
 
        /*
         * Format the message.  Note that the caller must make sure the