Windows: Add IOCTL_AFS_GET_REPARSE_POLICY
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 17 Apr 2013 22:18:30 +0000 (18:18 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 8 May 2013 00:39:58 +0000 (17:39 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

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 f788dad..8cf87c6 100644 (file)
@@ -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
  * - 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 */
index 2a5f9ce..a53527f 100644 (file)
@@ -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
  * - 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 */
index 0385d97..614004b 100644 (file)
@@ -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
index 9bfe513..f607cfc 100644 (file)
@@ -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;
+}
index 5b74a21..c51a5f8 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
@@ -519,6 +517,9 @@ AFSProcessSetProcessDacl( IN AFSProcessCB *ProcessCB);
 NTSTATUS
 AFSSetReparsePointPolicy( IN AFSSetReparsePointPolicyCB *Policy);
 
+NTSTATUS
+AFSGetReparsePointPolicy( OUT AFSGetReparsePointPolicyCB *Policy);
+
 //
 // Prototypes in AFSFastIoSupprt.cpp
 //