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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2011-02-12 11:45:15 -05:00 committed by Jeffrey Altman
parent 1a474ac287
commit e6411317ce
2 changed files with 7 additions and 6 deletions

View 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);
}

View 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);