-
Notifications
You must be signed in to change notification settings - Fork 73
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
smbclient.shutil.copy*() should fallback if server side SMB copy isn't available #232
Comments
I am not sure this is supported... by a quick read of the code, I don't see how you can pass the dialect. |
Unfortunately there is no way of doing so with the high level API. Typically this shouldn't be needed at all and might be a sign that this library is doing something incorrect that causing a failure. Does Windows work normally when talking to the NAS? Can you potentially get a network capture of both smbprotocol and Windows so I could try and find some differences. I would prefer to fix the problem in this library (if there is one) rather than having people downgrade to older and more insecure dialects. |
Yes, from Windows a regular copy works. I tried copy(), copy2() and copyfiles() from smbconnection.shutil, and all of them fail the same way. Regular open_file()/read/write operations from smbclient work without problems. I will try to get a network capture from Windows, but I doubt I will be able to (it's a locked down corporate environment). Looking at the trace from Linux/smbprotocol I did not see any obvious problems. I just know that these Hitachi NAS are not always 100% compliant when it comes to SMB standards. Or to put it better - the NAS have so many obscure knobs to configure things, that our NAS team sometimes has troubles finding the right combination. They already informed me that due to issues with some other SMB client (not smbprotocol) they had to configure the NAS to support at most SMB_2_1_0. This is also what I see in the in the DEBUG logs
It's going to take me some time to get a capture and have it reviewed to be able to post it here, but I'll try Thanks for your quick and insightful response! |
If the error is around copying only it could be that the NAS doesn't support the copyfile mechanism which utilises the server side copy IOCTL operation. The What you can do to test this out is to see if import smbclient
from smbclient.shutilimport copyfileobj
src = smbclient.open_file("...", mode="rb")
dst = smbclient.open-file("...", mode="wb")
# You can also just use shutil.copyfileobj as well for this
copyfileobj(src, dst) If this is truly the case, the |
Hi Jordon Sure enough that is exactly the problem! copy'ing with copyfileobj() works :-) Once again I'm just blown away by the speed and quality of your support! I wished we'd get just a 10th of that quality on some subscriptions that the company is paying tens of thousands for... I'll take it up with our NAS team, if there is any way to enable that mechanism on the server side. Sometimes they just need a little nudge to get things going. I'm closing this ticket, the answer is perfect for me! |
Thanks you for your kind words, I really do appreciate it.
It depends on whether the NAS software has implemented the custom feature or not. If it's there it would need to be enabled, if not it would be up to the manufacturer to implement it for you. |
I am going to keep this open because the copy methods in |
I'm experiencing
STATUS_NOT_SUPPORTED: 0xc00000bb
errors on somesmbclient.shutil
file operations (copy mostly) very similar to the ones described in #72 . I tried settingsmbclient.ClientConfig(require_secure_negotiate=False)
but this didn't help.I presume the errors happens because some of our company SMB servers (Hitachi NAS) are pretending to support SMB 3, but apparently don't fully do so. I wanted to try to downgrade the high level client to only use SMB_2_1_0, but failed to find a way how to do this?
It seems easy with the low level API with
connection.connect(Dialects.SMB_2_1_0)
, but how do I do the same with the smbclient high level API?The text was updated successfully, but these errors were encountered: