r18012: Should fix bug 4018.
authorDerrell Lipman <derrell@samba.org>
Sun, 3 Sep 2006 01:37:26 +0000 (01:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:39:48 +0000 (11:39 -0500)
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
source/libsmb/libsmbclient.c

index 1f1219ca8498067147a592bc4e6e262a382d6a8c..d59fc70ec11fcc7683ed71cf0c991e6c291a46b8 100644 (file)
@@ -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);
index 101cc022110672e681cc1f9ba2b10f70017849d8..95a9da8487aeb6841b2feb0e22ff00f3a4ed679e 100644 (file)
@@ -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);