rapid7 / ruby_smb

A native Ruby implementation of the SMB Protocol Family
Other
79 stars 82 forks source link

Fix wipe_state! crash #194

Closed adfoster-r7 closed 2 years ago

adfoster-r7 commented 2 years ago

Fixes a crash within wipe_state!

Module Exception: undefined method `session_is_guest=' for #<RubySMB::Client:0x00007fe2cda07258 dispatcher=#<RubySMB::Dispatcher::Socket:0x00007fe2cda07410 tcp_socket=#<Socket:fd 30>, read_timeout=30>, pid=8944, domain="WORKSTATION", local_workstation="WORKSTATION", ... etc ...> Did you mean? session_request

Previous error:

  2) RubySMB::Client#wipe_state! with SMB1 is expected not to raise Exception
     Failure/Error: it { expect { smb1_client.wipe_state! }.to_not raise_error }

       expected no Exception, got #<NoMethodError: undefined method `session_is_guest=' for #<RubySMB::Client:0x00007fd9e6959a08>
       Did you mean?  session_request> with backtrace:
         # ./lib/ruby_smb/client.rb:600:in `wipe_state!'
         # ./spec/lib/ruby_smb/client_spec.rb:562:in `block (5 levels) in <top (required)>'
smcintyre-r7 commented 2 years ago

We probably want to add the missing attr_accessor for session_is_guest so it can be read and written externally. It looks like the crash is because that's missing.

adfoster-r7 commented 2 years ago

I originally assumed it was an intentional decision to not make it externally configurable, will patch :+1:

adfoster-r7 commented 2 years ago

@smcintyre-r7 Patched up :+1: