Windows: GetResourceParent processing for \\afs
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 24 Dec 2012 07:40:08 +0000 (02:40 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 25 Dec 2012 14:39:57 +0000 (06:39 -0800)
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>

src/WINNT/afsrdr/npdll/AFS_Npdll.c

index f858388..fdc68c9 100644 (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