Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid response error: invalid negotiate flags #49

Open
Yihao-G opened this issue Sep 13, 2021 · 2 comments
Open

Invalid response error: invalid negotiate flags #49

Yihao-G opened this issue Sep 13, 2021 · 2 comments

Comments

@Yihao-G
Copy link

Yihao-G commented Sep 13, 2021

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:

if flags&NTLMSSP_REQUEST_TARGET == 0 {
return nil, errors.New("invalid negotiate flags")
}

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.

@cocmorph
Copy link

Facing the same issue, any update or comments on this?

@ncw
Copy link

ncw commented Dec 29, 2022

Users have seen this problem in the SMB backend in rclone.

rclone/rclone#6659

It seems to be maybe problems interacting with embedded SMB agents?

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

No branches or pull requests

3 participants