Windows: AFSRetrieveFileAttributes no parent path
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 9 Jun 2015 12:55:44 +0000 (08:55 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 24 Sep 2015 04:19:07 +0000 (00:19 -0400)
Modify AFSRetrieveFileAttributes() to handle the case of a ParentPathName
with a Length == 0.   In such a case the introduction of a path separator
would result in the construction of an absolute path when a relative path
is required.

Change-Id: I2e633b22992b0aee914927a451bb146fc57110e8
Reviewed-on: http://gerrit.openafs.org/11889
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp

index 2594416..5ad8fe6 100644 (file)
@@ -5778,22 +5778,26 @@ AFSRetrieveFileAttributes( IN AFSDirectoryCB *ParentDirectoryCB,
             RtlZeroMemory( uniFullPathName.Buffer,
                            uniFullPathName.MaximumLength);
 
-            RtlCopyMemory( uniFullPathName.Buffer,
-                           ParentPathName->Buffer,
-                           ParentPathName->Length);
+           if ( ParentPathName->Length > 0)
+           {
 
-            uniFullPathName.Length = ParentPathName->Length;
+               RtlCopyMemory( uniFullPathName.Buffer,
+                              ParentPathName->Buffer,
+                              ParentPathName->Length);
 
-            if( uniFullPathName.Buffer[ (uniFullPathName.Length/sizeof( WCHAR)) - 1] != L'\\' &&
-                DirectoryCB->NameInformation.TargetName.Buffer[ 0] != L'\\')
-            {
+               uniFullPathName.Length = ParentPathName->Length;
+
+               if( uniFullPathName.Buffer[ (uniFullPathName.Length/sizeof( WCHAR)) - 1] != L'\\' &&
+                   DirectoryCB->NameInformation.TargetName.Buffer[ 0] != L'\\')
+               {
 
-                uniFullPathName.Buffer[ uniFullPathName.Length/sizeof( WCHAR)] = L'\\';
+                   uniFullPathName.Buffer[ uniFullPathName.Length/sizeof( WCHAR)] = L'\\';
 
-                uniFullPathName.Length += sizeof( WCHAR);
-            }
+                   uniFullPathName.Length += sizeof( WCHAR);
+               }
+           }
 
-            RtlCopyMemory( &uniFullPathName.Buffer[ uniFullPathName.Length/sizeof( WCHAR)],
+           RtlCopyMemory( &uniFullPathName.Buffer[ uniFullPathName.Length/sizeof( WCHAR)],
                            DirectoryCB->NameInformation.TargetName.Buffer,
                            DirectoryCB->NameInformation.TargetName.Length);