jborean93 / smbprotocol

Python SMBv2 and v3 Client
MIT License
316 stars 73 forks source link

Fix intermediate session id preauth tracking #203

Closed jborean93 closed 1 year ago

jborean93 commented 1 year ago

On some hosts, the SESSION_SETUP_RESPONSE message that are not complete may not set the new session id on the response. This causes problems when the session is finalised as it tries to lookup the session based on the session id allocated in the last message which won't line up with any intermediate messages with a session id of 0.

The fix is to not update the session id tracker for the first SESSION_SETUP_RESPONSE message but rather the last message where the session id will actually be allocated.

Fixes: https://github.com/jborean93/smbprotocol/issues/193

codecov[bot] commented 1 year ago

Codecov Report

Merging #203 (d38d6c1) into master (f1ca936) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #203   +/-   ##
=======================================
  Coverage   99.07%   99.07%           
=======================================
  Files          24       24           
  Lines        5082     5082           
=======================================
  Hits         5035     5035           
  Misses         47       47           
Flag Coverage Δ
99.07% <100.00%> (ø)
py3.10 99.03% <100.00%> (ø)
py3.11 99.03% <100.00%> (ø)
py3.7 99.03% <100.00%> (ø)
py3.8 99.03% <100.00%> (ø)
py3.9 99.07% <100.00%> (ø)
x64 99.07% <100.00%> (ø)
x86 98.99% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/smbprotocol/session.py 95.18% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.