update for HEAD-2003091401
[reactos.git] / 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 /*
57  * @unimplemented
58  */
59 NTSTATUS STDCALL
60 NtQuerySecurityObject(IN HANDLE Handle,
61                       IN SECURITY_INFORMATION SecurityInformation,
62                       OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
63                       IN ULONG Length,
64                       OUT PULONG ResultLength)
65 {
66   POBJECT_HEADER Header;
67   PVOID Object;
68   NTSTATUS Status;
69
70   Status = ObReferenceObjectByHandle(Handle,
71                                      0,
72                                      NULL,
73                                      KeGetPreviousMode(),
74                                      &Object,
75                                      NULL);
76   if (!NT_SUCCESS(Status))
77     {
78       return(Status);
79     }
80
81   Header = BODY_TO_HEADER(Object);
82   if (Header->ObjectType != NULL &&
83       Header->ObjectType->Security != NULL)
84     {
85       Status = Header->ObjectType->Security(Object,
86                                             QuerySecurityDescriptor,
87                                             SecurityInformation,
88                                             SecurityDescriptor,
89                                             &Length);
90       *ResultLength = Length;
91     }
92   else
93     {
94       Status = STATUS_NOT_IMPLEMENTED;
95     }
96
97   ObDereferenceObject(Object);
98
99   return(Status);
100 }
101
102
103 /*
104  * @unimplemented
105  */
106 NTSTATUS STDCALL
107 NtSetSecurityObject(IN HANDLE Handle,
108                     IN SECURITY_INFORMATION SecurityInformation,
109                     IN PSECURITY_DESCRIPTOR SecurityDescriptor)
110 {
111   POBJECT_HEADER Header;
112   PVOID Object;
113   NTSTATUS Status;
114
115   Status = ObReferenceObjectByHandle(Handle,
116                                      0,
117                                      NULL,
118                                      KeGetPreviousMode(),
119                                      &Object,
120                                      NULL);
121   if (!NT_SUCCESS(Status))
122     {
123       return(Status);
124     }
125
126   Header = BODY_TO_HEADER(Object);
127   if (Header->ObjectType != NULL &&
128       Header->ObjectType->Security != NULL)
129     {
130       Status = Header->ObjectType->Security(Object,
131                                             SetSecurityDescriptor,
132                                             SecurityInformation,
133                                             SecurityDescriptor,
134                                             NULL);
135     }
136   else
137     {
138       Status = STATUS_NOT_IMPLEMENTED;
139     }
140
141   ObDereferenceObject(Object);
142
143   return(Status);
144 }
145
146 /* EOF */