Fix for servers that don't put a path separator at the end of the service.
authorLarry Reid <lcreid@jadesystems.ca>
Sat, 26 Mar 2011 22:39:27 +0000 (15:39 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Jun 2011 10:56:44 +0000 (12:56 +0200)
Fix bug 8055 - Can't See Parts of DFS CIFS Share.
(cherry picked from commit 0d929df7d194574d283ea5b9f4f8a45d6d214a54)

source3/libsmb/clidfs.c

index c588c16ec27c35330d762369c2de5140ca71942a..0a6b9020e141507a6fd15e8843be16e5d10a9886 100644 (file)
@@ -896,10 +896,19 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
        }
 
        if (extrapath && strlen(extrapath) > 0) {
-               *pp_targetpath = talloc_asprintf(ctx,
-                                               "%s%s",
-                                               extrapath,
-                                               *pp_targetpath);
+               /* EMC Celerra NAS version 5.6.50 (at least) doesn't appear to */
+               /* put the trailing \ on the path, so to be save we put one in if needed */
+               if (extrapath[strlen(extrapath)-1] != '\\' && **pp_targetpath != '\\') {
+                       *pp_targetpath = talloc_asprintf(ctx,
+                                                 "%s\\%s",
+                                                 extrapath,
+                                                 *pp_targetpath);
+               } else {
+                       *pp_targetpath = talloc_asprintf(ctx,
+                                                 "%s%s",
+                                                 extrapath,
+                                                 *pp_targetpath);
+               }
                if (!*pp_targetpath) {
                        return false;
                }