TalAloni / SMBLibrary

Free, Open Source, User-Mode SMB 1.0/CIFS, SMB 2.0, SMB 2.1 and SMB 3.0 server and client library
GNU Lesser General Public License v3.0
732 stars 185 forks source link

Renaming File to one Character #240

Closed musikantus49 closed 9 months ago

musikantus49 commented 9 months ago

Hi,

I want to use SMBLibrary to rename files on a SMBServer. Sometimes the new name for the files only consists of one character, which leads to a total SetInfo Request of 22 bytes. The SMB2 protocol needs the SetInfo Request always to have at least 24 bytes. Therefore, a padding field should exist in the request.

See: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/52aa0b70-8094-4971-862d-79793f41e6a8

I think that should be solved by checking if the new filename has only a length of 1. If that is the case, the Length property in FileRenameInformationType2 has to be 24 and the requests need to extra bytes.

TalAloni commented 9 months ago

Thanks, pushed fix to master