From 75d9c88281b686822a71ffabe76cb4aebd35d0ee Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 24 Dec 2012 02:40:08 -0500 Subject: [PATCH] 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 --- src/WINNT/afsrdr/npdll/AFS_Npdll.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/WINNT/afsrdr/npdll/AFS_Npdll.c b/src/WINNT/afsrdr/npdll/AFS_Npdll.c index f858388533..fdc68c9eaa 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