2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 // acl_process - Process-attribute ACL subject type.
23 // The default Environment provides data about the current process (the one that
24 // validate() is run in). If this isn't right for you (e.g. because you want to
25 // validate against a process on the other side of some IPC connection), you must
26 // make your own version of Environment and pass it to validate().
31 #include <Security/cssmacl.h>
37 class AclProcessSubjectSelector
38 : public PodWrapper
<AclProcessSubjectSelector
, CSSM_ACL_PROCESS_SUBJECT_SELECTOR
> {
40 AclProcessSubjectSelector()
41 { version
= CSSM_ACL_PROCESS_SELECTOR_CURRENT_VERSION
; mask
= 0; }
43 bool uses(uint32 m
) const { return mask
& m
; }
48 // The ProcessAclSubject matches process attributes securely identified
49 // by the system across IPC channels.
51 class ProcessAclSubject
: public AclSubject
{
53 bool validate(const AclValidationContext
&baseCtx
) const;
54 CssmList
toList(CssmAllocator
&alloc
) const;
56 ProcessAclSubject(const AclProcessSubjectSelector
&selector
)
57 : AclSubject(CSSM_ACL_SUBJECT_TYPE_PROCESS
),
60 void exportBlob(Writer::Counter
&pub
, Writer::Counter
&priv
);
61 void exportBlob(Writer
&pub
, Writer
&priv
);
63 IFDUMP(void debugDump() const);
66 class Environment
: public virtual AclValidationEnvironment
{
68 virtual uid_t
getuid() const; // retrieve effective userid to match
69 virtual gid_t
getgid() const; // retrieve effective groupid to match
73 class Maker
: public AclSubject::Maker
{
75 Maker() : AclSubject::Maker(CSSM_ACL_SUBJECT_TYPE_PROCESS
) { }
76 ProcessAclSubject
*make(const TypedList
&list
) const;
77 ProcessAclSubject
*make(Version
, Reader
&pub
, Reader
&priv
) const;
81 AclProcessSubjectSelector select
;
84 } // end namespace Security