Windows: GetResourceParent processing for \\afs

When the input name is \\afs the parent must be an empty
NETRESOURCE structure.  The null lpRemoteName field represents
no parent.

Change-Id: I779f1c3357ac74aa76e6d1ed0b755841513ac260
Reviewed-on: http://gerrit.openafs.org/8831
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
Jeffrey Altman 2012-12-24 02:40:08 -05:00
parent 5f43eb2919
commit 75d9c88281

View File

@ -3008,6 +3008,16 @@ NPGetResourceParent( LPNETRESOURCE lpNetResource,
WCHAR *pwchRemoteName = NULL, *pwchSearch = NULL, *pwchSystem = NULL;
LPNETRESOURCE lpOutResource = (LPNETRESOURCE) lpBuffer;
if ( NPIsFSDisabled())
{
#ifdef AFS_DEBUG_TRACE
AFSDbgPrint( L"NPGetResourceParent AFSRDFS is disabled, returning WN_BAD_NETNAME\n");
#endif
return WN_BAD_NETNAME;
}
if ( lpNetResource == NULL)
{
#ifdef AFS_DEBUG_TRACE
@ -3049,6 +3059,11 @@ NPGetResourceParent( LPNETRESOURCE lpNetResource,
pwchRemoteName = lpNetResource->lpRemoteName;
//
// The input will be of the form \\AFS\CELL\path.
// \\AFS has no parent and by definition returns an empty NETRESOURCE.
//
pwchSearch = pwchRemoteName + (wcslen( pwchRemoteName) - 1);
while( pwchSearch != pwchRemoteName)
@ -3065,7 +3080,8 @@ NPGetResourceParent( LPNETRESOURCE lpNetResource,
pwchSearch--;
}
if( pwchSearch != pwchRemoteName)
if( pwchSearch != pwchRemoteName &&
pwchSearch != pwchRemoteName + 1)
{
#ifdef AFS_DEBUG_TRACE