]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: IOCTL_AFS_SET_REPARSE_POLICY
authorpete scott <pscott@kerneldrivers.com>
Wed, 27 Feb 2013 15:51:44 +0000 (08:51 -0700)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 8 May 2013 00:38:56 +0000 (17:38 -0700)
IOCTL_AFS_SET_REPARSE_POLICY is a new ioctl that can be executed
by anyone to alter the behavior of AFS Symlink-to-File reparse point
processing.   Policy can be set for a global default or for the active
authentication group.  If the AFS_REPARSE_POINT_TO_FILE_AS_FILE policy is
active, afs symlinks will not be reported as reparse points if the symlink
target is known to be a file.

This patchset implements the ioctl but not the "reparse point to file as
file" functionality.  Per authgroup policy setting is not permitted by the
ioctl but is not supported at this time.

This patchset was modified by Jeffrey Altman.

Change-Id: I6fd8b3c7f94dd97e15d6b82642f43cb2d8193563
Reviewed-on: http://gerrit.openafs.org/9341
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
src/WINNT/afsrdr/common/AFSRedirCommonDefines.h
src/WINNT/afsrdr/common/AFSRedirCommonStructs.h
src/WINNT/afsrdr/common/AFSUserDefines.h
src/WINNT/afsrdr/common/AFSUserIoctl.h
src/WINNT/afsrdr/common/AFSUserStructs.h
src/WINNT/afsrdr/kernel/fs/AFSCommSupport.cpp
src/WINNT/afsrdr/kernel/fs/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h

index 6e5ea409113d4ed65b793be6205bfa8bb23e2157..816331deb90ecc79153fd013a195c1a38c40b0c1 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2008-2011 Kernel Drivers, LLC.
- * Copyright (c) 2009-2011 Your File System, Inc.
+ * Copyright (c) 2008-2013 Kernel Drivers, LLC.
+ * Copyright (c) 2009-2013 Your File System, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * - 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
 #define AFS_VOLUME_INSERTED_HASH_TREE                   0x00000004
 #define AFS_VOLUME_ACTIVE_GLOBAL_ROOT                   0x00000008
 
+//
+// Authentication Group Flags
+//
+
+#define AFS_AUTHGROUP_REPARSE_POLICY_SET                0x00000001
+#define AFS_AUTHGROUP_REPARSE_POINT_TO_FILE_AS_FILE     0x00000002
+
 //
 // Need this to handle the break point definition
 //
index 5da3ce9ae482382c1a64554b08f059483116f36e..bddd447998ddfa0cad51944b9c22cafe5530bba6 100644 (file)
@@ -680,6 +680,12 @@ typedef struct _AFS_DEVICE_EXTENSION
 
             struct _AFSFSD_PROVIDER_CONNECTION_CB   *ProviderEnumerationList;
 
+           //
+           // Reparse point policy
+           //
+
+           ULONG               ReparsePointPolicy;
+
         } RDR;
 
         struct
index 324cb8d5859272ac6a055f782b30a31f18dfa888..421fe2c8a5db779951abb6ab86a59013449181db 100644 (file)
 #define AFS_FILE_ACCESS_EXCLUSIVE       0x00000001
 #define AFS_FILE_ACCESS_SHARED          0x00000002
 
+//
+// Reparse Point processing policy
+//
+
+#define AFS_REPARSE_POINT_POLICY_RESET       0x00000000 // This will reset the policy to default
+                                                       // behavior which is to process the
+                                                       // "open as reparse point" flag during
+                                                       // Create per normal operation.
+
+#define AFS_REPARSE_POINT_TO_FILE_AS_FILE    0x00000001 // If indicated then ignore any attempt to
+                                                       // "open as reparse point" when the target is
+                                                       // a file.
+
+#define AFS_REPARSE_POINT_VALID_POLICY_FLAGS 0x00000001
+
+//
+// Reparse Point policy scope
+//
+
+#define AFS_REPARSE_POINT_POLICY_GLOBAL      0x00000000
+
+#define AFS_REPARSE_POINT_POLICY_AUTHGROUP   0x00000001
+
 #endif /* _AFS_USER_DEFINE_H */
