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

Sessionid smb202 #94

Open
Himantono opened this issue Dec 10, 2024 · 0 comments
Open

Sessionid smb202 #94

Himantono opened this issue Dec 10, 2024 · 0 comments

Comments

@Himantono
Copy link

First of all, thank you for the go-smb2. It works good. I cross against a small issue with smb202 server. Sessionid for smb202 is only set by the server if the status is success. If status more proccessing required, sessionid is 0.
I am able to make it working with this changes in session.go. Maybe it is not in the correct place.

func (s *session) recv(rr *requestResponse) (pkt []byte, err error) {
pkt, err = s.conn.recv(rr)
if err != nil {
return nil, err
}
// Added for SMB202, session id is only send if status success
if s.conn.dialect == SMB202 && s.sessionId == 0 && PacketCodec(pkt).Status() == uint32(STATUS_SUCCESS) {
s.sessionId = PacketCodec(pkt).SessionId()
}
if sessionId := PacketCodec(pkt).SessionId(); sessionId != s.sessionId {
return nil, &InvalidResponseError{fmt.Sprintf("expected session id: %v, got %v", s.sessionId, sessionId)}
}
return pkt, err
}

So maybe you can integrate it with your repository or put it in the correct place. Thank you.

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

1 participant