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

smb2_get_error "Tree Connect failed with (0xc0000022) STATUS_ACCESS_DENIED" while using negotiate version 0311 to connect some linux servers. #209

Open
Arlen-LT opened this issue Aug 7, 2021 · 2 comments

Comments

@Arlen-LT
Copy link

Arlen-LT commented Aug 7, 2021

I pull from commit d8c85a3. My code is:

    smb2_context* smb2 = smb2_init_context();
    smb2_set_security_mode(smb2, SMB2_NEGOTIATE_SIGNING_ENABLED);
    smb2_set_timeout(smb2, 3);
    int ret = smb2_connect_share(smb2, ip, share, userID, password);
    if(ret < 0)
    {
        Log("%s\n", smb2_get_error(smb2));
        smb2_disconnect_share(smb2);
        smb2_destroy_context(smb2);
        smb2 = nullptr;
    }

and the error message is Tree Connect failed with (0xc0000022) STATUS_ACCESS_DENIED.
I tried to use smb2_set_version(smb2, SMB2_VERSION_0302); or any other negotiate version below SMB2_VERSION_0311 and connect successfully.
Could someone give me some advice? Thanks a lot.

@sahlberg
Copy link
Owner

sahlberg commented Aug 7, 2021 via email

@Arlen-LT
Copy link
Author

Arlen-LT commented Aug 7, 2021

On Sat, Aug 7, 2021 at 9:56 PM Arlen-LT @.**> wrote: I pull from commit d8c85a3 <d8c85a3>. My code is: smb2_context smb2 = smb2_init_context(); smb2_set_security_mode(smb2, SMB2_NEGOTIATE_SIGNING_ENABLED); smb2_set_timeout(smb2, 3); int ret = smb2_connect_share(smb2, ip, share, userID, password); if(ret < 0) { Log("%s\n", smb2_get_error(smb2)); smb2_disconnect_share(smb2); smb2_destroy_context(smb2); smb2 = nullptr; } and the error message is Tree Connect failed with (0xc0000022) STATUS_ACCESS_DENIED. I tried to use smb2_set_version(smb2, SMB2_VERSION_0302); or any other negotiate version below SMB2_VERSION_0311 and connect successfully. Could someone give me some advice? Thanks a lot.
Access denied is an error from the server, it means that the user you authenticate as does not have permission to access the share.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#209>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADY3EH7OJAIZRQUHXB4SNTT3UNQLANCNFSM5BXK3JTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

When I set the negotiate version as SMB2_VERSION_0302, everything works well with the same server and the same share, this is just happening while using Anonymous.
For example, my server allows Anonymous have permission to connect.
And in the past, this means I can use any userID and password to connect the server, for example:
smb2_connect_share(smb2, ip, share, "123", "123")
but if I use SMB2_VERSION_0311, I can use any userID as well, but only with the password "", for example:
smb2_connect_share(smb2, ip, share, "123", "")
Only by this way can I access my win10 smb server. But my ubuntu smb server told me STATUS_ACCESS_DENIED.

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