Skip to content

Propagate missing session params#332

Merged
jborean93 merged 1 commit intojborean93:masterfrom
SuperBuker:feature/propagate-missing-session-params
Feb 3, 2026
Merged

Propagate missing session params#332
jborean93 merged 1 commit intojborean93:masterfrom
SuperBuker:feature/propagate-missing-session-params

Conversation

@SuperBuker
Copy link
Contributor

Issue:
Some register_session parameters are not being propagated through get_smb_tree, which limits their usage.

Changelog:

  • Adding auth_protocol and require_signing to the get_smb_tree connection kwargs.

@SuperBuker
Copy link
Contributor Author

Hi,

I've noticed that the project code usually makes use of $a or $b to check if the provided value $a is not None.
Sadly, this code effectively returns $b if $a is also one of the following: str(), bool(), int(), float(), list(), dict() and set(), which can lead to undesired side effects.

I've written the code using $a or $b, but I strongly suggest to avoid this pattern and replace it with $a if $a is not None else $b even if it's ugly.

Thanks in advance.

All the best,
Jorge

@adiroiban
Copy link
Contributor

adiroiban commented Jan 26, 2026

Thanks, Jorge, for the changes. They look good.

This is just a 3rd party review. I am not the maintainer of this project.
Just trying to do some review so that Jordan will have less work.


I think that these are important changes and they are worth a mention in the release notes.
I think that this PR should also update

https://github.com/jborean93/smbprotocol/blob/master/CHANGELOG.md


Regarding:

auth_protocol = auth_protocol or client_config.auth_protocol

I think that for the new code, we can start using better practices.
Yes, it will not be consistent with the existing code, but at least the new code will be of a better quality/safety.
I think that code safety should come first, and consistenty second.


Would it be possible to add some tests to make sure that these arguments work as expected and that we will not introduce regression with future refactoring ?

Thanks again

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.03%. Comparing base (1ca44b1) to head (8f8c4e6).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #332   +/-   ##
=======================================
  Coverage   99.03%   99.03%           
=======================================
  Files          24       24           
  Lines        5177     5177           
=======================================
  Hits         5127     5127           
  Misses         50       50           
Flag Coverage Δ
macOS 68.18% <100.00%> (ø)
py3.10 98.99% <100.00%> (ø)
py3.11 98.99% <100.00%> (ø)
py3.12 98.99% <100.00%> (ø)
py3.13 98.99% <100.00%> (ø)
py3.14 98.99% <100.00%> (ø)
py3.9 99.03% <100.00%> (ø)
ubuntu 96.83% <100.00%> (ø)
windows 98.95% <100.00%> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jborean93
Copy link
Owner

I really need to sit down and think of a better way to provide these options vs trying to smuggle them through the kwargs but for now this is what's already there and I cannot see any harm in passing through these extra ones.

While using var if var is not None else default might be strictly better in these cases an empty string for auth_protocol is invalid so using the truthy or way to use the default is ok in my opinion. The whole session management really needs an overhaul but I just don't have the time right now to think off a better one while keeping some form of backwards compatibility.

@jborean93 jborean93 merged commit d74570f into jborean93:master Feb 3, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants