Allow msdfs symlink syntax to be more forgiving (it took me ages to remember
authorJeremy Allison <jra@samba.org>
Fri, 12 Mar 2004 01:43:23 +0000 (01:43 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 12 Mar 2004 01:43:23 +0000 (01:43 +0000)
what it was :-). Allow msdfs links to now look like UNC paths : eg.
sym_link -> msdfs://server/share/path/in/share
or :
sym_link -> msdfs:\\server\share\path\in\share
Jeremy.

source/msdfs/msdfs.c

index 5af73356e070fa896fe4a37af6a3859346796853..b77e2111bc90d51287de22d9e9150313df586dcc 100644 (file)
@@ -198,13 +198,21 @@ static BOOL parse_symlink(char* buf,struct referral** preflist,
        }
        
        for(i=0;i<count;i++) {
-               /* replace / in the alternate path by a \ */
-               char* p = strchr_m(alt_path[i],'/');
-               if(p)
+               char *p;
+
+               /* replace all /'s in the alternate path by a \ */
+               for(p = alt_path[i]; *p && ((p = strchr_m(p,'/'))!=NULL); p++) {
                        *p = '\\'; 
+               }
+
+               /* Remove leading '\\'s */
+               p = alt_path[i];
+               while (*p && (*p == '\\')) {
+                       p++;
+               }
 
                pstrcpy(reflist[i].alternate_path, "\\");
-               pstrcat(reflist[i].alternate_path, alt_path[i]);
+               pstrcat(reflist[i].alternate_path, p);
                reflist[i].proximity = 0;
                reflist[i].ttl = REFERRAL_TTL;
                DEBUG(10, ("parse_symlink: Created alt path: %s\n", reflist[i].alternate_path));