2 * Copyright (c) 2000-2004 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
28 // acls - SecurityServer ACL implementation
31 #include "connection.h"
33 #include <security_agent_client/agentclient.h>
34 #include <security_cdsa_utilities/acl_any.h>
35 #include <security_cdsa_utilities/acl_password.h>
36 #include <security_cdsa_utilities/acl_threshold.h>
40 // SecurityServerAcl is virtual
42 SecurityServerAcl::~SecurityServerAcl()
47 // Each SecurityServerAcl type must provide some indication of a database
48 // it is associated with. The default, naturally, is "none".
50 const Database
*SecurityServerAcl::relatedDatabase() const
55 // Provide environmental information to get/change-ACL calls.
56 // Also make them virtual so our children can override them.
58 void SecurityServerAcl::cssmChangeAcl(const AclEdit
&edit
, const AccessCredentials
*cred
)
60 SecurityServerEnvironment
env(*this);
61 ObjectAcl::cssmChangeAcl(edit
, cred
, &env
);
64 void SecurityServerAcl::cssmChangeOwner(const AclOwnerPrototype
&newOwner
,
65 const AccessCredentials
*cred
)
67 SecurityServerEnvironment
env(*this);
68 ObjectAcl::cssmChangeOwner(newOwner
, cred
, &env
);
73 // Modified validate() methods to connect all the conduits...
75 void SecurityServerAcl::validate(AclAuthorization auth
, const AccessCredentials
*cred
)
77 SecurityServerEnvironment
env(*this);
78 StLock
<Mutex
> objectSequence(aclSequence
);
79 StLock
<Mutex
> processSequence(Server::process().aclSequence
);
80 ObjectAcl::validate(auth
, cred
, &env
);
83 void SecurityServerAcl::validate(AclAuthorization auth
, const Context
&context
)
86 context
.get
<AccessCredentials
>(CSSM_ATTRIBUTE_ACCESS_CREDENTIALS
));
91 // Implement our environment object
93 uid_t
SecurityServerEnvironment::getuid() const
95 return Server::process().uid();
98 gid_t
SecurityServerEnvironment::getgid() const
100 return Server::process().gid();
103 pid_t
SecurityServerEnvironment::getpid() const
105 return Server::process().pid();
108 bool SecurityServerEnvironment::verifyCodeSignature(const CodeSigning::Signature
*signature
,
109 const CssmData
*comment
)
111 return Server::codeSignatures().verify(Server::process(), signature
, comment
);