From: Jeffrey Altman Date: Mon, 24 Dec 2012 07:40:08 +0000 (-0500) Subject: Windows: GetResourceParent processing for \\afs X-Git-Tag: openafs-stable-1_8_0pre1~1701 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=75d9c88281b686822a71ffabe76cb4aebd35d0ee 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 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/npdll/AFS_Npdll.c b/src/WINNT/afsrdr/npdll/AFS_Npdll.c index f858388..fdc68c9 100644 --- a/src/WINNT/afsrdr/npdll/AFS_Npdll.c +++ b/src/WINNT/afsrdr/npdll/AFS_Npdll.c @@ -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