2 * reactos security thin manager emulation of libcaptive
3 * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "reactos/ddk/setypes.h" /* self */
23 #include <glib/gmessages.h>
24 #include "reactos/ddk/status.h"
25 #include "reactos/ddk/exfuncs.h" /* for ExAllocatePool() */
29 * SeLockSubjectContext:
30 * @SubjectContext: Security context to read lock.
31 * %NULL value is forbidden.
33 * Obtain read locks on the security context @SubjectContext.
34 * @SubjectContext must be already acquired by SeCaptureSubjectContext().
36 * This functions is a NOP in libcaptive as there is no threading implemented.
37 * FIXME: No sanity checks are currently done by libcaptive.
39 VOID SeLockSubjectContext(IN PSECURITY_SUBJECT_CONTEXT SubjectContext)
41 g_return_if_fail(SubjectContext!=NULL);
43 /* NOP; TODO:thread */
48 * SeUnlockSubjectContext:
49 * @SubjectContext: Security context to unlock.
50 * %NULL value is forbidden.
52 * Release read locks on the security context @SubjectContext.
53 * @SubjectContext must be currently locked by SeLockSubjectContext().
55 * This functions is a NOP in libcaptive as there is no threading implemented.
56 * FIXME: No sanity checks are currently done by libcaptive.
58 VOID SeUnlockSubjectContext(IN PSECURITY_SUBJECT_CONTEXT SubjectContext)
60 g_return_if_fail(SubjectContext!=NULL);
62 /* NOP; TODO:thread */
68 * @ParentDescriptor: Optional parent object security descriptor.
69 * %NULL value is permitted.
70 * @ExplicitDescriptor: Optional overriding descriptor for the new object.
71 * FIXME: %NULL value should be permitted but it is currently forbidden by libcaptive.
72 * @NewDescriptor: Returns the new generated descriptor.
73 * %NULL value is forbidden.
74 * @IsDirectoryObject: Will the new object contain its subobjects?
75 * @SubjectContext: Security context of the caller.
76 * %NULL value is forbidden.
77 * @GenericMapping: Rights mapping (?).
78 * %NULL value is forbidden.
79 * @PoolType: #POOL_TYPE to allocate new @NewDescriptor from.
81 * libcaptive requires @ExplicitDescriptor to be presents and it simply
82 * copies it to the target @NewDescriptor.
84 * Returns: %STATUS_SUCCESS if @NewDescriptor was successfuly filled.
86 NTSTATUS SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL,
87 PSECURITY_DESCRIPTOR ExplicitDescriptor OPTIONAL,PSECURITY_DESCRIPTOR *NewDescriptor,
88 BOOLEAN IsDirectoryObject,PSECURITY_SUBJECT_CONTEXT SubjectContext,PGENERIC_MAPPING GenericMapping,POOL_TYPE PoolType)
90 g_return_val_if_fail(NewDescriptor!=NULL,STATUS_INVALID_PARAMETER);
91 g_return_val_if_fail(SubjectContext!=NULL,STATUS_INVALID_PARAMETER);
92 g_return_val_if_fail(GenericMapping!=NULL,STATUS_INVALID_PARAMETER);
94 /* #2 0x40067021 in SeAssignSecurity (ParentDescriptor=0x0,
95 * ExplicitDescriptor=0xbfffe7f4, NewDescriptor=0x40b5873c,
96 * IsDirectoryObject=0 '\0', SubjectContext=0x409d2ff0,
97 * GenericMapping=0x40088014, PoolType=1) at semgr.c:79
99 g_return_val_if_fail(ExplicitDescriptor!=NULL,STATUS_NOT_IMPLEMENTED); /* NOT YET IMPLEMENTED */
101 /* FIXME: Copy substructure recursively? */
102 *NewDescriptor=ExAllocatePool(PagedPool,sizeof(**NewDescriptor));
103 **NewDescriptor=*ExplicitDescriptor; /* copy the contents */
105 return STATUS_SUCCESS;