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.
22 // Definitions of structures which define the schema, including attributes
23 // and indexes, for the standard tables that are part of the MDS database.
26 #include "MDSSchema.h"
27 #include <Security/mds_schema.h>
34 * There appears to be a bug in AppleDatabase which prevents our assigning
35 * schema to the meta-tables.
37 #define DEFINE_META_TABLES 0
39 /* indicates "no MDSNameValuePair table" in a RELATION_INFO declaration. */
43 // Schema for the lone table in the Object Directory Database.
45 static const CSSM_DB_ATTRIBUTE_INFO objectAttrs
[] = {
46 DB_ATTRIBUTE(ModuleID
, STRING
),
47 DB_ATTRIBUTE(Manifest
, BLOB
),
48 DB_ATTRIBUTE(ModuleName
, STRING
),
49 DB_ATTRIBUTE(Path
, STRING
),
50 DB_ATTRIBUTE(ProductVersion
, STRING
),
52 /* not in the CDSA spec; denotes a plugin which is statically linked to CSSM */
53 DB_ATTRIBUTE(BuiltIn
, UINT32
),
56 static const CSSM_DB_INDEX_INFO objectIndex
[] = {
57 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
)
60 const RelationInfo kObjectRelation
=
61 RELATION_INFO(MDS_OBJECT_RECORDTYPE
,
63 NO_NVP
, // no symbolic names
67 // Schema for the various tables in the CDSA Directory Database.
71 static const CSSM_DB_ATTRIBUTE_INFO cssmAttrs
[] =
73 DB_ATTRIBUTE(ModuleID
, STRING
),
74 DB_ATTRIBUTE(CDSAVersion
, STRING
),
75 DB_ATTRIBUTE(Vendor
, STRING
),
76 DB_ATTRIBUTE(Desc
, STRING
),
77 DB_ATTRIBUTE(NativeServices
, UINT32
),
80 static const MDSNameValuePair
*cssmNvp
[] = {
81 NULL
, NULL
, NULL
, NULL
,
85 static const CSSM_DB_INDEX_INFO cssmIndex
[] =
87 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
)
91 static const CSSM_DB_ATTRIBUTE_INFO krmmAttrs
[] =
93 DB_ATTRIBUTE(CSSMGuid
, STRING
),
94 DB_ATTRIBUTE(PolicyType
, UINT32
),
95 DB_ATTRIBUTE(PolicyName
, STRING
),
96 DB_ATTRIBUTE(PolicyPath
, STRING
),
97 DB_ATTRIBUTE(PolicyInfo
, BLOB
),
98 DB_ATTRIBUTE(PolicyManifest
, BLOB
),
100 * This attribute is not defined in the CDSA spec. It's only here, in the schema,
101 * to avoid throwing exceptions when searching a DB for any records associated
102 * with a specified GUID - in all other schemas, a guid is specified as a
105 DB_ATTRIBUTE(ModuleID
, STRING
),
108 static const MDSNameValuePair
*krmmNvp
[] = {
109 NULL
, MDSKrPolicyTypeNames
, NULL
, NULL
,
113 static const CSSM_DB_INDEX_INFO krmmIndex
[] =
115 UNIQUE_INDEX_ATTRIBUTE(CSSMGuid
, STRING
),
116 UNIQUE_INDEX_ATTRIBUTE(PolicyType
, UINT32
)
120 static const CSSM_DB_ATTRIBUTE_INFO emmAttrs
[] =
122 DB_ATTRIBUTE(ModuleID
, STRING
),
123 DB_ATTRIBUTE(Manifest
, BLOB
),
124 DB_ATTRIBUTE(ModuleName
, STRING
),
125 DB_ATTRIBUTE(Path
, STRING
),
126 DB_ATTRIBUTE(CDSAVersion
, STRING
),
127 DB_ATTRIBUTE(EMMSpecVersion
, STRING
),
128 DB_ATTRIBUTE(Desc
, STRING
),
129 DB_ATTRIBUTE(PolicyStmt
, BLOB
),
130 DB_ATTRIBUTE(EmmVersion
, STRING
),
131 DB_ATTRIBUTE(EmmVendor
, STRING
),
132 DB_ATTRIBUTE(EmmType
, UINT32
), // does this need a name/value table?
135 static const CSSM_DB_INDEX_INFO emmIndex
[] =
137 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
)
140 // Primary EMM Service Provider Relation.
141 static const CSSM_DB_ATTRIBUTE_INFO emmPrimaryAttrs
[] =
143 DB_ATTRIBUTE(ModuleID
, STRING
),
144 DB_ATTRIBUTE(SSID
, UINT32
),
145 DB_ATTRIBUTE(ServiceType
, UINT32
),
146 DB_ATTRIBUTE(Manifest
, BLOB
),
147 DB_ATTRIBUTE(ModuleName
, STRING
),
148 DB_ATTRIBUTE(ProductVersion
, STRING
),
149 DB_ATTRIBUTE(Vendor
, STRING
),
150 DB_ATTRIBUTE(SampleTypes
, MULTI_UINT32
),
151 DB_ATTRIBUTE(AclSubjectTypes
, MULTI_UINT32
),
152 DB_ATTRIBUTE(AuthTags
, MULTI_UINT32
),
153 DB_ATTRIBUTE(EmmSpecVersion
, STRING
),
156 static const MDSNameValuePair
*emmPrimaryNvp
[] = {
157 NULL
, NULL
, NULL
, NULL
,
158 NULL
, NULL
, NULL
, MDSSampleTypeNames
,
159 MDSAclSubjectTypeNames
,
164 static const CSSM_DB_INDEX_INFO emmPrimaryIndex
[] =
166 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
167 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
),
168 UNIQUE_INDEX_ATTRIBUTE(ServiceType
, UINT32
)
172 static const CSSM_DB_ATTRIBUTE_INFO commonAttrs
[] =
174 DB_ATTRIBUTE(ModuleID
, STRING
),
175 DB_ATTRIBUTE(Manifest
, BLOB
),
176 DB_ATTRIBUTE(ModuleName
, STRING
),
177 DB_ATTRIBUTE(Path
, STRING
),
178 DB_ATTRIBUTE(CDSAVersion
, STRING
),
179 DB_ATTRIBUTE(Desc
, STRING
),
180 DB_ATTRIBUTE(DynamicFlag
, UINT32
),
181 DB_ATTRIBUTE(MultiThreadFlag
, UINT32
),
182 DB_ATTRIBUTE(ServiceMask
, UINT32
),
185 static const MDSNameValuePair
*commonNvp
[] = {
186 NULL
, NULL
, NULL
, NULL
,
187 NULL
, NULL
, NULL
, NULL
,
191 static const CSSM_DB_INDEX_INFO commonIndex
[] =
193 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
)
196 // CSP Primary Relation.
197 static const CSSM_DB_ATTRIBUTE_INFO cspPrimaryAttrs
[] =
199 DB_ATTRIBUTE(ModuleID
, STRING
),
200 DB_ATTRIBUTE(SSID
, UINT32
),
201 DB_ATTRIBUTE(Manifest
, BLOB
),
202 DB_ATTRIBUTE(ModuleName
, STRING
),
203 DB_ATTRIBUTE(ProductVersion
, STRING
),
204 DB_ATTRIBUTE(Vendor
, STRING
),
205 DB_ATTRIBUTE(CspType
, UINT32
),
206 DB_ATTRIBUTE(CspFlags
, UINT32
),
207 DB_ATTRIBUTE(CspCustomFlags
, UINT32
),
208 DB_ATTRIBUTE(UseeTags
, MULTI_UINT32
),
209 DB_ATTRIBUTE(SampleTypes
, MULTI_UINT32
),
210 DB_ATTRIBUTE(AclSubjectTypes
, MULTI_UINT32
),
211 DB_ATTRIBUTE(AuthTags
, MULTI_UINT32
),
214 static const MDSNameValuePair
*cspPrimaryNvp
[] = {
215 NULL
, NULL
, NULL
, NULL
,
222 MDSAclSubjectTypeNames
,
226 static const CSSM_DB_INDEX_INFO cspPrimaryIndex
[] =
228 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
229 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
232 // CSP Capabilities Relation.
233 static const CSSM_DB_ATTRIBUTE_INFO cspCapabilitiesAttrs
[] =
235 DB_ATTRIBUTE(ModuleID
, STRING
),
236 DB_ATTRIBUTE(SSID
, UINT32
),
237 DB_ATTRIBUTE(UseeTag
, UINT32
),
238 DB_ATTRIBUTE(ContextType
, UINT32
),
239 DB_ATTRIBUTE(AlgType
, UINT32
),
240 DB_ATTRIBUTE(GroupId
, UINT32
),
241 DB_ATTRIBUTE(AttributeType
, UINT32
),
242 DB_ATTRIBUTE(AttributeValue
, MULTI_UINT32
),
243 DB_ATTRIBUTE(Description
, STRING
),
245 static const MDSNameValuePair
*cspCapabilitiesNvp
[] = {
252 MDSAttributeTypeNames
,
257 static const CSSM_DB_INDEX_INFO cspCapabilitiesIndex
[] =
259 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
260 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
),
261 UNIQUE_INDEX_ATTRIBUTE(UseeTag
, UINT32
),
262 UNIQUE_INDEX_ATTRIBUTE(ContextType
, UINT32
),
263 UNIQUE_INDEX_ATTRIBUTE(AlgType
, UINT32
),
264 UNIQUE_INDEX_ATTRIBUTE(GroupId
, UINT32
),
265 UNIQUE_INDEX_ATTRIBUTE(AttributeType
, STRING
)
268 // special case "subschema" for parsing CSPCapabilities. These arrays correspond
269 // dictionaries within a CSPCapabilities info file; they are not part of
270 // our DB's schema. They are declared only to streamline the
271 // MDSAttrParser::parseCspCapabilitiesRecord function. No index info is needed.
273 // top-level info, applied to the dictionary for the whole file.
274 static const CSSM_DB_ATTRIBUTE_INFO kAttributesCSPCapabilitiesDict1
[] =
276 DB_ATTRIBUTE(ModuleID
, STRING
),
277 DB_ATTRIBUTE(SSID
, UINT32
),
279 const RelationInfo CSPCapabilitiesDict1RelInfo
=
281 MDS_CDSADIR_CSP_CAPABILITY_RECORDTYPE
, // actually a don't care
282 kAttributesCSPCapabilitiesDict1
,
283 NULL
, // no NVP needed
286 // "Capabilities" is an array of dictionaries of these
287 static const CSSM_DB_ATTRIBUTE_INFO kAttributesCSPCapabilitiesDict2
[] =
289 DB_ATTRIBUTE(AlgType
, UINT32
),
290 DB_ATTRIBUTE(ContextType
, UINT32
),
291 DB_ATTRIBUTE(UseeTag
, UINT32
),
292 DB_ATTRIBUTE(Description
, STRING
),
294 static const MDSNameValuePair
*CSPCapabilitiesDict2Nvp
[] = {
300 const RelationInfo CSPCapabilitiesDict2RelInfo
=
302 MDS_CDSADIR_CSP_CAPABILITY_RECORDTYPE
, // actually a don't care
303 kAttributesCSPCapabilitiesDict2
,
304 CSPCapabilitiesDict2Nvp
,
307 // Within a Capabilities array, the Attributes array is an array of
308 // Dictionaries of these.
309 static const CSSM_DB_ATTRIBUTE_INFO kAttributesCSPCapabilitiesDict3
[] =
311 DB_ATTRIBUTE(AttributeType
, UINT32
),
312 DB_ATTRIBUTE(AttributeValue
, MULTI_UINT32
),
314 static const MDSNameValuePair
*CSPCapabilitiesDict3Nvp
[] = {
315 MDSAttributeTypeNames
,
318 const RelationInfo CSPCapabilitiesDict3RelInfo
=
320 MDS_CDSADIR_CSP_CAPABILITY_RECORDTYPE
, // actually a don't care
321 kAttributesCSPCapabilitiesDict3
,
322 CSPCapabilitiesDict3Nvp
,
327 // CSP Encapsulated Products Relation.
328 static const CSSM_DB_ATTRIBUTE_INFO cspEncapsulatedAttrs
[] =
330 DB_ATTRIBUTE(ModuleID
, STRING
),
331 DB_ATTRIBUTE(SSID
, UINT32
),
332 DB_ATTRIBUTE(ProductDesc
, STRING
),
333 DB_ATTRIBUTE(ProductVendor
, STRING
),
334 DB_ATTRIBUTE(ProductVersion
, STRING
),
335 DB_ATTRIBUTE(ProductFlags
, UINT32
),
336 DB_ATTRIBUTE(CustomFlags
, UINT32
),
337 DB_ATTRIBUTE(StandardDesc
, STRING
),
338 DB_ATTRIBUTE(StandardVersion
, STRING
),
339 DB_ATTRIBUTE(ReaderDesc
, STRING
),
340 DB_ATTRIBUTE(ReaderVendor
, STRING
),
341 DB_ATTRIBUTE(ReaderVersion
, STRING
),
342 DB_ATTRIBUTE(ReaderFirmwareVersion
, STRING
),
343 DB_ATTRIBUTE(ReaderFlags
, UINT32
),
344 DB_ATTRIBUTE(ReaderCustomFlags
, UINT32
),
345 DB_ATTRIBUTE(ReaderSerialNumber
, STRING
),
348 static const MDSNameValuePair
*cspEncapsulatedNvp
[] = {
349 NULL
, NULL
, NULL
, NULL
,
350 NULL
, NULL
, NULL
, NULL
,
351 NULL
, NULL
, NULL
, NULL
,
352 NULL
, MDSCspReaderFlagsNames
, NULL
, NULL
355 static const CSSM_DB_INDEX_INFO cspEncapsulatedIndex
[] =
357 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
358 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
361 // CSP Smartcardinfo Relation.
362 static const CSSM_DB_ATTRIBUTE_INFO cspSmartCardAttrs
[] =
364 DB_ATTRIBUTE(ModuleID
, STRING
),
365 DB_ATTRIBUTE(SSID
, UINT32
),
366 DB_ATTRIBUTE(ScDesc
, STRING
),
367 DB_ATTRIBUTE(ScVendor
, STRING
),
368 DB_ATTRIBUTE(ScVersion
, STRING
),
369 DB_ATTRIBUTE(ScFirmwareVersion
, STRING
),
370 DB_ATTRIBUTE(ScFlags
, UINT32
),
371 DB_ATTRIBUTE(ScCustomFlags
, UINT32
),
372 DB_ATTRIBUTE(ScSerialNumber
, STRING
),
374 static const MDSNameValuePair
*cspSmartCardNvp
[] = {
375 NULL
, NULL
, NULL
, NULL
,
376 NULL
, NULL
, MDSCspScFlagsNames
, NULL
,
380 static const CSSM_DB_INDEX_INFO cspSmartCardIndex
[] =
382 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
383 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
),
384 UNIQUE_INDEX_ATTRIBUTE(ScDesc
, STRING
),
385 UNIQUE_INDEX_ATTRIBUTE(ScVendor
, STRING
),
386 UNIQUE_INDEX_ATTRIBUTE(ScVersion
, STRING
),
387 UNIQUE_INDEX_ATTRIBUTE(ScFirmwareVersion
, STRING
),
388 UNIQUE_INDEX_ATTRIBUTE(ScFlags
, UINT32
)
391 // DL Primary Relation.
392 static const CSSM_DB_ATTRIBUTE_INFO dlPrimaryAttrs
[] =
394 DB_ATTRIBUTE(ModuleID
, STRING
),
395 DB_ATTRIBUTE(SSID
, UINT32
),
396 DB_ATTRIBUTE(Manifest
, BLOB
),
397 DB_ATTRIBUTE(ModuleName
, STRING
),
398 DB_ATTRIBUTE(ProductVersion
, STRING
),
399 DB_ATTRIBUTE(Vendor
, STRING
),
400 DB_ATTRIBUTE(DLType
, UINT32
),
401 DB_ATTRIBUTE(QueryLimitsFlag
, UINT32
), // a completely bogus attr; see spec
402 DB_ATTRIBUTE(SampleTypes
, MULTI_UINT32
),
403 DB_ATTRIBUTE(AclSubjectTypes
, MULTI_UINT32
),
404 DB_ATTRIBUTE(AuthTags
, MULTI_UINT32
),
405 DB_ATTRIBUTE(ConjunctiveOps
, MULTI_UINT32
),
406 DB_ATTRIBUTE(RelationalOps
, MULTI_UINT32
),
408 static const MDSNameValuePair
*dlPrimaryNvp
[] = {
409 NULL
, NULL
, NULL
, NULL
,
410 NULL
, NULL
, MDSDlTypeNames
, NULL
,
412 MDSAclSubjectTypeNames
,
414 MDSDbConjunctiveNames
,
417 static const CSSM_DB_INDEX_INFO dlPrimaryIndex
[] =
419 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
420 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
423 // DL Encapsulated Products Relation.
424 static const CSSM_DB_ATTRIBUTE_INFO dlEncapsulatedAttrs
[] =
426 DB_ATTRIBUTE(ModuleID
, STRING
),
427 DB_ATTRIBUTE(SSID
, UINT32
),
428 DB_ATTRIBUTE(ProductDesc
, STRING
),
429 DB_ATTRIBUTE(ProductVendor
, STRING
),
430 DB_ATTRIBUTE(ProductVersion
, STRING
),
431 DB_ATTRIBUTE(ProductFlags
, UINT32
),
432 DB_ATTRIBUTE(StandardDesc
, STRING
),
433 DB_ATTRIBUTE(StandardVersion
, STRING
),
434 DB_ATTRIBUTE(Protocol
, UINT32
),
435 DB_ATTRIBUTE(RetrievalMode
, UINT32
),
438 static const MDSNameValuePair
*dlEncapsulatedNvp
[] = {
439 NULL
, NULL
, NULL
, NULL
,
440 NULL
, NULL
, NULL
, NULL
,
442 MDSDbRetrievalModeNames
445 static const CSSM_DB_INDEX_INFO dlEncapsulatedIndex
[] =
447 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
448 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
451 // CL Primary Relation.
452 static const CSSM_DB_ATTRIBUTE_INFO clPrimaryAttrs
[] =
454 DB_ATTRIBUTE(ModuleID
, STRING
),
455 DB_ATTRIBUTE(SSID
, UINT32
),
456 DB_ATTRIBUTE(Manifest
, BLOB
),
457 DB_ATTRIBUTE(ModuleName
, STRING
),
458 DB_ATTRIBUTE(ProductVersion
, STRING
),
459 DB_ATTRIBUTE(Vendor
, STRING
),
460 DB_ATTRIBUTE(CertTypeFormat
, UINT32
),
461 DB_ATTRIBUTE(CrlTypeFormat
, UINT32
),
462 DB_ATTRIBUTE(CertFieldNames
, BLOB
),
463 DB_ATTRIBUTE(BundleTypeFormat
, MULTI_UINT32
),
464 DB_ATTRIBUTE(XlationTypeFormat
, MULTI_UINT32
),
465 DB_ATTRIBUTE(TemplateFieldNames
, BLOB
),
468 static const MDSNameValuePair
*clPrimaryNvp
[] = {
469 NULL
, NULL
, NULL
, NULL
,
470 NULL
, NULL
, MDSCertTypeNames
, MDSCrlTypeNames
,
472 MDSCertBundleTypeNames
,
473 MDSCertTypeNames
, // translation type - same as cert type - right?
477 static const CSSM_DB_INDEX_INFO clPrimaryIndex
[] =
479 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
480 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
483 // CL Encapsulated Products Relation.
484 static const CSSM_DB_ATTRIBUTE_INFO clEncapsulatedAttrs
[] =
486 DB_ATTRIBUTE(ModuleID
, STRING
),
487 DB_ATTRIBUTE(SSID
, UINT32
),
488 DB_ATTRIBUTE(ProductDesc
, STRING
),
489 DB_ATTRIBUTE(ProductVendor
, STRING
),
490 DB_ATTRIBUTE(ProductVersion
, STRING
),
491 DB_ATTRIBUTE(ProductFlags
, UINT32
),
492 DB_ATTRIBUTE(StandardDesc
, STRING
),
493 DB_ATTRIBUTE(StandardVersion
, STRING
),
496 static const CSSM_DB_INDEX_INFO clEncapsulatedIndex
[] =
498 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
499 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
502 // TP Primary Relation.
503 static const CSSM_DB_ATTRIBUTE_INFO tpPrimaryAttrs
[] =
505 DB_ATTRIBUTE(ModuleID
, STRING
),
506 DB_ATTRIBUTE(SSID
, UINT32
),
507 DB_ATTRIBUTE(Manifest
, BLOB
),
508 DB_ATTRIBUTE(ModuleName
, STRING
),
509 DB_ATTRIBUTE(ProductVersion
, STRING
),
510 DB_ATTRIBUTE(Vendor
, STRING
),
511 DB_ATTRIBUTE(CertTypeFormat
, UINT32
),
512 DB_ATTRIBUTE(SampleTypes
, MULTI_UINT32
),
513 DB_ATTRIBUTE(AclSubjectTypes
, MULTI_UINT32
),
514 DB_ATTRIBUTE(AuthTags
, MULTI_UINT32
),
517 static const MDSNameValuePair
*tpPrimaryNvp
[] = {
518 NULL
, NULL
, NULL
, NULL
,
522 MDSAclSubjectTypeNames
,
526 static const CSSM_DB_INDEX_INFO tpPrimaryIndex
[] =
528 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
529 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
532 // TP Policy-OIDs Relation.
533 static const CSSM_DB_ATTRIBUTE_INFO tpPolicyOidsAttrs
[] =
535 DB_ATTRIBUTE(ModuleID
, STRING
),
536 DB_ATTRIBUTE(SSID
, UINT32
),
537 DB_ATTRIBUTE(OID
, BLOB
),
538 DB_ATTRIBUTE(Value
, BLOB
),
541 static const CSSM_DB_INDEX_INFO tpPolicyOidsIndex
[] =
543 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
544 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
),
545 UNIQUE_INDEX_ATTRIBUTE(OID
, BLOB
)
548 // special case "subschema" for parsing tpPolicyOidsAttrs. These arrays correspond
549 // dictionaries within a tpPolicyOidsAttrs info file; they are not part of
550 // our DB's schema. They are declared only to streamline the
551 // MDSAttrParser::parseTpPolicyOidsRecord function. No index info is needed.
553 // top-level info, applied to the dictionary for the whole file.
554 static const CSSM_DB_ATTRIBUTE_INFO tpPolicyOidsDict1
[] =
556 DB_ATTRIBUTE(ModuleID
, STRING
),
557 DB_ATTRIBUTE(SSID
, UINT32
),
559 const RelationInfo TpPolicyOidsDict1RelInfo
=
561 MDS_CDSADIR_TP_OIDS_RECORDTYPE
, // actually a don't care
563 NULL
, // no NVP needed
566 // One element of the "Policies" array maps to one of these.
567 static const CSSM_DB_ATTRIBUTE_INFO tpPolicyOidsDict2
[] =
569 DB_ATTRIBUTE(OID
, BLOB
),
570 DB_ATTRIBUTE(Value
, BLOB
),
572 const RelationInfo TpPolicyOidsDict2RelInfo
=
574 MDS_CDSADIR_TP_OIDS_RECORDTYPE
, // actually a don't care
576 NULL
, // no NVP needed
579 // TP Encapsulated Products Relation.
580 static const CSSM_DB_ATTRIBUTE_INFO tpEncapsulatedAttrs
[] =
582 DB_ATTRIBUTE(ModuleID
, STRING
),
583 DB_ATTRIBUTE(SSID
, UINT32
),
584 DB_ATTRIBUTE(ProductDesc
, STRING
),
585 DB_ATTRIBUTE(ProductVendor
, STRING
),
586 DB_ATTRIBUTE(ProductVersion
, STRING
),
587 DB_ATTRIBUTE(ProductFlags
, UINT32
), // vendor-specific, right?
588 DB_ATTRIBUTE(AuthorityRequestType
, MULTI_UINT32
),
589 DB_ATTRIBUTE(StandardDesc
, STRING
),
590 DB_ATTRIBUTE(StandardVersion
, STRING
),
591 DB_ATTRIBUTE(ProtocolDesc
, STRING
),
592 DB_ATTRIBUTE(ProtocolFlags
, UINT32
),
593 DB_ATTRIBUTE(CertClassName
, STRING
),
594 DB_ATTRIBUTE(RootCertificate
, BLOB
),
595 DB_ATTRIBUTE(RootCertTypeFormat
, UINT32
),
597 static const MDSNameValuePair
*tpEncapsulatedNvp
[] = {
598 NULL
, NULL
, NULL
, NULL
,
599 NULL
, NULL
, MDSTpAuthRequestNames
, NULL
,
600 NULL
, NULL
, NULL
, NULL
,
601 NULL
, MDSCertTypeNames
604 static const CSSM_DB_INDEX_INFO tpEncapsulatedIndex
[] =
606 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
607 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
610 #if DEFINE_META_TABLES
611 // MDS Schema Relations (meta) Relation.
612 static const CSSM_DB_ATTRIBUTE_INFO mdsSchemaRelationsAttrs
[] =
614 DB_ATTRIBUTE(RelationID
, UINT32
),
615 DB_ATTRIBUTE(RelationName
, STRING
),
618 static const CSSM_DB_INDEX_INFO mdsSchemaRelationsIndex
[] =
620 UNIQUE_INDEX_ATTRIBUTE(RelationID
, UINT32
),
623 // MDS Schema Attributes (meta) Relation.
624 static const CSSM_DB_ATTRIBUTE_INFO mdsSchemaAttributesAttrs
[] =
626 DB_ATTRIBUTE(RelationID
, UINT32
),
627 DB_ATTRIBUTE(AttributeID
, UINT32
),
628 DB_ATTRIBUTE(AttributeNameFormat
, UINT32
),
629 DB_ATTRIBUTE(AttributeName
, STRING
),
630 DB_ATTRIBUTE(AttributeNameID
, BLOB
),
631 DB_ATTRIBUTE(AttributeFormat
, UINT32
),
634 static const CSSM_DB_INDEX_INFO mdsSchemaAttributesIndex
[] =
636 UNIQUE_INDEX_ATTRIBUTE(RelationID
, UINT32
),
637 UNIQUE_INDEX_ATTRIBUTE(AttributeID
, UINT32
)
640 // MDS Schema Indexes (meta) Relation.
641 static const CSSM_DB_ATTRIBUTE_INFO mdsSchemaIndexesAttrs
[] =
643 DB_ATTRIBUTE(RelationID
, UINT32
),
644 DB_ATTRIBUTE(IndexID
, UINT32
),
645 DB_ATTRIBUTE(AttributeID
, UINT32
),
646 DB_ATTRIBUTE(IndexType
, UINT32
),
647 DB_ATTRIBUTE(IndexedDataLocation
, UINT32
),
650 static const CSSM_DB_INDEX_INFO mdsSchemaIndexesIndex
[] =
652 UNIQUE_INDEX_ATTRIBUTE(RelationID
, UINT32
),
653 UNIQUE_INDEX_ATTRIBUTE(IndexID
, UINT32
)
656 #endif /* DEFINE_META_TABLES */
658 // AC Primary Relation.
659 static const CSSM_DB_ATTRIBUTE_INFO acPrimaryAttrs
[] =
661 DB_ATTRIBUTE(ModuleID
, STRING
),
662 DB_ATTRIBUTE(SSID
, UINT32
),
663 DB_ATTRIBUTE(Manifest
, BLOB
),
664 DB_ATTRIBUTE(ModuleName
, STRING
),
665 DB_ATTRIBUTE(ProductVersion
, STRING
),
666 DB_ATTRIBUTE(Vendor
, STRING
),
669 static const CSSM_DB_INDEX_INFO acPrimaryIndex
[] =
671 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
672 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
675 // KR Primary Relation.
676 static const CSSM_DB_ATTRIBUTE_INFO krPrimaryAttrs
[] =
678 DB_ATTRIBUTE(ModuleID
, STRING
),
679 DB_ATTRIBUTE(SSID
, UINT32
),
680 DB_ATTRIBUTE(Manifest
, BLOB
),
681 DB_ATTRIBUTE(ModuleName
, STRING
),
682 DB_ATTRIBUTE(CompatCSSMVersion
, STRING
),
683 DB_ATTRIBUTE(Version
, STRING
),
684 DB_ATTRIBUTE(Vendor
, STRING
),
685 DB_ATTRIBUTE(Description
, STRING
),
686 DB_ATTRIBUTE(ConfigFileLocation
, STRING
),
689 static const CSSM_DB_INDEX_INFO krPrimaryIndex
[] =
691 UNIQUE_INDEX_ATTRIBUTE(ModuleID
, STRING
),
692 UNIQUE_INDEX_ATTRIBUTE(SSID
, UINT32
)
695 // list of all built-in schema for the CDSA Directory DB.
696 const RelationInfo kMDSRelationInfo
[] =
698 RELATION_INFO(MDS_CDSADIR_CSSM_RECORDTYPE
,
702 RELATION_INFO(MDS_CDSADIR_KRMM_RECORDTYPE
,
706 RELATION_INFO(MDS_CDSADIR_EMM_RECORDTYPE
,
708 NO_NVP
, // FIXME - what is the uint32 EmmType here?
710 RELATION_INFO(MDS_CDSADIR_EMM_PRIMARY_RECORDTYPE
,
714 RELATION_INFO(MDS_CDSADIR_COMMON_RECORDTYPE
,
718 RELATION_INFO(MDS_CDSADIR_CSP_PRIMARY_RECORDTYPE
,
722 RELATION_INFO(MDS_CDSADIR_CSP_CAPABILITY_RECORDTYPE
,
723 cspCapabilitiesAttrs
,
725 cspCapabilitiesIndex
),
726 RELATION_INFO(MDS_CDSADIR_CSP_ENCAPSULATED_PRODUCT_RECORDTYPE
,
727 cspEncapsulatedAttrs
,
729 cspEncapsulatedIndex
),
730 RELATION_INFO(MDS_CDSADIR_CSP_SC_INFO_RECORDTYPE
,
734 RELATION_INFO(MDS_CDSADIR_DL_PRIMARY_RECORDTYPE
,
738 RELATION_INFO(MDS_CDSADIR_DL_ENCAPSULATED_PRODUCT_RECORDTYPE
,
741 dlEncapsulatedIndex
),
742 RELATION_INFO(MDS_CDSADIR_CL_PRIMARY_RECORDTYPE
,
746 RELATION_INFO(MDS_CDSADIR_CL_ENCAPSULATED_PRODUCT_RECORDTYPE
,
748 NO_NVP
, // none needed
749 clEncapsulatedIndex
),
750 RELATION_INFO(MDS_CDSADIR_TP_PRIMARY_RECORDTYPE
,
754 RELATION_INFO(MDS_CDSADIR_TP_OIDS_RECORDTYPE
,
756 NO_NVP
, // none needed
758 RELATION_INFO(MDS_CDSADIR_TP_ENCAPSULATED_PRODUCT_RECORDTYPE
,
761 tpEncapsulatedIndex
),
762 #if DEFINE_META_TABLES
763 RELATION_INFO(MDS_CDSADIR_MDS_SCHEMA_RELATIONS
,
764 mdsSchemaRelationsAttrs
,
766 mdsSchemaRelationsIndex
),
767 RELATION_INFO(MDS_CDSADIR_MDS_SCHEMA_ATTRIBUTES
,
768 mdsSchemaAttributesAttrs
,
770 mdsSchemaAttributesIndex
),
771 RELATION_INFO(MDS_CDSADIR_MDS_SCHEMA_INDEXES
,
772 mdsSchemaIndexesAttrs
,
774 mdsSchemaIndexesIndex
),
775 #endif /* DEFINE_META_TABLES */
776 RELATION_INFO(MDS_CDSADIR_AC_PRIMARY_RECORDTYPE
,
778 NO_NVP
, // none needed
780 RELATION_INFO(MDS_CDSADIR_KR_PRIMARY_RECORDTYPE
,
782 NO_NVP
, // none needed
786 const unsigned kNumMdsRelations
= sizeof(kMDSRelationInfo
) / sizeof(RelationInfo
);
788 // Map a CSSM_DB_RECORDTYPE to a RelationInfo *.
789 extern const RelationInfo
*MDSRecordTypeToRelation(
790 CSSM_DB_RECORDTYPE recordType
)
792 const RelationInfo
*relInfo
= kMDSRelationInfo
;
795 for(dex
=0; dex
<kNumMdsRelations
; dex
++) {
796 if(relInfo
->DataRecordType
== recordType
) {
801 if(recordType
== MDS_OBJECT_RECORDTYPE
) {
802 return &kObjectRelation
;
807 // same as above, based on record type as string.
808 extern const RelationInfo
*MDSRecordTypeNameToRelation(
809 const char *recordTypeName
)
811 const RelationInfo
*relInfo
= kMDSRelationInfo
;
814 for(dex
=0; dex
<kNumMdsRelations
; dex
++) {
815 if(!strcmp(recordTypeName
, relInfo
->relationName
)) {
823 } // end namespace Security