]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: Fix symlink and mount point make \\afs\xxx handling
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 12 Feb 2011 16:45:15 +0000 (11:45 -0500)
committerJeffrey Altman <jaltman@openafs.org>
Sat, 12 Feb 2011 19:25:07 +0000 (11:25 -0800)
When processing a request to make a symlink or a mount point
in the afs root volume (\\AFS) the smb redirector will fail
the request because a server name by itself is not a valid path.
Therefore, we insert the "all" share component to refer to the
root volume as a valid path.  \\AFS\foobar becomes \\AFS\all\foobar.

A recent change stripped the trailing slash from the string
returned by Parent().  This broke the test that determines
whether or not the provided path that failed the IsAFS() test
is in fact referring to the \\AFS server and requires the insertion
of the "all" share name.

This patchset permits the test to work with \\AFS or \\AFS\
and removes extraneous directory separators from the generated
path containing the "all" share.

Change-Id: Ia3b28d83302d9737bd149b4a22bc3ee3a6c8da46
Reviewed-on: http://gerrit.openafs.org/3924
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
src/WINNT/afsd/fs.c
src/WINNT/afsd/symlink.c

index 41af2042f98b56098ae23d76c01ff86cbfa7ed0b..c631b41075abcf3691234617c63f466154253a3c 100644 (file)
@@ -2317,11 +2317,12 @@ MakeMountCmd(struct cmd_syndesc *as, void *arock)
            exit(1);
        }
        if (parent[0] == '\\' && parent[1] == '\\' &&
-           parent[len+2] == '\\' &&
-           parent[len+3] == '\0' &&
+           (parent[len+2] == '\\' && parent[len+3] == '\0' || parent[len+2] == '\0') &&
            !strnicmp(nbname,&parent[2],len))
        {
-           if( FAILED(StringCbPrintf(path, sizeof(path),"%sall\\%s", parent, &as->parms[0].items->data[len+2]))) {
+           if( FAILED(StringCbPrintf(path, sizeof(path),"%s%sall%s", parent,
+                                      parent[len+2]?"":"\\",
+                                      &as->parms[0].items->data[len+2]))) {
                fprintf (stderr, "path - cannot be populated");
                 exit(1);
             }
index 9edaeb5d647cf389fad2b9e82e63734aa52e1856..72db0d8bb1b7b71530544e9283b658a6b2fe87c2 100644 (file)
@@ -448,11 +448,11 @@ static MakeLinkCmd(struct cmd_syndesc *as, void *arock)
        int len = (int)strlen(nbname);
 
        if (parent[0] == '\\' && parent[1] == '\\' &&
-           parent[len+2] == '\\' &&
-           parent[len+3] == '\0' &&
+           (parent[len+2] == '\\' && parent[len+3] == '\0' || parent[len+2] == '\0') &&
            !strnicmp(nbname,&parent[2],len))
        {
-           sprintf(path,"%sall\\%s", parent, &as->parms[0].items->data[strlen(parent)]);
+           sprintf(path,"%s%sall%s", parent, parent[len+2]?"":"\\",
+                    &as->parms[0].items->data[strlen(parent)]);
            parent = Parent(path);
            if (!InAFS(parent)) {
                fprintf(stderr,"%s: symlinks must be created within the AFS file system\n", pn);