The redirector is supposed to reject access to file objects if there
is no case exact match and multiple entries match in a case insensitive
comparison. The check was only present in the AFSLocateNameEntry()
function and not elsewhere.
Fix the AFSLocateNameEntry() call and addd the missing checks.
Reviewed-on: http://gerrit.openafs.org/11929
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit
dffaab441d09a3b955d358292c550116b76a6410)
Change-Id: Ie84a4026bb73bfdf72a3849f9d607d158ea7ac53
Reviewed-on: http://gerrit.openafs.org/12065
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
AFSLocateCaseInsensitiveDirEntry( pTargetParentObject->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead,
ulTargetCRC,
&pTargetDirEntry);
- }
- if ( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) &&
- pTargetDirEntry == NULL && RtlIsNameLegalDOS8Dot3( &uniTargetName,
- NULL,
- NULL))
- {
- //
- // Try the short name
- //
- AFSLocateShortNameDirEntry( pTargetParentObject->Specific.Directory.ShortNameTree,
- ulTargetCRC,
- &pTargetDirEntry);
+ if ( pTargetDirEntry == NULL)
+ {
+
+ if ( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) &&
+ RtlIsNameLegalDOS8Dot3( &uniTargetName,
+ NULL,
+ NULL))
+ {
+ //
+ // Try the short name
+ //
+ AFSLocateShortNameDirEntry( pTargetParentObject->Specific.Directory.ShortNameTree,
+ ulTargetCRC,
+ &pTargetDirEntry);
+ }
+ }
+ else
+ {
+ //
+ // Here we have a match on the case insensitive lookup for the name. If there
+ // Is more than one link entry for this node then fail the lookup request
+ //
+
+ if( !BooleanFlagOn( pTargetDirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD) ||
+ pTargetDirEntry->CaseInsensitiveList.fLink != NULL)
+ {
+
+ pTargetDirEntry = NULL;
+
+ try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);
+ }
+ }
}
//
AFSLocateCaseInsensitiveDirEntry( pTargetParentObject->Specific.Directory.DirectoryNodeHdr.CaseInsensitiveTreeHead,
ulTargetCRC,
&pTargetDirEntry);
- }
- if ( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) &&
- pTargetDirEntry == NULL && RtlIsNameLegalDOS8Dot3( &uniTargetName,
- NULL,
- NULL))
- {
- //
- // Try the short name
- //
- AFSLocateShortNameDirEntry( pTargetParentObject->Specific.Directory.ShortNameTree,
- ulTargetCRC,
- &pTargetDirEntry);
+ if ( pTargetDirEntry == NULL)
+ {
+
+ if ( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) &&
+ RtlIsNameLegalDOS8Dot3( &uniTargetName,
+ NULL,
+ NULL))
+ {
+ //
+ // Try the short name
+ //
+ AFSLocateShortNameDirEntry( pTargetParentObject->Specific.Directory.ShortNameTree,
+ ulTargetCRC,
+ &pTargetDirEntry);
+ }
+ }
+ else
+ {
+ //
+ // Here we have a match on the case insensitive lookup for the name. If there
+ // Is more than one link entry for this node then fail the lookup request
+ //
+
+ if( !BooleanFlagOn( pTargetDirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD) ||
+ pTargetDirEntry->CaseInsensitiveList.fLink != NULL)
+ {
+
+ pTargetDirEntry = NULL;
+
+ try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);
+ }
+ }
}
//
&pDirEntry);
}
}
+ else
+ {
+
+ //
+ // Here we have a match on the case insensitive lookup for the name. If there
+ // Is more than one link entry for this node then fail the lookup request
+ //
+
+ if( !BooleanFlagOn( pDirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD) ||
+ pDirEntry->CaseInsensitiveList.fLink != NULL)
+ {
+
+ AFSReleaseResource( ParentDirectoryCB->ObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
+
+ try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);
+ }
+ }
}
if( pDirEntry != NULL)
//
// Here we have a match on the case insensitive lookup for the name. If there
- // Is more than one link entry for this node then fail the lookup request
- //
+ // Is more than one link entry for this node then fail the lookup request
+ //
- pCurrentObject = pDirEntry->ObjectInformation;
+ if( !BooleanFlagOn( pDirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD) ||
+ pDirEntry->CaseInsensitiveList.fLink != NULL)
+ {
- if( !BooleanFlagOn( pDirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD) ||
- pDirEntry->CaseInsensitiveList.fLink != NULL)
- {
+ AFSReleaseResource( pParentDirEntry->ObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
- //
- // Increment our dir entry ref count since we will decrement it on exit
- //
+ pDirEntry = NULL;
- lCount = InterlockedIncrement( &pDirEntry->DirOpenReferenceCount);
+ try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);
+ }
- AFSDbgTrace(( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING,
- AFS_TRACE_LEVEL_VERBOSE,
- "AFSLocateNameEntry Increment5 count on %wZ DE %p Ccb %p Cnt %d\n",
- &pDirEntry->NameInformation.FileName,
- pDirEntry,
- NULL,
- lCount));
-
- AFSReleaseResource( pParentDirEntry->ObjectInformation->Specific.Directory.DirectoryNodeHdr.TreeLock);
-
- try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);
- }
- }
- }
+ pCurrentObject = pDirEntry->ObjectInformation;
+ }
+ }
if( pDirEntry != NULL)
{
}
}
}
+ else
+ {
+
+ //
+ // Here we have a match on the case insensitive lookup for the name. If there
+ // Is more than one link entry for this node then fail the lookup request
+ //
+
+ if( !BooleanFlagOn( pDirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD) ||
+ pDirEntry->CaseInsensitiveList.fLink != NULL)
+ {
+
+ AFSReleaseResource( AFSGlobalRoot->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
+
+ bReleaseTreeLock = FALSE;
+
+ pDirEntry = NULL;
+
+ try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);
+ }
+ }
}
if( bReleaseTreeLock)
{
- AFSReleaseResource( AFSGlobalRoot->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
- }
+ AFSReleaseResource( AFSGlobalRoot->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
+
+ bReleaseTreeLock = FALSE;
+ }
//
// Be sure we are starting from the correct volume
try_return( ntStatus);
}
+
+ //
+ // Here we have a match on the case insensitive lookup for the name. If there
+ // Is more than one link entry for this node then fail the lookup request
+ //
+
+ if( !BooleanFlagOn( pShareDirEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD) ||
+ pShareDirEntry->CaseInsensitiveList.fLink != NULL)
+ {
+
+ AFSReleaseResource( AFSGlobalRoot->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
+
+ pShareDirEntry = NULL;
+
+ try_return(ntStatus = STATUS_OBJECT_NAME_COLLISION);
+ }
}
lCount = InterlockedIncrement( &pShareDirEntry->DirOpenReferenceCount);