r25327: Normalize the path we return for 'msdfs proxy'
authorVolker Lendecke <vlendec@samba.org>
Tue, 25 Sep 2007 23:26:05 +0000 (23:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:31:00 +0000 (12:31 -0500)
We now accept both \\server\tmp and \server\tmp. There are other places
where this might be necessary, but at least the functionality is a bit
easier now.
(This used to be commit 25cc27df97e9eecb470f99ea934de12f2a0f4df9)

source3/smbd/msdfs.c

index a2d7b778ca393fbab18d095caa0a80437d3f87ad..ff55904b81caba3bb8b7cda2a83bc2b6dfe956a6 100644 (file)
@@ -788,6 +788,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
         */
 
        if (pdp->reqpath[0] == '\0') {
+               char *tmp;
                struct referral *ref;
 
                if (*lp_msdfs_proxy(snum) == '\0') {
@@ -810,7 +811,16 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx,
                        return NT_STATUS_NO_MEMORY;
                }
 
-               ref->alternate_path = talloc_strdup(ctx, lp_msdfs_proxy(snum));
+               if (!(tmp = talloc_strdup(ctx, lp_msdfs_proxy(snum)))) {
+                       TALLOC_FREE(pdp);
+                       return NT_STATUS_NO_MEMORY;
+               }
+
+               trim_string(tmp, "\\", 0);
+
+               ref->alternate_path = talloc_asprintf(ctx, "\\%s", tmp);
+               TALLOC_FREE(tmp);
+
                if (!ref->alternate_path) {
                        TALLOC_FREE(pdp);
                        return NT_STATUS_NO_MEMORY;