go-smb2
go-smb2 copied to clipboard
Invalid response error: invalid negotiate flags
I'm having problems with connecting to the smb server when I run smbDialer.Dial(conn). It reports invalid response error: invalid negotiate flags.
conn, err := net.Dial("tcp", "123.123.123.123:445")
if err != nil {
fmt.Println(err)
return
}
defer conn.Close()
smbDialer := &smb2.Dialer{
Initiator: &smb2.NTLMInitiator{
User: "myusername",
Password: "mypassword",
Domain: "NTADMIN",
},
}
smbSession, err := smbDialer.Dial(conn)
if err != nil {
fmt.Println(err) // error reported here
return
}
defer smbSession.Logoff()
After digging into the source code, I found the error is from this if statement: https://github.com/hirochachacha/go-smb2/blob/6569ee9e2547186eadde5cc7686551107183ec9e/internal/ntlm/client.go#L83-L85
After commenting out this if statement, I can connect to the smb server and read files no problem.
Looks like this is the part of the NegotiateFlags field. Will it have any security concerns if I comment out this if statement as a quick fix on my side?
Can you please let me know how I can debug this better for you to diagnose the problem? I'm happy to provide more information if needed.
Facing the same issue, any update or comments on this?
Users have seen this problem in the SMB backend in rclone.
https://github.com/rclone/rclone/issues/6659
It seems to be maybe problems interacting with embedded SMB agents?