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
23 #include "connection.h"
25 #include "SecurityAgentClient.h"
26 #include <Security/acl_any.h>
27 #include <Security/acl_password.h>
28 #include <Security/acl_threshold.h>
32 // SecurityServerAcl is virtual
34 SecurityServerAcl::~SecurityServerAcl()
39 // Each SecurityServerAcl type must provide some indication of a database
40 // it is associated with. The default, naturally, is "none".
42 const Database
*SecurityServerAcl::relatedDatabase() const
47 // Provide environmental information to get/change-ACL calls.
48 // Also make them virtual so our children can override them.
50 void SecurityServerAcl::cssmChangeAcl(const AclEdit
&edit
, const AccessCredentials
*cred
)
52 SecurityServerEnvironment
env(*this);
53 ObjectAcl::cssmChangeAcl(edit
, cred
, &env
);
56 void SecurityServerAcl::cssmChangeOwner(const AclOwnerPrototype
&newOwner
,
57 const AccessCredentials
*cred
)
59 SecurityServerEnvironment
env(*this);
60 ObjectAcl::cssmChangeOwner(newOwner
, cred
, &env
);
65 // Modified validate() methods to connect all the conduits...
67 void SecurityServerAcl::validate(AclAuthorization auth
, const AccessCredentials
*cred
)
69 SecurityServerEnvironment
env(*this);
70 StLock
<Mutex
> objectSequence(aclSequence
);
71 StLock
<Mutex
> processSequence(Server::connection().process
.aclSequence
);
72 ObjectAcl::validate(auth
, cred
, &env
);
75 void SecurityServerAcl::validate(AclAuthorization auth
, const Context
&context
)
78 context
.get
<AccessCredentials
>(CSSM_ATTRIBUTE_ACCESS_CREDENTIALS
));
83 // Implement our environment object
85 uid_t
SecurityServerEnvironment::getuid() const
87 return Server::connection().process
.uid();
90 gid_t
SecurityServerEnvironment::getgid() const
92 return Server::connection().process
.gid();
95 pid_t
SecurityServerEnvironment::getpid() const
97 return Server::connection().process
.pid();
100 bool SecurityServerEnvironment::verifyCodeSignature(const CodeSigning::Signature
*signature
,
101 const CssmData
*comment
)
103 return Server::codeSignatures().verify(Server::connection().process
, signature
, comment
);