Allow DFS client paths to work when POSIX pathnames have been
authorJeremy Allison <jra@samba.org>
Thu, 19 Mar 2009 03:56:48 +0000 (20:56 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 19 Mar 2009 03:57:47 +0000 (20:57 -0700)
selected (we need to path in pathname /that/look/like/this).
Jeremy.

source3/libsmb/clidfs.c

index 18e7ab1dec732084dc105c15041a1dc119038316..430807eb7f319db765cc2449aec568e355b697de 100644 (file)
@@ -551,13 +551,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);
 }
 
 /********************************************************************