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

SMB3 fails to sign when path is delimited by slash #46

Closed
amosavian opened this issue May 25, 2018 · 9 comments
Closed

SMB3 fails to sign when path is delimited by slash #46

amosavian opened this issue May 25, 2018 · 9 comments

Comments

@amosavian
Copy link
Contributor

amosavian commented May 25, 2018

HI,

When I try to connect to my macOS smb server which is SMB 3.02, All / delimiters in path must be replaced by \ otherwise the operation will fail with Failure to add signature message.

EDIT: This issue is limited to macOS 10.13.4 High Sierra. Windows 10 and Samba on Linux has no issue with dialect 3.02 signing.

@sahlberg
Copy link
Owner

Pushed a fix for this to master. Please test.

@amosavian
Copy link
Contributor Author

amosavian commented May 27, 2018

While this converting is something that must be done, I'm afraid there is an underlying cause.

I've noticed this line

smb2_set_error(smb2, "Failure to add "

is overriding underlying error description set by this function
smb2_pdu_add_signature(struct smb2_context *smb2,

I suggest removing this override to allow me to find underlying issue, the only thing you must do after that is to set an error description before this line:

return -1;

Thanks

UPDATE: Indeed Microsoft insists to do this replacing check here

@sahlberg
Copy link
Owner

Good analysis.
Can you please send me a pull request for this change so that you get
proper credit in the git log ?

@amosavian
Copy link
Contributor Author

I did further investigation and I noticed you indeed added last error message to the new one and pass it as variadic argument. I thing there is a problem in handling valist in smb2_set_error(). Unfortunately I'm novice in C and don't know much about valists in c.

I can say asserting smb2->session_key_size == 0 is not problem as it is16.

By the way, your fixing commit is working as expected.

@sahlberg
Copy link
Owner

sahlberg commented May 28, 2018 via email

@amosavian
Copy link
Contributor Author

Yes you are right indeed.

About that srvsvc issue I've noticed the file handle would be nil when I try opening with write flag. I implemented async opening to get result and it was -13, which is permission denied. Seems I have to use fsctl for share enumerating for macOS otherwise it. would refuse.

Probably the commit you have pushed for this issue was the right one and already resolved underlying issue. Thus I close this issue.

By the way, macOS is not relying on Samba anymore and have its own smb3 server implementation, which you can find here

@sahlberg
Copy link
Owner

sahlberg commented May 28, 2018 via email

@amosavian
Copy link
Contributor Author

Thanks. After you implement fsctl, I will try to create a pull request with listing share ability based on my implementation.

@amosavian
Copy link
Contributor Author

@sahlberg listing share issue is not related to ioctl, I guess it's because overwrite flag set by smb2_open_async() when I try to open srvsvc pipe.

I will try to reimplement current listing share implementation in C.

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

2 participants