Allow DFS client paths to work when POSIX pathnames have been
authorJeremy Allison <jra@samba.org>
Thu, 19 Mar 2009 03:54:13 +0000 (20:54 -0700)
committerMichael Adam <obnox@samba.org>
Thu, 19 Mar 2009 17:03:51 +0000 (18:03 +0100)
selected (we need to path in pathname /that/look/like/this).
Jeremy.

source/libsmb/clidfs.c

index 9fdc239c3658a5a380b3e9734cac17b7ae36f6cf..5379ff9893a65b0dbe8fd6fc23f0ec847db55aaa 100644 (file)
@@ -665,13 +665,23 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx,
                                        struct cli_state *cli,
                                        const char *dir)
 {
+       char path_sep = '\\';
+
        /* Ensure the extrapath doesn't start with a separator. */
        while (IS_DIRECTORY_SEP(*dir)) {
                dir++;
        }
 
-       return talloc_asprintf(ctx, "\\%s\\%s\\%s",
-                       cli->desthost, cli->share, dir);
+       if (cli->posix_capabilities & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
+               path_sep = '/';
+       }
+       return talloc_asprintf(ctx, "%c%s%c%s%c%s",
+                       path_sep,
+                       cli->desthost,
+                       path_sep,
+                       cli->share,
+                       path_sep,
+                       dir);
 }
 
 /********************************************************************