From e6411317ce21bb92e644e7126228318e8e672756 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 12 Feb 2011 11:45:15 -0500 Subject: [PATCH] Windows: Fix symlink and mount point make \\afs\xxx handling 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 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/fs.c | 7 ++++--- src/WINNT/afsd/symlink.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index 41af2042f9..c631b41075 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -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); } diff --git a/src/WINNT/afsd/symlink.c b/src/WINNT/afsd/symlink.c index 9edaeb5d64..72db0d8bb1 100644 --- a/src/WINNT/afsd/symlink.c +++ b/src/WINNT/afsd/symlink.c @@ -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);