From: Jeffrey Altman Date: Sat, 14 Jan 2012 00:32:16 +0000 (-0500) Subject: Windows: afs root is always a directory X-Git-Tag: upstream/1.8.0_pre1^2~2833 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=96b9900d306645bb79d631250e3d740f163a2b40;p=packages%2Fo%2Fopenafs.git Windows: afs root is always a directory If the root is opened with the FILE_NON_DIRECTORY_FILE option, fail the request with STATUS_FILE_IS_A_DIRECTORY. Change-Id: Ic7d29f9032c2a19617276138833938fcf304838e Reviewed-on: http://gerrit.openafs.org/6552 Reviewed-by: Peter Scott Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp b/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp index 5698162e2..981404960 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp @@ -1416,6 +1416,7 @@ AFSOpenRoot( IN PIRP Irp, PIO_STACK_LOCATION pIrpSp = IoGetCurrentIrpStackLocation( Irp); PACCESS_MASK pDesiredAccess = NULL; USHORT usShareAccess; + ULONG ulOptions; BOOLEAN bAllocatedCcb = FALSE; BOOLEAN bReleaseFcb = FALSE; AFSFileOpenCB stOpenCB; @@ -1428,9 +1429,24 @@ AFSOpenRoot( IN PIRP Irp, pDesiredAccess = &pIrpSp->Parameters.Create.SecurityContext->DesiredAccess; usShareAccess = pIrpSp->Parameters.Create.ShareAccess; + ulOptions = pIrpSp->Parameters.Create.Options; pFileObject = pIrpSp->FileObject; + if( BooleanFlagOn( ulOptions, FILE_NON_DIRECTORY_FILE)) + { + + ntStatus = STATUS_FILE_IS_A_DIRECTORY; + + AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING, + AFS_TRACE_LEVEL_ERROR, + "AFSOpenRoot (%08lX) Attempt to open root as file Status %08lX\n", + Irp, + ntStatus); + + try_return( ntStatus); + } + // // Check if we should go and retrieve updated information for the node //