Skip to content

Commit

Permalink
More advanced DFS compatibility checks
Browse files Browse the repository at this point in the history
Avoid setting the SMB2_FLAGS_DFS_OPERATIONS flag in the SMB header if
the server did not report it as supporting DFS operations during the
negotiation phase. This should hopefully fix up some problems when the
server errors in the case it doesn't support DFS operations.
  • Loading branch information
jborean93 committed Nov 25, 2023
1 parent 37512ee commit 0607a20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* This avoid having to call `stat()` to retrieve data like the file attributes or datetime fields that is already available
* Ensure `DateTimeField` values are set to `UTC` timezones as FILETIME values are in UTC
* Stop using `datetime.datetime.utcfromtimestamp()` as it has been deprecated
* Avoid setting DFS request when the server does not report it is capable of DFS operations.

## 1.12.0 - 2023-11-09

Expand Down
2 changes: 1 addition & 1 deletion src/smbprotocol/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ def _send(
if tree_id not in session.tree_connect_table:
raise SMBException("Cannot find Tree with the ID %d in the session tree table" % tree_id)
tree = session.tree_connect_table[tree_id]
is_dfs = tree.is_dfs_share
is_dfs = self.server_capabilities.has_flag(Capabilities.SMB2_GLOBAL_CAP_DFS) and tree.is_dfs_share

Check warning on line 1201 in src/smbprotocol/connection.py

View check run for this annotation

Codecov / codecov/patch

src/smbprotocol/connection.py#L1201

Added line #L1201 was not covered by tests

total_requests = len(messages)
for i, message in enumerate(messages):
Expand Down

0 comments on commit 0607a20

Please sign in to comment.