Author: vlendec
Date: 2007-09-25 23:26:05 +0000 (Tue, 25 Sep 2007)
New Revision: 25327

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25327

Log:
Normalize the path we return for 'msdfs proxy'

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.

Modified:
   branches/SAMBA_3_2/source/smbd/msdfs.c
   branches/SAMBA_3_2_0/source/smbd/msdfs.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/msdfs.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/msdfs.c      2007-09-25 22:43:42 UTC (rev 
25326)
+++ branches/SAMBA_3_2/source/smbd/msdfs.c      2007-09-25 23:26:05 UTC (rev 
25327)
@@ -788,6 +788,7 @@
         */
 
        if (pdp->reqpath[0] == '\0') {
+               char *tmp;
                struct referral *ref;
 
                if (*lp_msdfs_proxy(snum) == '\0') {
@@ -810,7 +811,16 @@
                        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;

Modified: branches/SAMBA_3_2_0/source/smbd/msdfs.c
===================================================================
--- branches/SAMBA_3_2_0/source/smbd/msdfs.c    2007-09-25 22:43:42 UTC (rev 
25326)
+++ branches/SAMBA_3_2_0/source/smbd/msdfs.c    2007-09-25 23:26:05 UTC (rev 
25327)
@@ -788,6 +788,7 @@
         */
 
        if (pdp->reqpath[0] == '\0') {
+               char *tmp;
                struct referral *ref;
 
                if (*lp_msdfs_proxy(snum) == '\0') {
@@ -810,7 +811,16 @@
                        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;

Reply via email to