From edea22524a4d348f570e969dd75cd7f9e3876b32 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 17 Apr 2013 18:18:30 -0400 Subject: [PATCH] Windows: Add IOCTL_AFS_GET_REPARSE_POLICY Introduce IOCTL_AFS_GET_REPARSE_POLICY to permit the global and active authgroup reparse point policies to be queried. Change-Id: I9ec4bfd177cac1a4ed77f3b376694ec6864a479c Reviewed-on: http://gerrit.openafs.org/9797 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsrdr/common/AFSUserIoctl.h | 23 ++++++++++---------- src/WINNT/afsrdr/common/AFSUserStructs.h | 29 ++++++++++++++----------- src/WINNT/afsrdr/kernel/fs/AFSCommSupport.cpp | 30 +++++++++++++++++++++++--- src/WINNT/afsrdr/kernel/fs/AFSGeneric.cpp | 27 +++++++++++++++++++++++ src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h | 13 +++++------ 5 files changed, 89 insertions(+), 33 deletions(-) diff --git a/src/WINNT/afsrdr/common/AFSUserIoctl.h b/src/WINNT/afsrdr/common/AFSUserIoctl.h index f788dad..8cf87c6 100644 --- a/src/WINNT/afsrdr/common/AFSUserIoctl.h +++ b/src/WINNT/afsrdr/common/AFSUserIoctl.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2008-2011 Kernel Drivers, LLC. - * Copyright (c) 2009-2011 Your File System, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Kernel Drivers, LLC. + * Copyright (c) 2009, 2010, 2011, 2012, 2013 Your File System, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -10,15 +10,12 @@ * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright - * notice, - * this list of conditions and the following disclaimer in the - * documentation - * and/or other materials provided with the distribution. - * - Neither the name of Kernel Drivers, LLC nor the names of its - * contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission from Kernel Drivers, LLC - * and Your File System, Inc. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - Neither the names of Kernel Drivers, LLC and Your File System, Inc. + * nor the names of their contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission from Kernel Drivers, LLC and Your File System, Inc. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -96,4 +93,6 @@ #define IOCTL_AFS_SET_REPARSE_POLICY CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x101C, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif /* _AFS_USER_IOCTL_H */ \ No newline at end of file +#define IOCTL_AFS_GET_REPARSE_POLICY CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x101D, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#endif /* _AFS_USER_IOCTL_H */ diff --git a/src/WINNT/afsrdr/common/AFSUserStructs.h b/src/WINNT/afsrdr/common/AFSUserStructs.h index 2a5f9ce..a53527f 100644 --- a/src/WINNT/afsrdr/common/AFSUserStructs.h +++ b/src/WINNT/afsrdr/common/AFSUserStructs.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2011 Kernel Drivers, LLC. - * Copyright (c) 2009-2011 Your File System, Inc. - * All rights reserved. +* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Kernel Drivers, LLC. +* Copyright (c) 2009, 2010, 2011, 2012, 2013 Your File System, Inc. +* All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,15 +10,12 @@ * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright - * notice, - * this list of conditions and the following disclaimer in the - * documentation - * and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - Neither the name of Kernel Drivers, LLC nor the names of its - * contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission from Kernel Drivers, LLC - * and Your File System, Inc. + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission from + * Kernel Drivers, LLC and Your File System, Inc. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -1322,5 +1319,13 @@ typedef struct _AFS_SET_REPARSE_POINT_POLICY } AFSSetReparsePointPolicyCB; -#endif /* _AFS_USER_STRUCT_H */ +typedef struct _AFS_GET_REPARSE_POINT_POLICY +{ + + ULONG GlobalPolicy; + ULONG ActivePolicy; + +} AFSGetReparsePointPolicyCB; + +#endif /* _AFS_USER_STRUCT_H */ diff --git a/src/WINNT/afsrdr/kernel/fs/AFSCommSupport.cpp b/src/WINNT/afsrdr/kernel/fs/AFSCommSupport.cpp index 0385d97..614004b 100644 --- a/src/WINNT/afsrdr/kernel/fs/AFSCommSupport.cpp +++ b/src/WINNT/afsrdr/kernel/fs/AFSCommSupport.cpp @@ -527,9 +527,10 @@ AFSCheckIoctlPermissions( IN ULONG ControlCode) return STATUS_ACCESS_DENIED; } - return STATUS_SUCCESS; + return STATUS_SUCCESS; case IOCTL_AFS_SET_REPARSE_POLICY: + case IOCTL_AFS_GET_REPARSE_POLICY: // // Anyone can call this @@ -930,8 +931,31 @@ AFSProcessControlRequest( IN PIRP Irp) break; } - default: - { + case IOCTL_AFS_GET_REPARSE_POLICY: + { + + AFSGetReparsePointPolicyCB *pPolicy = (AFSGetReparsePointPolicyCB *)Irp->AssociatedIrp.SystemBuffer; + + if( pPolicy == NULL || + pIrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof( AFSGetReparsePointPolicyCB)) + { + ntStatus = STATUS_INVALID_PARAMETER; + break; + } + + ntStatus = AFSGetReparsePointPolicy( pPolicy); + + if ( NT_SUCCESS( ntStatus)) + { + + Irp->IoStatus.Information = sizeof( AFSGetReparsePointPolicyCB); + } + + break; + } + + default: + { // // Check the state of the library diff --git a/src/WINNT/afsrdr/kernel/fs/AFSGeneric.cpp b/src/WINNT/afsrdr/kernel/fs/AFSGeneric.cpp index 9bfe513..f607cfc 100644 --- a/src/WINNT/afsrdr/kernel/fs/AFSGeneric.cpp +++ b/src/WINNT/afsrdr/kernel/fs/AFSGeneric.cpp @@ -2260,3 +2260,30 @@ AFSSetReparsePointPolicy( IN AFSSetReparsePointPolicyCB *PolicyCB) return ntStatus; } + +NTSTATUS +AFSGetReparsePointPolicy( OUT AFSGetReparsePointPolicyCB *PolicyCB) +{ + + NTSTATUS ntStatus = STATUS_SUCCESS; + AFSDeviceExt* pDeviceExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension; + + __Enter + { + + PolicyCB->GlobalPolicy = pDeviceExt->Specific.RDR.ReparsePointPolicy; + + // + // When per-AuthGroup or per-Process policies are permitted + // this function will need to query the policies when determining + // the active policy. + // + + { + + PolicyCB->ActivePolicy = PolicyCB->GlobalPolicy; + } + } + + return ntStatus; +} diff --git a/src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h b/src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h index 5b74a21..c51a5f8 100644 --- a/src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h +++ b/src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC. - * Copyright (c) 2009, 2010, 2011 Your File System, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Kernel Drivers, LLC. + * Copyright (c) 2009, 2010, 2011, 2012, 2013 Your File System, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -10,10 +10,8 @@ * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright - * notice, - * this list of conditions and the following disclaimer in the - * documentation - * and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - Neither the names of Kernel Drivers, LLC and Your File System, Inc. * nor the names of their contributors may be used to endorse or promote * products derived from this software without specific prior written @@ -519,6 +517,9 @@ AFSProcessSetProcessDacl( IN AFSProcessCB *ProcessCB); NTSTATUS AFSSetReparsePointPolicy( IN AFSSetReparsePointPolicyCB *Policy); +NTSTATUS +AFSGetReparsePointPolicy( OUT AFSGetReparsePointPolicyCB *Policy); + // // Prototypes in AFSFastIoSupprt.cpp // -- 1.9.4