From: Peter Scott Date: Mon, 6 Aug 2012 19:12:12 +0000 (-0400) Subject: Windows: disable short names in redirector option X-Git-Tag: upstream/1.8.0_pre1^2~2109 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=831763ce6633d5377f5476651a8685f0673751de;p=packages%2Fo%2Fopenafs.git Windows: disable short names in redirector option If requested during redirector initialization, disable short name processing. Future versions of Windows (8, Server 2012, and beyond) will no longer require short names. Change-Id: I14b20afd919ed9dd8dc48dd7997089b5748a8896 Reviewed-on: http://gerrit.openafs.org/7946 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/common/AFSRedirCommonDefines.h b/src/WINNT/afsrdr/common/AFSRedirCommonDefines.h index 5d7753ef9..d98c015ce 100644 --- a/src/WINNT/afsrdr/common/AFSRedirCommonDefines.h +++ b/src/WINNT/afsrdr/common/AFSRedirCommonDefines.h @@ -243,6 +243,7 @@ static inline void AFSBreakPoint() { #define AFS_DEVICE_FLAG_HIDE_DOT_NAMES 0x00000001 #define AFS_DEVICE_FLAG_REDIRECTOR_SHUTDOWN 0x00000002 +#define AFS_DEVICE_FLAG_DISABLE_SHORTNAMES 0x00000004 #endif diff --git a/src/WINNT/afsrdr/common/AFSUserStructs.h b/src/WINNT/afsrdr/common/AFSUserStructs.h index c759cec8e..8911a6308 100644 --- a/src/WINNT/afsrdr/common/AFSUserStructs.h +++ b/src/WINNT/afsrdr/common/AFSUserStructs.h @@ -108,8 +108,8 @@ typedef struct _AFS_COMM_RESULT_BLOCK // #define AFS_REDIR_INIT_FLAG_HIDE_DOT_FILES 0x00000001 - #define AFS_REDIR_INIT_NO_PAGING_FILE 0x00000002 +#define AFS_REDIR_INIT_FLAG_DISABLE_SHORTNAMES 0x00000004 typedef struct _AFS_REDIR_INIT_INFO_CB { diff --git a/src/WINNT/afsrdr/kernel/fs/AFSRDRSupport.cpp b/src/WINNT/afsrdr/kernel/fs/AFSRDRSupport.cpp index 4b28bb965..12b899d8f 100644 --- a/src/WINNT/afsrdr/kernel/fs/AFSRDRSupport.cpp +++ b/src/WINNT/afsrdr/kernel/fs/AFSRDRSupport.cpp @@ -503,6 +503,16 @@ AFSInitializeRedirector( IN AFSRedirectorInitInfo *RedirInitInfo) SetFlag( pDevExt->DeviceFlags, AFS_DEVICE_FLAG_HIDE_DOT_NAMES); } + if( BooleanFlagOn( RedirInitInfo->Flags, AFS_REDIR_INIT_FLAG_DISABLE_SHORTNAMES)) + { + + // + // Hide files which begin with . + // + + SetFlag( pDevExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES); + } + if( RedirInitInfo->MemoryCacheOffset.QuadPart != 0 && RedirInitInfo->MemoryCacheLength.QuadPart != 0) { diff --git a/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp index 5bf60531b..80e427d3e 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp @@ -56,6 +56,7 @@ AFSEnumerateDirectory( IN GUID *AuthGroup, ULONG ulRequestFlags = AFS_REQUEST_FLAG_SYNCHRONOUS; ULONG ulCRC = 0; UNICODE_STRING uniGUID; + AFSDeviceExt *pDevExt = (AFSDeviceExt *) AFSRDRDeviceObject->DeviceExtension; __Enter { @@ -429,7 +430,8 @@ AFSEnumerateDirectory( IN GUID *AuthGroup, // Init the short name if we have one // - if( pCurrentDirEntry->ShortNameLength > 0) + if( !BooleanFlagOn( pDevExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + pCurrentDirEntry->ShortNameLength > 0) { UNICODE_STRING uniShortName; @@ -475,6 +477,15 @@ AFSEnumerateDirectory( IN GUID *AuthGroup, (12 * sizeof( WCHAR))); } } + else + { + + // + // No short name or short names are disabled + // + + pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = 0; + } // // Insert the node into the name tree @@ -758,6 +769,7 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB, ULONGLONG ullIndex = 0; UNICODE_STRING uniGUID; LONG lCount; + AFSDeviceExt *pDevExt = (AFSDeviceExt *) AFSRDRDeviceObject->DeviceExtension; __Enter { @@ -1232,7 +1244,8 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB, // Init the short name if we have one // - if( pCurrentDirEntry->ShortNameLength > 0) + if( !BooleanFlagOn( pDevExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + pCurrentDirEntry->ShortNameLength > 0) { UNICODE_STRING uniShortName; @@ -1281,15 +1294,11 @@ AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB, else { - AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING, - AFS_TRACE_LEVEL_VERBOSE, - "AFSVerifyDirectoryContent NO short name for DE %p for %wZ FID %08lX-%08lX-%08lX-%08lX\n", - pDirNode, - &pDirNode->NameInformation.FileName, - pCurrentDirEntry->FileId.Cell, - pCurrentDirEntry->FileId.Volume, - pCurrentDirEntry->FileId.Vnode, - pCurrentDirEntry->FileId.Unique); + // + // No short name or short names have been disabled + // + + pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = 0; } // @@ -1515,6 +1524,7 @@ AFSNotifyFileCreate( IN GUID *AuthGroup, AFSDirectoryCB *pDirNode = NULL; ULONG ulCRC = 0; LARGE_INTEGER liOldDataVersion; + AFSDeviceExt *pDevExt = (AFSDeviceExt *) AFSRDRDeviceObject->DeviceExtension; __Enter { @@ -1760,7 +1770,8 @@ AFSNotifyFileCreate( IN GUID *AuthGroup, // Init the short name if we have one // - if( pResultCB->DirEnum.ShortNameLength > 0) + if( !BooleanFlagOn( pDevExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + pResultCB->DirEnum.ShortNameLength > 0) { UNICODE_STRING uniShortName; @@ -1788,6 +1799,14 @@ AFSNotifyFileCreate( IN GUID *AuthGroup, pDirNode, &pDirNode->NameInformation.FileName); } + else + { + // + // No short name or short names are disabled + // + + pDirNode->Type.Data.ShortNameTreeEntry.HashIndex = 0; + } if ( !BooleanFlagOn( ParentObjectInfo->Flags, AFS_OBJECT_FLAGS_VERIFY)) { @@ -2059,6 +2078,7 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo, AFSFileRenameCB *pRenameCB = NULL; AFSFileRenameResultCB *pRenameResultCB = NULL; ULONG ulResultLen = 0; + AFSDeviceExt *pDevExt = (AFSDeviceExt *) AFSRDRDeviceObject->DeviceExtension; __Enter { @@ -2166,7 +2186,8 @@ AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo, DirectoryCB->NameInformation.ShortNameLength = pRenameResultCB->DirEnum.ShortNameLength; - if( DirectoryCB->NameInformation.ShortNameLength > 0) + if( !BooleanFlagOn( pDevExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + DirectoryCB->NameInformation.ShortNameLength > 0) { UNICODE_STRING uniShortName; diff --git a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp index 5e6aa7dff..653142a85 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp @@ -2089,6 +2089,7 @@ AFSSetRenameInfo( IN PIRP Irp) { NTSTATUS ntStatus = STATUS_SUCCESS; + AFSDeviceExt *pDeviceExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension; PIO_STACK_LOCATION pIrpSp = IoGetCurrentIrpStackLocation( Irp); IO_STATUS_BLOCK stIoSb = {0,0}; AFSFcb *pSrcFcb = NULL, *pTargetDcb = NULL, *pTargetFcb = NULL; @@ -2289,7 +2290,8 @@ AFSSetRenameInfo( IN PIRP Irp) &pTargetDirEntry); } - if( pTargetDirEntry == NULL && RtlIsNameLegalDOS8Dot3( &uniTargetName, + if ( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + pTargetDirEntry == NULL && RtlIsNameLegalDOS8Dot3( &uniTargetName, NULL, NULL)) { @@ -2514,7 +2516,8 @@ AFSSetRenameInfo( IN PIRP Irp) pSrcCcb->DirectoryCB->CaseInsensitiveTreeEntry.HashIndex = AFSGenerateCRC( &pSrcCcb->DirectoryCB->NameInformation.FileName, TRUE); - if( pSrcCcb->DirectoryCB->NameInformation.ShortNameLength > 0 && + if( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + pSrcCcb->DirectoryCB->NameInformation.ShortNameLength > 0 && !RtlIsNameLegalDOS8Dot3( &pSrcCcb->DirectoryCB->NameInformation.FileName, NULL, NULL)) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp b/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp index 5dc0510d1..547ed7c5c 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp @@ -3366,6 +3366,7 @@ AFSValidateDirectoryCache( IN AFSObjectInfoCB *ObjectInfo, { NTSTATUS ntStatus = STATUS_SUCCESS; + AFSDeviceExt *pDeviceExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension; BOOLEAN bAcquiredLock = FALSE; AFSDirectoryCB *pCurrentDirEntry = NULL, *pNextDirEntry = NULL; AFSFcb *pFcb = NULL; @@ -3507,7 +3508,8 @@ AFSValidateDirectoryCache( IN AFSObjectInfoCB *ObjectInfo, if( BooleanFlagOn( pCurrentDirEntry->Flags, AFS_DIR_ENTRY_VALID)) { - if( !BooleanFlagOn( pCurrentDirEntry->Flags, AFS_DIR_ENTRY_INSERTED_SHORT_NAME) && + if( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + !BooleanFlagOn( pCurrentDirEntry->Flags, AFS_DIR_ENTRY_INSERTED_SHORT_NAME) && pCurrentDirEntry->Type.Data.ShortNameTreeEntry.HashIndex > 0) { @@ -8329,6 +8331,7 @@ AFSCheckSymlinkAccess( IN AFSDirectoryCB *ParentDirectoryCB, { NTSTATUS ntStatus = STATUS_SUCCESS; + AFSDeviceExt *pDeviceExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension; AFSDirectoryCB *pDirEntry = NULL; ULONG ulCRC = 0; LONG lCount; @@ -8382,7 +8385,8 @@ AFSCheckSymlinkAccess( IN AFSDirectoryCB *ParentDirectoryCB, // a lookup in the short name tree // - if( RtlIsNameLegalDOS8Dot3( ComponentName, + if( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + RtlIsNameLegalDOS8Dot3( ComponentName, NULL, NULL)) { diff --git a/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp index 5727b813e..028e15f41 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp @@ -1429,7 +1429,8 @@ AFSLocateNameEntry( IN GUID *AuthGroup, // a lookup in the short name tree // - if( RtlIsNameLegalDOS8Dot3( &uniSearchName, + if( !BooleanFlagOn( pDevExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + RtlIsNameLegalDOS8Dot3( &uniSearchName, NULL, NULL)) { @@ -3498,7 +3499,8 @@ AFSParseName( IN PIRP Irp, // a lookup in the short name tree // - if( RtlIsNameLegalDOS8Dot3( &uniComponentName, + if( !BooleanFlagOn( pDeviceExt->DeviceFlags, AFS_DEVICE_FLAG_DISABLE_SHORTNAMES) && + RtlIsNameLegalDOS8Dot3( &uniComponentName, NULL, NULL)) {