index 35998994f607353cdca18a1df055709e39fd586f..f788dadfab7795b632310566c162ab415bda6da6 100644 (file)
@@ -94,4 +94,6 @@
 
 #define IOCTL_AFS_CONFIG_LIBRARY_TRACE          CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x101B, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
+#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
index 502e9bcd480d8f05117a10ebd5b94d6345d9e64f..aa7586d35979c6255616da61a1fdf64d2c67a912 100644 (file)
@@ -1311,5 +1311,14 @@ typedef struct _AFS_FILE_IO_RESULT_CB
 
 } AFSFileIOResultCB;
 
+typedef struct _AFS_SET_REPARSE_POINT_POLICY
+{
+
+    ULONG       Policy;
+
+    ULONG       Scope;
+
+} AFSSetReparsePointPolicyCB;
+
 #endif /* _AFS_USER_STRUCT_H */
 
index c67cabe2e18e79db7c13c48b105a06c5a388134f..0385d973ee148e2e24c774066cb9cc86812d2ef6 100644 (file)
@@ -529,6 +529,14 @@ AFSCheckIoctlPermissions( IN ULONG ControlCode)
             }
             return STATUS_SUCCESS;
 
+       case IOCTL_AFS_SET_REPARSE_POLICY:
+
+           //
+           // Anyone can call this
+           //
+
+           return STATUS_SUCCESS;
+
         default:
 
             //
@@ -905,6 +913,23 @@ AFSProcessControlRequest( IN PIRP Irp)
                 break;
             }
 
+           case IOCTL_AFS_SET_REPARSE_POLICY:
+           {
+
+               AFSSetReparsePointPolicyCB *pPolicy = (AFSSetReparsePointPolicyCB *)Irp->AssociatedIrp.SystemBuffer;
+
+               if( pPolicy == NULL ||
+                   pIrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof( AFSSetReparsePointPolicyCB))
+               {
+                   ntStatus = STATUS_INVALID_PARAMETER;
+                   break;
+               }
+
+               ntStatus = AFSSetReparsePointPolicy( pPolicy);
+
+               break;
+           }
+
             default:
             {
 
index 4d42de3dff3d26aa4fe715ba4a6d25fe0b6b4d75..9bfe513088ba84d894c752d0c04269a6b2992caf 100644 (file)
@@ -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
  * - 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
@@ -2234,4 +2232,31 @@ try_exit:
     return ntStatus;
 }
 
+NTSTATUS
+AFSSetReparsePointPolicy( IN AFSSetReparsePointPolicyCB *PolicyCB)
+{
+
+    NTSTATUS    ntStatus = STATUS_SUCCESS;
+    AFSDeviceExt* pDeviceExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension;
+    ULONG       ulPolicy = 0;
+
+    __Enter
+    {
+
+       ulPolicy = (PolicyCB->Policy & AFS_REPARSE_POINT_VALID_POLICY_FLAGS);
+
+       if ( PolicyCB->Scope == AFS_REPARSE_POINT_POLICY_GLOBAL)
+       {
+
+           pDeviceExt->Specific.RDR.ReparsePointPolicy = ulPolicy;
+       }
+       else if ( PolicyCB->Scope == AFS_REPARSE_POINT_POLICY_AUTHGROUP)
+       {
+
+           ntStatus = STATUS_NOT_SUPPORTED;
+       }
+    }
+
+    return ntStatus;
+}
 
index 432fd2cad880bae6dd5267975dfa4d10ec108167..5b74a210df2464a7e94324237b4e1924d0c1e5a6 100644 (file)
@@ -516,6 +516,9 @@ AFSCheckThreadDacl( OUT GUID *AuthGroup);
 NTSTATUS
 AFSProcessSetProcessDacl( IN AFSProcessCB *ProcessCB);
 
+NTSTATUS
+AFSSetReparsePointPolicy( IN AFSSetReparsePointPolicyCB *Policy);
+
 //
 // Prototypes in AFSFastIoSupprt.cpp
 //