@implemented and @unimplemented comments for ntoskrnl/ob/*.c
[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 }
31
32
33 /*
34 * @unimplemented
35 */
36 NTSTATUS STDCALL
37 ObGetObjectSecurity(IN PVOID Object,
38 OUT PSECURITY_DESCRIPTOR *SecurityDescriptor,
39 OUT PBOOLEAN MemoryAllocated)
40 {
41 UNIMPLEMENTED;
42 }
43
44
45 /*
46 * @unimplemented
47 */
48 VOID STDCALL
49 ObReleaseObjectSecurity(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
50 IN BOOLEAN MemoryAllocated)
51 {
52 UNIMPLEMENTED;
53 }
54
55
56 NTSTATUS STDCALL
57 NtQuerySecurityObject(IN HANDLE Handle,
58 IN SECURITY_INFORMATION SecurityInformation,
59 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
60 IN ULONG Length,
61 OUT PULONG ResultLength)
62 {
63 POBJECT_HEADER Header;
64 PVOID Object;
65 NTSTATUS Status;
66
67 Status = ObReferenceObjectByHandle(Handle,
68 0,
69 NULL,
70 KeGetPreviousMode(),
71 &Object,
72 NULL);
73 if (!NT_SUCCESS(Status))
74 {
75 return(Status);
76 }
77
78 Header = BODY_TO_HEADER(Object);
79 if (Header->ObjectType != NULL &&
80 Header->ObjectType->Security != NULL)
81 {
82 Status = Header->ObjectType->Security(Object,
83 QuerySecurityDescriptor,
84 SecurityInformation,
85 SecurityDescriptor,
86 &Length);
87 *ResultLength = Length;
88 }
89 else
90 {
91 Status = STATUS_NOT_IMPLEMENTED;
92 }
93
94 ObDereferenceObject(Object);
95
96 return(Status);
97 }
98
99
100 NTSTATUS STDCALL
101 NtSetSecurityObject(IN HANDLE Handle,
102 IN SECURITY_INFORMATION SecurityInformation,
103 IN PSECURITY_DESCRIPTOR SecurityDescriptor)
104 {
105 POBJECT_HEADER Header;
106 PVOID Object;
107 NTSTATUS Status;
108
109 Status = ObReferenceObjectByHandle(Handle,
110 0,
111 NULL,
112 KeGetPreviousMode(),
113 &Object,
114 NULL);
115 if (!NT_SUCCESS(Status))
116 {
117 return(Status);
118 }
119
120 Header = BODY_TO_HEADER(Object);
121 if (Header->ObjectType != NULL &&
122 Header->ObjectType->Security != NULL)
123 {
124 Status = Header->ObjectType->Security(Object,
125 SetSecurityDescriptor,
126 SecurityInformation,
127 SecurityDescriptor,
128 NULL);
129 }
130 else
131 {
132 Status = STATUS_NOT_IMPLEMENTED;
133 }
134
135 ObDereferenceObject(Object);
136
137 return(Status);
138 }
139
140 /* EOF */