-
Notifications
You must be signed in to change notification settings - Fork 135
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_rename move files to a non-root directory failed. #218
Comments
All the paths should be relative to the root of the share if I recall correctly. Please try current master, it has an example utility that uses smb2_rename() On my server, I created two directories src and dst and in src I created a file called hello. Can you try that? |
Thank you. I've tried and it still failed. Possibly it conflicts with my security engine(cannot be removed). For example, using smb2_mkdir() to create a directory that already exists should return STATUS_OBJECT_NAME_COLLISION or what, but smb2_get_error() got NULL. In fact in my project it got nothing except STATUS_INVALID_PARAMETER while the wireshark could always capture them. |
@sahlberg I'm also facing an issue with rename. I rename a file in the same directory. example: Rename from "testfolder/testfile.txt" to "testfolder/rename.txt" and is fails. smb2_get_error returns an empty string. Return code = -5 Edit: After more testing, this is only a problem with Windows shares in Win 7/10 and 11. Samba on Linux doesn't have this problem. |
I have pushed a fix for this to the master branch now. |
If "smb moves a file from a non-root directory tmp to dst" is needed, what should I do?
The api is:
int smb2_rename(struct smb2_context *smb2, const char *oldpath, const char *newpath)
Environment: directories are in Windows10, project running in Redhat 8.
Problem:
I created 2 directories -- "tmp" and "dst" -- in the root directory, and transfered a file "test.txt" to the "tmp" successfully. Then I mv "test.txt" to directory "dst" ended with failure. What confused me is, when I tried to mv "test.txt" to root, it worked.
This shows how I use the api(smb2_connect_share was established with the smb2_context *smb2).
2.mv "test.txt" to root:
``
I have limited knowledge of protocol smb, so it may be silly that I conjecture that in smb2_rename_async, the parameter newpath meant the file's name and it always mv the file to the root directory, rather than the full path, which differed from oldpath. In this case, when I tried to mv test.txt from directory tmp to dst, the system sought to mv test.txt to root and rename the file with dst/test.txt actually.
Therefore, if "smb moves a file from a non-root directory tmp to dst" is needed, what should I do?
The text was updated successfully, but these errors were encountered: