Closed DanskerDave closed 1 year ago
Thumbs up as this made me spend a lot of time until I came across this issue: https://github.com/hierynomus/smbj/issues/166
Thumbs up as this made me spend a lot of time until I came across this issue: #166
Its certainly quite unique in my 45 years or so in this business: first time I've ever experienced a file opened with read intent being overwritten!
I've merged a fix to the master
branch.
When opening a file, the default
SMB2CreateDisposition
seems to be to delete its contents. Thats scary! As far as I can see, the default isSMB2CreateDisposition.FILE_SUPERSEDE
.A couple of Issues.:
SMB2CreateDisposition.FILE_OPEN
. Then a file would only be created or overwritten if explicitly requested. That would seem to be the safest.My code follows below...
All the best, Dave