-/* $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
/* 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;
{
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