2 * Copyright (c) 2000-2001,2011-2012,2014 Apple 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 // DatabaseSession.cpp - DL Session.
22 #include <security_cdsa_plugin/DatabaseSession.h>
24 #include <security_cdsa_plugin/Database.h>
25 #include <security_cdsa_plugin/DbContext.h>
26 #include <security_cdsa_utilities/cssmbridge.h>
28 #include <security_utilities/debugging.h>
30 /* log open/close events */
31 #define DOCDebug(args...) secdebug("DBOpen", ## args)
36 extern "C" char* cssmErrorString(CSSM_RETURN errCode
);
39 // Session constructor
41 DatabaseSession::DatabaseSession(DatabaseManager
&inDatabaseManager
)
42 : mDatabaseManager(inDatabaseManager
)
46 DatabaseSession::~DatabaseSession()
53 DatabaseSession::GetDbNames(CSSM_NAME_LIST_PTR
&outNameList
)
55 secdebug("dbsession", "GetDbNames");
56 outNameList
= mDatabaseManager
.getDbNames (*this);
59 // dump the returned names
61 secdebug("dbsession", "GetDbNames returned %d names", outNameList
->NumStrings
);
62 for (n
= 0; n
< outNameList
->NumStrings
; ++n
)
64 secdebug("dbsession", "%d: %s", n
, outNameList
->String
[n
]);
68 secdebug("dbsession", "********************");
73 DatabaseSession::FreeNameList(CSSM_NAME_LIST
&inNameList
)
75 secdebug("dbsession", "FreeNameList");
76 mDatabaseManager
.freeNameList (*this, inNameList
);
77 secdebug("dbsession", "********************");
82 DatabaseSession::DbDelete(const char *inDbName
,
83 const CSSM_NET_ADDRESS
*inDbLocation
,
84 const AccessCredentials
*inAccessCred
)
86 // The databaseManager will notify all its DbContext instances
87 // that the database is question is being deleted.
88 secdebug("dbsession", "DbDelete of %s", inDbName
);
89 mDatabaseManager
.dbDelete(*this, DbName(inDbName
, CssmNetAddress::optional(inDbLocation
)), inAccessCred
);
90 secdebug("dbsession", "********************");
93 // DbContext creation and destruction.
95 DatabaseSession::DbCreate(const char *inDbName
,
96 const CSSM_NET_ADDRESS
*inDbLocation
,
97 const CSSM_DBINFO
&inDBInfo
,
98 CSSM_DB_ACCESS_TYPE inAccessRequest
,
99 const CSSM_RESOURCE_CONTROL_CONTEXT
*inCredAndAclEntry
,
100 const void *inOpenParameters
,
101 CSSM_DB_HANDLE
&outDbHandle
)
103 outDbHandle
= CSSM_INVALID_HANDLE
; // CDSA 2.0 says to set this if we fail
104 secdebug("dbsession", "DbCreate of %s", inDbName
);
106 outDbHandle
= insertDbContext(mDatabaseManager
.dbCreate(*this,
107 DbName(inDbName
, CssmNetAddress::optional(inDbLocation
)),
112 secdebug("dbsession", "DbCreate returned handle %#lx", outDbHandle
);
114 secdebug("dbsession", "********************");
118 DatabaseSession::DbOpen(const char *inDbName
,
119 const CSSM_NET_ADDRESS
*inDbLocation
,
120 CSSM_DB_ACCESS_TYPE inAccessRequest
,
121 const AccessCredentials
*inAccessCred
,
122 const void *inOpenParameters
,
123 CSSM_DB_HANDLE
&outDbHandle
)
125 DOCDebug("DatabaseSession::DbOpen: dbName %s", inDbName
);
126 secdebug("dbsession", "DbOpen of %s", inDbName
);
127 outDbHandle
= CSSM_INVALID_HANDLE
; // CDSA 2.0 says to set this if we fail
128 outDbHandle
= insertDbContext(mDatabaseManager
.dbOpen(*this,
129 DbName(inDbName
, CssmNetAddress::optional(inDbLocation
)),
133 secdebug("dbsession", "DbOpen returned handle %#lx", outDbHandle
);
134 secdebug("dbsession", "********************");
138 DatabaseSession::insertDbContext(DbContext
&inDbContext
)
140 CSSM_DB_HANDLE aDbHandle
;
143 aDbHandle
= inDbContext
.handle ();
144 StLock
<Mutex
> _(mDbContextMapLock
);
145 mDbContextMap
.insert(DbContextMap::value_type(aDbHandle
, &inDbContext
));
150 mDatabaseManager
.dbClose(inDbContext
);
158 DatabaseSession::findDbContext(CSSM_DB_HANDLE inDbHandle
)
160 StLock
<Mutex
> _(mDbContextMapLock
);
161 DbContextMap::iterator it
= mDbContextMap
.find(inDbHandle
);
162 if (it
== mDbContextMap
.end())
163 CssmError::throwMe(CSSM_ERRCODE_INVALID_DB_HANDLE
);
168 DatabaseSession::closeAll()
170 StLock
<Mutex
> _(mDbContextMapLock
);
171 for (DbContextMap::iterator it
= mDbContextMap
.begin();
172 it
!= mDbContextMap
.end();
175 DbContext
*aDbContext
= it
->second
;
178 mDatabaseManager
.dbClose(*aDbContext
);
179 // This is done by the database itself which owns the context.
184 // Ignore exceptions since we want to close as many DBs as possible.
185 // XXX @@@ log an error or something.
189 mDbContextMap
.clear();
190 secdebug("dbsession", "********************");
193 // Operations using DbContext instances.
195 DatabaseSession::DbClose(CSSM_DB_HANDLE inDbHandle
)
197 StLock
<Mutex
> _(mDbContextMapLock
);
198 DOCDebug("DatabaseSession::Close");
199 secdebug("dbsession", "DbClose of handle %ld", inDbHandle
);
200 DbContextMap::iterator it
= mDbContextMap
.find(inDbHandle
);
201 if (it
== mDbContextMap
.end())
202 CssmError::throwMe(CSSM_ERRCODE_INVALID_DB_HANDLE
);
203 auto_ptr
<DbContext
> aDbContext(it
->second
);
204 mDbContextMap
.erase(it
);
205 mDatabaseManager
.dbClose(*aDbContext
);
206 secdebug("dbsession", "********************");
210 DatabaseSession::CreateRelation(CSSM_DB_HANDLE inDbHandle
,
211 CSSM_DB_RECORDTYPE inRelationID
,
212 const char *inRelationName
,
213 uint32 inNumberOfAttributes
,
214 const CSSM_DB_SCHEMA_ATTRIBUTE_INFO
*inAttributeInfo
,
215 uint32 inNumberOfIndexes
,
216 const CSSM_DB_SCHEMA_INDEX_INFO
&inIndexInfo
)
218 secdebug("dbsession", "CreateRelation from handle %ld of record type %X with relation name %s", inDbHandle
, inRelationID
, inRelationName
);
219 secdebug("dbsession", "number of attributes = %d", inNumberOfAttributes
);
222 for (n
= 0; n
< inNumberOfAttributes
; ++n
)
224 secdebug("dbsession", "%d: id %d name %s, data type %d", n
, inAttributeInfo
[n
].AttributeId
,
225 inAttributeInfo
[n
].AttributeName
,
226 inAttributeInfo
[n
].DataType
);
230 secdebug("dbsession", "number of indexes: %d", inNumberOfIndexes
);
232 for (n
= 0; n
< inNumberOfIndexes
; ++n
)
234 secdebug("dbsession", "%d: id %d indexid %d indextype %d location %d", n
, inIndexInfo
.AttributeId
,
235 inIndexInfo
.IndexedDataLocation
,
237 inIndexInfo
.IndexType
);
241 DbContext
&aDbContext
= findDbContext(inDbHandle
);
242 return aDbContext
.mDatabase
.createRelation(aDbContext
, inRelationID
, inRelationName
,
243 inNumberOfAttributes
, inAttributeInfo
,
244 inNumberOfIndexes
, inIndexInfo
);
245 secdebug("dbsession", "********************");
249 DatabaseSession::DestroyRelation(CSSM_DB_HANDLE inDbHandle
,
250 CSSM_DB_RECORDTYPE inRelationID
)
252 secdebug("dbsession", "DestroyRelation (handle %ld) %d", inDbHandle
, inRelationID
);
253 DbContext
&aDbContext
= findDbContext(inDbHandle
);
254 aDbContext
.mDatabase
.destroyRelation(aDbContext
, inRelationID
);
255 secdebug("dbsession", "********************");
259 DatabaseSession::Authenticate(CSSM_DB_HANDLE inDbHandle
,
260 CSSM_DB_ACCESS_TYPE inAccessRequest
,
261 const AccessCredentials
&inAccessCred
)
263 secdebug("dbsession", "Authenticate (handle %ld) inAccessRequest %d", inDbHandle
, inAccessRequest
);
264 DbContext
&aDbContext
= findDbContext(inDbHandle
);
265 aDbContext
.mDatabase
.authenticate(aDbContext
, inAccessRequest
, inAccessCred
);
266 secdebug("dbsession", "********************");
271 DatabaseSession::GetDbAcl(CSSM_DB_HANDLE inDbHandle
,
272 const CSSM_STRING
*inSelectionTag
,
273 uint32
&outNumberOfAclInfos
,
274 CSSM_ACL_ENTRY_INFO_PTR
&outAclInfos
)
276 secdebug("dbsession", "GetDbAcl (handle %ld)", inDbHandle
);
277 DbContext
&aDbContext
= findDbContext(inDbHandle
);
278 aDbContext
.mDatabase
.getDbAcl(aDbContext
, inSelectionTag
, outNumberOfAclInfos
, outAclInfos
);
279 secdebug("dbsession", "********************");
283 DatabaseSession::ChangeDbAcl(CSSM_DB_HANDLE inDbHandle
,
284 const AccessCredentials
&inAccessCred
,
285 const CSSM_ACL_EDIT
&inAclEdit
)
287 secdebug("dbsession", "ChangeDbAcl (handle %ld)", inDbHandle
);
288 DbContext
&aDbContext
= findDbContext(inDbHandle
);
289 aDbContext
.mDatabase
.changeDbAcl(aDbContext
, inAccessCred
, inAclEdit
);
290 secdebug("dbsession", "********************");
294 DatabaseSession::GetDbOwner(CSSM_DB_HANDLE inDbHandle
,
295 CSSM_ACL_OWNER_PROTOTYPE
&outOwner
)
297 secdebug("dbsession", "GetDbOwner (handle %ld)", inDbHandle
);
298 DbContext
&aDbContext
= findDbContext(inDbHandle
);
299 aDbContext
.mDatabase
.getDbOwner(aDbContext
, outOwner
);
300 secdebug("dbsession", "********************");
304 DatabaseSession::ChangeDbOwner(CSSM_DB_HANDLE inDbHandle
,
305 const AccessCredentials
&inAccessCred
,
306 const CSSM_ACL_OWNER_PROTOTYPE
&inNewOwner
)
308 secdebug("dbsession", "ChangeDbOwner (handle %ld)", inDbHandle
);
309 DbContext
&aDbContext
= findDbContext(inDbHandle
);
310 aDbContext
.mDatabase
.changeDbOwner(aDbContext
, inAccessCred
, inNewOwner
);
311 secdebug("dbsession", "********************");
315 DatabaseSession::GetDbNameFromHandle(CSSM_DB_HANDLE inDbHandle
,
318 secdebug("dbsession", "GetDbNameFromHandle (handle %ld)", inDbHandle
);
319 DbContext
&aDbContext
= findDbContext(inDbHandle
);
320 Required(outDbName
) = aDbContext
.mDatabase
.getDbNameFromHandle(aDbContext
);
321 secdebug("dbsession", "name: %s", *outDbName
);
322 secdebug("dbsession", "********************");
328 #if 0 /* unusued functions */
331 void DumpAttributeInfo(const CSSM_DB_ATTRIBUTE_INFO
&info
)
333 const char* attrNameType
;
334 switch (info
.AttributeFormat
)
336 case CSSM_DB_ATTRIBUTE_NAME_AS_STRING
:
337 attrNameType
= "CSSM_DB_ATTRIBUTE_NAME_AS_STRING";
340 case CSSM_DB_ATTRIBUTE_NAME_AS_OID
:
341 attrNameType
= "CSSM_DB_ATTRIBUTE_NAME_AS_OID";
344 case CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER
:
345 attrNameType
= "CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER";
349 secdebug("dbsession", " Attribute name type: %s", attrNameType
);
350 switch (info
.AttributeFormat
)
352 case CSSM_DB_ATTRIBUTE_NAME_AS_STRING
:
353 secdebug("dbsession", " name: %s", info
.Label
.AttributeName
);
356 case CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER
:
357 secdebug("dbsession", " name: %d", info
.Label
.AttributeID
);
360 case CSSM_DB_ATTRIBUTE_NAME_AS_OID
:
361 secdebug("dbsession", " name is oid");
366 switch (info
.AttributeFormat
)
368 case CSSM_DB_ATTRIBUTE_FORMAT_STRING
:
369 s
= "CSSM_DB_ATTRIBUTE_FORMAT_STRING";
371 case CSSM_DB_ATTRIBUTE_FORMAT_SINT32
:
372 s
= "CSSM_DB_ATTRIBUTE_FORMAT_SINT32";
374 case CSSM_DB_ATTRIBUTE_FORMAT_UINT32
:
375 s
= "CSSM_DB_ATTRIBUTE_FORMAT_UINT32";
377 case CSSM_DB_ATTRIBUTE_FORMAT_BIG_NUM
:
378 s
= "CSSM_DB_ATTRIBUTE_FORMAT_BIG_NUM";
380 case CSSM_DB_ATTRIBUTE_FORMAT_REAL
:
381 s
= "CSSM_DB_ATTRIBUTE_FORMAT_REAL";
383 case CSSM_DB_ATTRIBUTE_FORMAT_TIME_DATE
:
384 s
= "CSSM_DB_ATTRIBUTE_FORMAT_TIME_DATE";
386 case CSSM_DB_ATTRIBUTE_FORMAT_BLOB
:
387 s
= "CSSM_DB_ATTRIBUTE_FORMAT_BLOB";
389 case CSSM_DB_ATTRIBUTE_FORMAT_MULTI_UINT32
:
390 s
= "CSSM_DB_ATTRIBUTE_FORMAT_MULTI_UINT32";
392 case CSSM_DB_ATTRIBUTE_FORMAT_COMPLEX
:
393 s
= "CSSM_DB_ATTRIBUTE_FORMAT_COMPLEX";
397 secdebug("dbsession", " attribute format: %s", s
);
402 void DumpAttributes(const CSSM_DB_RECORD_ATTRIBUTE_DATA
*inAttributes
)
406 secdebug("dbsession", "No attributes defined.");
410 secdebug("dbsession", "insert into %d", inAttributes
->DataRecordType
);
411 secdebug("dbsession", "Semantic information %d", inAttributes
->SemanticInformation
);
412 secdebug("dbsession", "Number of attributes: %d", inAttributes
->NumberOfAttributes
);
415 for (n
= 0; n
< inAttributes
->NumberOfAttributes
; ++n
)
417 DumpAttributeInfo(inAttributes
->AttributeData
[n
].Info
);
418 secdebug("dbsession", "Attribute %d\n", n
);
419 secdebug("dbsession", " number of values: %d", inAttributes
->AttributeData
[n
].NumberOfValues
);
421 for (i
= 0; i
< inAttributes
->AttributeData
[n
].NumberOfValues
; ++i
)
423 switch (inAttributes
->AttributeData
[n
].Info
.AttributeFormat
)
425 case CSSM_DB_ATTRIBUTE_FORMAT_STRING
:
427 std::string
ss((char*) inAttributes
->AttributeData
[n
].Value
[i
].Data
, inAttributes
->AttributeData
[n
].Value
[i
].Length
);
428 secdebug("dbsession", " Value %d: %s", i
, ss
.c_str());
431 case CSSM_DB_ATTRIBUTE_FORMAT_SINT32
:
432 secdebug("dbsession", " Value %d: %d", i
, *(sint32
*)inAttributes
->AttributeData
[n
].Value
[i
].Data
);
434 case CSSM_DB_ATTRIBUTE_FORMAT_UINT32
:
435 secdebug("dbsession", " Value %d: %u", i
, *(uint32
*)inAttributes
->AttributeData
[n
].Value
[i
].Data
);
437 case CSSM_DB_ATTRIBUTE_FORMAT_BIG_NUM
:
438 secdebug("dbsession", " Value %d: (bignum)", i
);
440 case CSSM_DB_ATTRIBUTE_FORMAT_REAL
:
441 secdebug("dbsession", " Value %d: %f", i
, *(double*)inAttributes
->AttributeData
[n
].Value
[i
].Data
);
443 case CSSM_DB_ATTRIBUTE_FORMAT_TIME_DATE
:
444 secdebug("dbsession", " Value %d: %s", i
, (char*)inAttributes
->AttributeData
[n
].Value
[i
].Data
);
446 case CSSM_DB_ATTRIBUTE_FORMAT_BLOB
:
447 secdebug("dbsession", " Value %d: (blob)", i
);
449 case CSSM_DB_ATTRIBUTE_FORMAT_MULTI_UINT32
:
452 unsigned long numInts
= inAttributes
->AttributeData
[n
].Value
[i
].Length
/ sizeof(UInt32
);
453 for (j
= 0; j
< numInts
; ++j
)
455 uint32
* nums
= (uint32
*) inAttributes
->AttributeData
[n
].Value
[i
].Data
;
456 secdebug("dbsession", " %d", nums
[j
]);
462 case CSSM_DB_ATTRIBUTE_FORMAT_COMPLEX
:
463 secdebug("dbsession", " Value %d: (complex)", i
);
473 DumpUniqueRecord(const CSSM_DB_UNIQUE_RECORD
&record
)
478 switch (record.RecordLocator.IndexType)
480 case CSSM_DB_INDEX_UNIQUE:
482 s = "CSSM_DB_INDEX_UNIQUE";
486 case CSSM_DB_INDEX_NONUNIQUE:
488 s = "CSSM_DB_INDEX_NONUNIQUE";
493 secdebug("dbsession", "RecordLocator.IndexType: %s", s);
495 switch (record.RecordLocator.IndexedDataLocation)
497 case CSSM_DB_INDEX_ON_UNKNOWN:
499 s = "CSSM_DB_INDEX_ON_UNKNOWN";
503 case CSSM_DB_INDEX_ON_ATTRIBUTE:
505 s = "CSSM_DB_INDEX_ON_ATTRIBUTE";
509 case CSSM_DB_INDEX_ON_RECORD:
511 s = "CSSM_DB_INDEX_ON_RECORD";
516 secdebug("dbsession", "RecordLocator.IndexedDataLocation: %s", s);
518 secdebug("dbsession", "Attribute info:");
520 DumpAttributeInfo(record.RecordLocator.Info);
523 // put the record ID into hex
527 for (i
= 0; i
< record
.RecordIdentifier
.Length
; ++i
)
529 sprintf(hexBuffer
, "%02X", record
.RecordIdentifier
.Data
[i
]);
533 secdebug("dbsession", " RecordIdentifier.Data: %s", output
.c_str());
538 DatabaseSession::DataInsert(CSSM_DB_HANDLE inDbHandle
,
539 CSSM_DB_RECORDTYPE inRecordType
,
540 const CSSM_DB_RECORD_ATTRIBUTE_DATA
*inAttributes
,
541 const CssmData
*inData
,
542 CSSM_DB_UNIQUE_RECORD_PTR
&outUniqueId
)
544 secdebug("dbsession", "%p DataInsert(%lx,%x)", this, inDbHandle
, inRecordType
);
545 DbContext
&aDbContext
= findDbContext(inDbHandle
);
546 outUniqueId
= aDbContext
.mDatabase
.dataInsert(aDbContext
, inRecordType
, inAttributes
, inData
);
549 secdebug("dbsession", "Returned unique id:");
550 DumpUniqueRecord(*outUniqueId
);
553 secdebug("dbsession", "********************");
558 DatabaseSession::DataDelete(CSSM_DB_HANDLE inDbHandle
,
559 const CSSM_DB_UNIQUE_RECORD
&inUniqueRecordIdentifier
)
561 secdebug("dbsession", "%p DataDelete(%lx)", this, inDbHandle
);
562 DbContext
&aDbContext
= findDbContext(inDbHandle
);
563 aDbContext
.mDatabase
.dataDelete(aDbContext
, inUniqueRecordIdentifier
);
566 secdebug("dbsession", "Record identifier:");
567 DumpUniqueRecord(inUniqueRecordIdentifier
);
569 secdebug("dbsession", "********************");
574 DatabaseSession::DataModify(CSSM_DB_HANDLE inDbHandle
,
575 CSSM_DB_RECORDTYPE inRecordType
,
576 CSSM_DB_UNIQUE_RECORD
&inoutUniqueRecordIdentifier
,
577 const CSSM_DB_RECORD_ATTRIBUTE_DATA
*inAttributesToBeModified
,
578 const CssmData
*inDataToBeModified
,
579 CSSM_DB_MODIFY_MODE inModifyMode
)
581 secdebug("dbsession", "%p DataModify(%lx,%x)", this, inDbHandle
, inRecordType
);
582 DbContext
&aDbContext
= findDbContext(inDbHandle
);
583 aDbContext
.mDatabase
.dataModify(aDbContext
, inRecordType
, inoutUniqueRecordIdentifier
,
584 inAttributesToBeModified
, inDataToBeModified
, inModifyMode
);
586 secdebug("dbsession", "Out record identifier:");
587 DumpUniqueRecord(inoutUniqueRecordIdentifier
);
589 secdebug("dbsession", "********************");
593 DatabaseSession::DataGetFirst(CSSM_DB_HANDLE inDbHandle
,
594 const CssmQuery
*inQuery
,
595 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR inoutAttributes
,
597 CSSM_DB_UNIQUE_RECORD_PTR
&outUniqueId
)
599 secdebug("dbsession", "%p DataGetFirst(%lx)", this, inDbHandle
);
600 DbContext
&aDbContext
= findDbContext(inDbHandle
);
602 CSSM_HANDLE result
= aDbContext
.mDatabase
.dataGetFirst(aDbContext
, inQuery
,
603 inoutAttributes
, inoutData
, outUniqueId
);
605 secdebug("dbsession", "result handle: %lx", result
);
608 secdebug("dbsession", "Returned ID:");
609 DumpUniqueRecord(*outUniqueId
);
613 secdebug("dbsession", "********************");
618 DatabaseSession::DataGetNext(CSSM_DB_HANDLE inDbHandle
,
619 CSSM_HANDLE inResultsHandle
,
620 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR inoutAttributes
,
622 CSSM_DB_UNIQUE_RECORD_PTR
&outUniqueRecord
)
624 secdebug("dbsession", "DataGetNext(%lx)", inDbHandle
);
625 DbContext
&aDbContext
= findDbContext(inDbHandle
);
627 bool result
= aDbContext
.mDatabase
.dataGetNext(aDbContext
, inResultsHandle
, inoutAttributes
,
628 inoutData
, outUniqueRecord
);
633 secdebug("dbsession", "Returned ID:");
634 DumpUniqueRecord(*outUniqueRecord
);
638 secdebug("dbsession", "********************");
643 DatabaseSession::DataAbortQuery(CSSM_DB_HANDLE inDbHandle
,
644 CSSM_HANDLE inResultsHandle
)
646 secdebug("dbsession", "%p DataAbortQuery(%lx)", this, inDbHandle
);
647 DbContext
&aDbContext
= findDbContext(inDbHandle
);
648 aDbContext
.mDatabase
.dataAbortQuery(aDbContext
, inResultsHandle
);
649 secdebug("dbsession", "********************");
653 DatabaseSession::DataGetFromUniqueRecordId(CSSM_DB_HANDLE inDbHandle
,
654 const CSSM_DB_UNIQUE_RECORD
&inUniqueRecord
,
655 CSSM_DB_RECORD_ATTRIBUTE_DATA_PTR inoutAttributes
,
658 secdebug("dbsession", "%p DataGetFromUniqueId(%lx)", this, inDbHandle
);
660 secdebug("dbsession", "inUniqueRecord:");
661 DumpUniqueRecord(inUniqueRecord
);
664 DbContext
&aDbContext
= findDbContext(inDbHandle
);
665 aDbContext
.mDatabase
.dataGetFromUniqueRecordId(aDbContext
, inUniqueRecord
,
666 inoutAttributes
, inoutData
);
667 secdebug("dbsession", "********************");
671 DatabaseSession::FreeUniqueRecord(CSSM_DB_HANDLE inDbHandle
,
672 CSSM_DB_UNIQUE_RECORD
&inUniqueRecordIdentifier
)
674 secdebug("dbsession", "FreeUniqueRecord: %lx", inDbHandle
);
676 secdebug("dbsession", "inUniqueRecordIdentifier follows:");
677 DumpUniqueRecord(inUniqueRecordIdentifier
);
679 DbContext
&aDbContext
= findDbContext(inDbHandle
);
680 aDbContext
.mDatabase
.freeUniqueRecord(aDbContext
, inUniqueRecordIdentifier
);
681 secdebug("dbsession", "********************");
685 DatabaseSession::PassThrough(CSSM_DB_HANDLE inDbHandle
,
686 uint32 passThroughId
,
687 const void *inputParams
,
690 DbContext
&aDbContext
= findDbContext(inDbHandle
);
691 aDbContext
.mDatabase
.passThrough(aDbContext
, passThroughId
, inputParams
, outputParams
);