CloudSoda / go-smb2

Client implementation of the SMB 2 & 3 protocols
BSD 2-Clause "Simplified" License
13 stars 5 forks source link

Updated Dialer.Dial* methods to fix Mount() related bugs and improve usability #19

Closed arashpayan closed 11 months ago

arashpayan commented 11 months ago

The TREECONNECT command requires a share path (\servername\sharename) as an argument, but when calling Mount() users typically just pass in the share name. When that happens, go-smb2 creates a share path using the IP address of the tcpConn that was passed to it and the share name, but this sometimes creates problems for servers that expect the original fully qualified domain name of the server in the server name component of the share path.

To address this, this commit replaces the existing Dialer.Dial methods with versions that are harder to use incorrectly. The new methods also require an address argument so when a full share path is not passed to Mount(), the address value from Dial will be used as the servername in the share path.