upstream: all state related to the ssh connection should live in

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
This commit is contained in:
djm@openbsd.org
2025-08-06 23:44:09 +00:00
committed by Damien Miller
parent 60b909fb11
commit 2ebc638425

View File

@@ -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