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_comment - "ignore" ACL subject type
22 // This subject will never match anything - its presence is effectively ignored.
23 // Its usefulness lies in the fact that COMMENT type ACL subjects are valid ACL
24 // subjects that preserve their contents as uninterpreted data blobs. This allows
25 // you to keep information in an ACL that can be retrieved later. In particular,
26 // you can "prefix" any external ACL subject representation with an ACL_COMMENT
27 // header, which turns it into an inactive comment until you remove the prefix.
30 // (1) All contents of a comment ACL are public.
31 // (2) While there is a COMMENT sample type, it is in no way related to this subject
32 // type. Validation of a COMMENT acl subject never examines any samples.
37 #include <Security/cssmacl.h>
44 // The ANY subject simply matches everything. No sweat.
46 class CommentAclSubject
: public AclSubject
{
48 CommentAclSubject::CommentAclSubject(CSSM_LIST
*list
, uint32 size
)
49 : AclSubject(CSSM_ACL_SUBJECT_TYPE_COMMENT
), mComment(list
), mSize(size
) { }
50 ~CommentAclSubject() { CssmAllocator::standard().free(mComment
); }
52 bool validate(const AclValidationContext
&ctx
) const;
53 CssmList
toList(CssmAllocator
&alloc
) const;
55 void exportBlob(Writer::Counter
&pub
, Writer::Counter
&priv
);
56 void exportBlob(Writer
&pub
, Writer
&priv
);
58 class Maker
: public AclSubject::Maker
{
60 Maker() : AclSubject::Maker(CSSM_ACL_SUBJECT_TYPE_COMMENT
) { }
61 CommentAclSubject
*make(const TypedList
&list
) const;
62 CommentAclSubject
*make(Reader
&pub
, Reader
&priv
) const;
66 CSSM_LIST
*mComment
; // list form preserved
67 uint32 mSize
; // size of mComment blob
70 } // end namespace Security