]> 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>
Sun, 13 Feb 2011 02:33:11 +0000 (18:33 -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: Idf5f934aaa22c71789ab7970a8e3cd48e1a79d44
Reviewed-on: http://gerrit.openafs.org/3928
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 31a249e788bfe78e9ed378dae3cc60f6a0f6ec5e..dfd03ac6ea0c566f7fbeb617b4643fc6ac931818 100644 (file)
@@ -2314,11 +2314,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 50b47e63ca31af5daa11a4095014854bf0080160..2ce2df54fd56fb371c4f0348d3a4518fc87529f1 100644 (file)
@@ -445,11 +445,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);