From fc5b6e4bd8a67994b0c56d1223c74d064164420f Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sun, 3 Sep 2006 01:37:26 +0000 Subject: [PATCH] r18012: Should fix bug 4018. NetApp filers expect paths in Open AndX Request to have a leading slash. Windows clients send the leading slash, so we should too. --- examples/libsmbclient/testread.c | 1 + source/libsmb/libsmbclient.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/libsmbclient/testread.c b/examples/libsmbclient/testread.c index 1f1219ca849..d59fc70ec11 100644 --- a/examples/libsmbclient/testread.c +++ b/examples/libsmbclient/testread.c @@ -55,6 +55,7 @@ int main(int argc, char * argv[]) { ret = smbc_read(fd, buffer, sizeof(buffer)); savedErrno = errno; + if (ret > 0) fwrite(buffer, 1, ret, stdout); } while (ret > 0); smbc_close(fd); diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c index 101cc022110..95a9da8487a 100644 --- a/source/libsmb/libsmbclient.c +++ b/source/libsmb/libsmbclient.c @@ -414,7 +414,15 @@ smbc_parse_path(SMBCCTX *context, } - safe_strcpy(path, p, path_len - 1); + /* + * Prepend a leading slash if there's a file path, as required by + * NetApp filers. + */ + *path = '\0'; + if (*p != '\0') { + *path = '/'; + safe_strcpy(path + 1, p, path_len - 2); + } all_string_sub(path, "/", "\\", 0); -- 2.11.4.GIT