ReactOS 0.4.15-dev-8131-g4988de4
seinfo.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Named Pipe FileSystem
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/filesystems/npfs/seinfo.c
5 * PURPOSE: Pipes Security Information
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "npfs.h"
12
13// File ID number for NPFS bugchecking support
14#define NPFS_BUGCHECK_FILE_ID (NPFS_BUGCHECK_SEINFO)
15
16/* FUNCTIONS ******************************************************************/
17
21 IN PIRP Irp)
22{
23 NODE_TYPE_CODE NodeTypeCode;
24 PIO_STACK_LOCATION IoStack;
28 ULONG NamedPipeEnd;
29 PAGED_CODE();
30
32
33 NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
34 (PVOID*)&Fcb,
35 &Ccb,
36 &NamedPipeEnd);
37 if (!NodeTypeCode) return STATUS_PIPE_DISCONNECTED;
38 if (NodeTypeCode != NPFS_NTC_CCB) return STATUS_INVALID_PARAMETER;
39
40 Status = SeQuerySecurityDescriptorInfo(&IoStack->Parameters.QuerySecurity.SecurityInformation,
41 Irp->UserBuffer,
42 &IoStack->Parameters.QuerySecurity.Length,
43 &Fcb->SecurityDescriptor);
45 {
46 Irp->IoStatus.Information = IoStack->Parameters.QuerySecurity.Length;
48 }
49
50 return Status;
51}
52
56 IN PIRP Irp)
57{
58 NODE_TYPE_CODE NodeTypeCode;
59 PIO_STACK_LOCATION IoStack;
63 ULONG NamedPipeEnd;
64 PSECURITY_DESCRIPTOR OldSecurityDescriptor;
65 PSECURITY_DESCRIPTOR TempSecurityDescriptor;
66 PSECURITY_DESCRIPTOR NewSecurityDescriptor;
67 PAGED_CODE();
68
70
71 NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
72 (PVOID*)&Fcb,
73 &Ccb,
74 &NamedPipeEnd);
75 if (!NodeTypeCode) return STATUS_PIPE_DISCONNECTED;
76 if (NodeTypeCode != NPFS_NTC_CCB) return STATUS_INVALID_PARAMETER;
77
78 OldSecurityDescriptor = TempSecurityDescriptor = Fcb->SecurityDescriptor;
80 &IoStack->Parameters.SetSecurity.SecurityInformation,
81 IoStack->Parameters.SetSecurity.SecurityDescriptor,
82 &TempSecurityDescriptor,
85 if (!NT_SUCCESS(Status)) return Status;
86
87 Status = ObLogSecurityDescriptor(TempSecurityDescriptor, &NewSecurityDescriptor, 1);
88 ASSERT(TempSecurityDescriptor != OldSecurityDescriptor);
89 ExFreePoolWithTag(TempSecurityDescriptor, 0);
90
91 if (!NT_SUCCESS(Status)) return Status;
92
93 Fcb->SecurityDescriptor = NewSecurityDescriptor;
94 ObDereferenceSecurityDescriptor(OldSecurityDescriptor, 1);
95 return Status;
96}
97
101 IN PIRP Irp)
102{
104 PAGED_CODE();
105
108
110
111 NpReleaseVcb();
113
114 if (Status != STATUS_PENDING)
115 {
116 Irp->IoStatus.Status = Status;
118 }
119
120 return Status;
121}
122
124NTAPI
126 IN PIRP Irp)
127{
129 PAGED_CODE();
130
133
135
136 NpReleaseVcb();
138
139 if (Status != STATUS_PENDING)
140 {
141 Irp->IoStatus.Status = Status;
143 }
144
145 return Status;
146}
147
148/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
FORCEINLINE VOID NpAcquireExclusiveVcb(VOID)
Definition: npfs.h:336
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define PagedPool
Definition: env_spec_w32.h:308
NODE_TYPE_CODE NTAPI NpDecodeFileObject(IN PFILE_OBJECT FileObject, OUT PVOID *PrimaryContext OPTIONAL, OUT PNP_CCB *Ccb, OUT PULONG NamedPipeEnd OPTIONAL)
Definition: fileobsup.c:20
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
PGENERIC_MAPPING NTAPI IoGetFileObjectGenericMapping(VOID)
Definition: file.c:3267
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:412
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTATUS NTAPI ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor, OUT PSECURITY_DESCRIPTOR *OutputSecurityDescriptor, IN ULONG RefBias)
Definition: obsdcach.c:364
VOID NTAPI ObDereferenceSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Count)
Definition: obsdcach.c:287
NTSTATUS NTAPI NpFsdQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:100
NTSTATUS NTAPI NpCommonSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:55
NTSTATUS NTAPI NpFsdSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:125
NTSTATUS NTAPI NpCommonQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: seinfo.c:20
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
struct _IO_STACK_LOCATION::@3983::@4002 SetSecurity
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _IO_STACK_LOCATION::@3983::@4001 QuerySecurity
union _IO_STACK_LOCATION::@1568 Parameters
Definition: npfs.h:259
Definition: npfs.h:229
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:604
NTKERNELAPI NTSTATUS NTAPI SeSetSecurityDescriptorInfo(_In_opt_ PVOID Object, _In_ PSECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, _In_ POOL_TYPE PoolType, _In_ PGENERIC_MAPPING GenericMapping)
NTKERNELAPI NTSTATUS NTAPI SeQuerySecurityDescriptorInfo(_In_ PSECURITY_INFORMATION SecurityInformation, _Out_writes_bytes_(*Length) PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PULONG Length, _Inout_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor)