From f9decd3daef6375a2c171628c512da4a749798a9 Mon Sep 17 00:00:00 2001 From: cgranleese-r7 Date: Fri, 15 Mar 2024 12:03:38 +0000 Subject: [PATCH] Adds EOFError raise for when a session is dead --- lib/ruby_smb/client.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ruby_smb/client.rb b/lib/ruby_smb/client.rb index ebb35b728..9092fa5be 100644 --- a/lib/ruby_smb/client.rb +++ b/lib/ruby_smb/client.rb @@ -575,6 +575,9 @@ def recv_packet(encrypt: false) begin raw_response = dispatcher.recv_packet rescue RubySMB::Error::CommunicationError => e + # If raw_response is nil the connection is dead + raise EOFError if raw_response.nil? + if encrypt raise RubySMB::Error::EncryptionError, "Communication error with the "\ "remote host: #{e.message}. The server supports encryption but was "\