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

OSX smb_fopen with "/" at the beginning of the file path #73

Open
shaybc opened this issue Apr 30, 2016 · 5 comments
Open

OSX smb_fopen with "/" at the beginning of the file path #73

shaybc opened this issue Apr 30, 2016 · 5 comments
Labels

Comments

@shaybc
Copy link

shaybc commented Apr 30, 2016

hello,

if i call the smb_fopen method with file path of this form: "/test.txt" in read mode on OS X share, i receive a -2 error code (Failed to open file: /test.txt)

failed code sample:
const chat * fileNameAndPath = "/test.txt";
int openFileResult = smb_fopen(smbSession, shareID, fileNameAndPath, SMB_MOD_RO, &fileDescriptor);

but if i remove the first "/" and call it like this:

success code sample:
const chat * fileNameAndPath = "test.txt";
int openFileResult = smb_fopen(smbSession, shareID, fileNameAndPath, SMB_MOD_RO, &fileDescriptor);

if i try this on a windows share it will work both ways!

my end code simply strip the first "/" from all calls (since OS X and Windows can handle it),

i would love it if the bug was found and fixed (or that someone will prove me wrong),

Thanks,
Shay.BC.

@jbkempf
Copy link
Contributor

jbkempf commented May 8, 2016

But the file is named test.txt?

@shaybc
Copy link
Author

shaybc commented May 18, 2016

yes, the file name is test.txt
ofcource if i have a longer path it will behave the same, for instance:
/folder1/folder2/test.txt
will work only if i will set it to:
folder1/folder2/test.txt

so the working code is:
const chat * fileNameAndPath = "folder1/folder2/test.txt";
int openFileResult = smb_fopen(smbSession, shareID, fileNameAndPath, SMB_MOD_RO, &fileDescriptor);

@jbkempf
Copy link
Contributor

jbkempf commented May 19, 2016

well / would be the root of the server, so I'm not surprised. Not sure if it is a bug, though

@shaybc
Copy link
Author

shaybc commented May 20, 2016

but you need to be able to set path to the root and relate to folder and files from there, this is a bug, every implementation using your (wonderful) lib - removes the leading "/", i don't think this is the way it should be,

but at least its not a unsolvable bug.

@jbkempf
Copy link
Contributor

jbkempf commented May 27, 2016

Fair enough.

@jbkempf jbkempf added the bug label May 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants