-
Notifications
You must be signed in to change notification settings - Fork 74
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
Unknown NtStatus error returned 'STATUS_FS_DRIVER_REQUIRED' #242
Comments
What is the service you are using here, is it a Windows DFS implementation/something else? I've seen a few reports for this but was never able to figure out what was happening. Typically you see |
Yes, sadly this is not a share that I set up. This is the result of
|
Thanks for the info, can you share the SMB server implementation, i.e. is it Samba, some NAS box? Can you try out this low level code to see what happens? import uuid
from smbprotocol.connection import Connection
from smbprotocol.tree import TreeConnect
from smbprotocol.session import Session
from smbprotocol.open import (
Open,
ImpersonationLevel,
FileAttributes,
FilePipePrinterAccessMask,
ShareAccess,
CreateDisposition,
)
server = "server-name"
username = "adminuser"
password = "mypassword"
share = "share"
path = r"builds\path\to\remote\file.zip"
c = Connection(uuid.uuid4(), server)
c.connect()
try:
print(f"Connection - Capabilities: {c.server_capabilities}")
s = Session(c, username, password)
s.connect()
t = TreeConnect(s, rf"\\{server}\{share}")
t.connect()
print(f"Tree - IsDfsShare {t.is_dfs_share}")
o = Open(t, path)
o.create(
impersonation_level=ImpersonationLevel.Impersonation,
desired_access=FilePipePrinterAccessMask.FILE_READ_DATA,
file_attributes=FileAttributes.FILE_ATTRIBUTE_NORMAL,
share_access=ShareAccess.FILE_SHARE_READ,
create_disposition=CreateDisposition.FILE_OPEN,
create_options=0,
create_contexts=None,
)
print("File opened")
finally:
c.disconnect() Comparing it with one that works would also be great. If this does fail what happens if you do |
@jborean93 Thanks for the help, here are the results using the known good and known bad share. Known bad (same result with
Known good (same result with
|
The extra flag added on a request when the tree connect has marked it as a DFS share was introduced with #190 which was designed to replicate the Windows behaviour for the issue #170. I'm not really sure what the best thing to do here, it seems like some server like this while others do not. You could use Wireshark to see how Windows opens the same file as well other macOS' SMB client does as well. Comparing them all to see what flags are set for the request and how they handle things would definitely help to see what the next steps should be. |
Do you have any quick resources I can reference for checking the request in Wireshark? It has been a few years 😅 |
Essentially install Wireshark and capture port 445. You want to compare the headers for the TreeConnect and Open requests. The code I gave you lets you do it with smbprotocol, for macOS you can have a look at mounting the path and doing a |
Ah my apologies, I forgot smbprotocol defaults to enabling encryption. You can disable it to see the same Tree and Open/Create packets by doing |
Thanks, that did it. So now the only difference is in the Create Response packet from the server. Although other than the error code, the flag fields match.
Another thing I noticed is it seems to only be an issue in this directory. Other directories on the same share don't have the error.
|
Have you compared the flags on the header part of the message? It seems like having the The |
All requests have the flag (when is_dfs_share == True) but same result when the flag is not set.
All responses always:
Mac + windows CLI utility do not use the |
I think I'm going to have to play around with some DFS scenarios a bit more and get a better understanding of |
Anything I can do to help here? After printing out some debug messages I have found that the following line causes the unknown exception. Line 307 of
Are there any changes to |
Sorry I haven't gotten back to this, I just haven't found the time needed to dig into the SMB protocol. Ultimately there's a problem in how I interpret the |
No worries, in the meantime I am happy to help provide debug info if needed. |
Could it be due to path normalization required by dfs?
|
Yea the problem is that the request from smbprotocol is including |
Hi I'm trying to jump back into this issue and figure out the problem once and for all. If you still have the environment around and are willing to test things it would be great if you could share the following:
I'm trying to setup a similar environment to test out so I can play around with it all but Windows seems to handle whatever I throw at it just fine. |
I don't know if it will solve the issue in your case but #253 makes setting this flag a bit more selective and maybe will help you. If you get time to test it out that would be great. |
I have tried #253 with no luck ( |
That's a pity.
So something is going on with the referral process that's causing it to send the the open to potentially the DFS server(?) causing it to fail. Unfortunately at this point in time I still cannot replicate it in my environment so short of seeing the network traces there's not much else I can do here. I essentially need to compare the network operations likes
Unless you can share more about the network environment such as the DFS servers used, the namespace and target setup, target paths, etc so I can potentially replicate it I'm nearing the end of my abilities here sorry. |
No worries, thank you so much for all the help! |
I am running into the following issue when trying to copy a file from a DFS share.
The code is:
I use this code to copy many files and it seems to only throw this error with one share. When I mount via the CLI, I can copy the file manually.
Thanks in advance!
The text was updated successfully, but these errors were encountered: