d93165cda2c686148ebeccfb05864f0156387ef7
[reactos.git] / reactos / ntoskrnl / ob / security.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Security manager
5 * FILE: ntoskrnl/ob/security.c
6 * PROGRAMER: ?
7 * REVISION HISTORY:
8 * 26/07/98: Added stubs for security functions
9 */
10
11 /* INCLUDES *****************************************************************/
12
13 #include <ddk/ntddk.h>
14 #include <internal/ob.h>
15
16 #include <internal/debug.h>
17
18 /* FUNCTIONS ***************************************************************/
19
20 /*
21 * @unimplemented
22 */
23 NTSTATUS STDCALL
24 ObAssignSecurity(IN PACCESS_STATE AccessState,
25 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
26 IN PVOID Object,
27 IN POBJECT_TYPE Type)
28 {
29 UNIMPLEMENTED;
30 return(STATUS_NOT_IMPLEMENTED);
31 }
32
33
34 /*
35 * @unimplemented
36 */
37 NTSTATUS STDCALL
38 ObGetObjectSecurity(IN PVOID Object,
39 OUT PSECURITY_DESCRIPTOR *SecurityDescriptor,
40 OUT PBOOLEAN MemoryAllocated)
41 {
42 UNIMPLEMENTED;
43 return(STATUS_NOT_IMPLEMENTED);
44 }
45
46
47 /*
48 * @unimplemented
49 */
50 VOID STDCALL
51 ObReleaseObjectSecurity(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
52 IN BOOLEAN MemoryAllocated)
53 {
54 UNIMPLEMENTED;
55 }
56
57
58 /*
59 * @unimplemented
60 */
61 NTSTATUS STDCALL
62 NtQuerySecurityObject(IN HANDLE Handle,
63 IN SECURITY_INFORMATION SecurityInformation,
64 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
65 IN ULONG Length,
66 OUT PULONG ResultLength)
67 {
68 POBJECT_HEADER Header;
69 PVOID Object;
70 NTSTATUS Status;
71
72 Status = ObReferenceObjectByHandle(Handle,
73 0,
74 NULL,
75 KeGetPreviousMode(),
76 &Object,
77 NULL);
78 if (!NT_SUCCESS(Status))
79 {
80 return(Status);
81 }
82
83 Header = BODY_TO_HEADER(Object);
84 if (Header->ObjectType != NULL &&
85 Header->ObjectType->Security != NULL)
86 {
87 Status = Header->ObjectType->Security(Object,
88 QuerySecurityDescriptor,
89 SecurityInformation,
90 SecurityDescriptor,
91 &Length);
92 *ResultLength = Length;
93 }
94 else
95 {
96 Status = STATUS_NOT_IMPLEMENTED;
97 }
98
99 ObDereferenceObject(Object);
100
101 return(Status);
102 }
103
104
105 /*
106 * @unimplemented
107 */
108 NTSTATUS STDCALL
109 NtSetSecurityObject(IN HANDLE Handle,
110 IN SECURITY_INFORMATION SecurityInformation,
111 IN PSECURITY_DESCRIPTOR SecurityDescriptor)
112 {
113 POBJECT_HEADER Header;
114 PVOID Object;
115 NTSTATUS Status;
116
117 Status = ObReferenceObjectByHandle(Handle,
118 0,
119 NULL,
120 KeGetPreviousMode(),
121 &Object,
122 NULL);
123 if (!NT_SUCCESS(Status))
124 {
125 return(Status);
126 }
127
128 Header = BODY_TO_HEADER(Object);
129 if (Header->ObjectType != NULL &&
130 Header->ObjectType->Security != NULL)
131 {
132 Status = Header->ObjectType->Security(Object,
133 SetSecurityDescriptor,
134 SecurityInformation,
135 SecurityDescriptor,
136 NULL);
137 }
138 else
139 {
140 Status = STATUS_NOT_IMPLEMENTED;
141 }
142
143 ObDereferenceObject(Object);
144
145 return(Status);
146 }
147
148 /* EOF */