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 // acls - SecurityServer ACL implementation
25 #include "securityserver.h"
26 #include <Security/cssmacl.h>
27 #include <Security/acl_process.h>
28 #include <Security/acl_codesigning.h>
36 // ACL implementation as used by the SecurityServer
38 class SecurityServerAcl
: public ObjectAcl
{
40 SecurityServerAcl(AclKind k
, CssmAllocator
&alloc
) :ObjectAcl(alloc
), mKind(k
) { }
41 virtual ~SecurityServerAcl();
43 AclKind
kind() const { return mKind
; }
45 // validation calls restated
46 void validate(AclAuthorization auth
, const AccessCredentials
*cred
);
47 void validate(AclAuthorization auth
, const Context
&context
);
49 void cssmChangeAcl(const AclEdit
&edit
, const AccessCredentials
*cred
);
50 void cssmChangeOwner(const AclOwnerPrototype
&newOwner
, const AccessCredentials
*cred
);
52 virtual const Database
*relatedDatabase() const;
54 // aclSequence is taken to serialize ACL validations to pick up mutual changes
63 // Our implementation of an ACL validation environment uses information
64 // derived from a Connection object. It implements context for
65 // -- ProcessAclSubjects (getuid/getgid)
66 // -- KeychainPromptAclSubjects (connection link)
68 class SecurityServerEnvironment
: public virtual AclValidationEnvironment
,
69 public virtual ProcessAclSubject::Environment
,
70 public virtual CodeSignatureAclSubject::Environment
{
72 SecurityServerEnvironment(const SecurityServerAcl
&baseAcl
)
75 const SecurityServerAcl
&acl
;
77 const Database
*database() const { return acl
.relatedDatabase(); }
81 bool verifyCodeSignature(const CodeSigning::Signature
*signature
, const CssmData
*comment
);