Skip to content

Conversation

@buttercookie42
Copy link

@buttercookie42 buttercookie42 commented Nov 3, 2024

This is a tentative fix for issue #18.

The idea is to track the dirty state of the last modified date via a boolean on the NetworkFile, so incrementing the write counter sets the flag to dirty and manually updating the last modified date sets it back to clean, and then on file close the last modified date is only automatically updated if it's marked as dirty.

It's not completely perfect, because it seems that depending on the caller it's not always possible to retrieve the corresponding NetworkFile from inside a DiskInterface.setFileinformation call, and therefore reset the tracking flag back to clean, but at least for SMBv1 traffic from a Windows client it seems to work fine. (Hopefully it'd also work for the SMBv2 implementation, because I can't test that one.)

The NTProtocolHandler already does this when a NetworkFile object is available,
so for consistency do this in the CoreProtocolHandler, too.
Incrementing the write count on a network file marks the last modified date as
dirty. In order to reset the flag back to clean, we need to attempt applying any
date changes happening via setFileInformation() to the corresponding network
file, too.
…irty

Also just to be on the safe side, update the network file, too, in order to
reset the tracking flack back to clean.
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.

1 participant