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>
34 #ifdef _CPP_ACL_PROCESS
41 class AclProcessSubjectSelector
42 : public PodWrapper
<AclProcessSubjectSelector
, CSSM_ACL_PROCESS_SUBJECT_SELECTOR
> {
44 AclProcessSubjectSelector()
45 { version
= CSSM_ACL_PROCESS_SELECTOR_CURRENT_VERSION
; mask
= 0; }
47 bool uses(uint32 m
) const { return mask
& m
; }
52 // The ProcessAclSubject matches process attributes securely identified
53 // by the system across IPC channels.
55 class ProcessAclSubject
: public SimpleAclSubject
{
57 bool validate(const AclValidationContext
&baseCtx
, const TypedList
&sample
) const;
58 CssmList
toList(CssmAllocator
&alloc
) const;
60 ProcessAclSubject(const AclProcessSubjectSelector
&selector
)
61 : SimpleAclSubject(CSSM_ACL_SUBJECT_TYPE_PROCESS
, CSSM_SAMPLE_TYPE_PROCESS
),
64 void exportBlob(Writer::Counter
&pub
, Writer::Counter
&priv
);
65 void exportBlob(Writer
&pub
, Writer
&priv
);
67 IFDUMP(void debugDump() const);
70 class Environment
: public virtual AclValidationEnvironment
{
72 virtual uid_t
getuid() const; // retrieve effective userid to match
73 virtual gid_t
getgid() const; // retrieve effective groupid to match
77 class Maker
: public AclSubject::Maker
{
79 Maker() : AclSubject::Maker(CSSM_ACL_SUBJECT_TYPE_PROCESS
) { }
80 ProcessAclSubject
*make(const TypedList
&list
) const;
81 ProcessAclSubject
*make(Version
, Reader
&pub
, Reader
&priv
) const;
85 AclProcessSubjectSelector select
;
88 } // end namespace Security
90 #ifdef _CPP_ACL_PROCESS