]> git.saurik.com Git - apple/securityd.git/blobdiff - src/database.cpp
securityd-55199.3.tar.gz
[apple/securityd.git] / src / database.cpp
index e1e652c567ad6dbd48cae239bc26d4b186e0ffca..25a7d413977a8262a1343adff332f9c839db033d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All Rights Reserved.
  * 
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -30,7 +30,9 @@
 #include "key.h"
 #include "server.h"
 #include "session.h"
+#include "notifications.h"
 #include <security_agent_client/agentclient.h>
+#include <securityd_client/dictionary.h>
 #include <security_cdsa_utilities/acl_any.h>   // for default owner ACLs
 #include <security_cdsa_client/wrapkey.h>
 #include <security_utilities/endian.h>
@@ -65,6 +67,25 @@ Process& Database::process() const
 {
        return referent<Process>();
 }
+       
+
+//
+// Send a keychain-related notification event about this database
+//
+void DbCommon::notify(NotificationEvent event, const DLDbIdentifier &ident)
+{
+       // form the data (encoded DLDbIdentifier)
+    NameValueDictionary nvd;
+    NameValueDictionary::MakeNameValueDictionaryFromDLDbIdentifier(ident, nvd);
+    CssmData data;
+    nvd.Export(data);
+
+       // inject notification into Security event system
+    Listener::notify(kNotificationDomainDatabase, event, data);
+       
+       // clean up
+    free (data.data());
+}
 
 
 //
@@ -80,6 +101,11 @@ void DbCommon::lockProcessing()
        // nothing
 }
 
+bool DbCommon::belongsToSystem() const
+{
+       return false;
+}
+
 
 void Database::releaseKey(Key &key)
 {
@@ -166,7 +192,7 @@ SecurityServerAcl &Database::acl()
        CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED);
 }
 
-bool Database::isLocked() const
+bool Database::isLocked()
 {
        secdebug("database", "%p calling unimplemented isLocked", this);
        CssmError::throwMe(CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED);
@@ -187,11 +213,6 @@ AclKind Database::aclKind() const
        return dbAcl;
 }
 
-GenericHandle Database::aclHandle() const
-{
-       return HandleObject::handle();
-}
-
 
 //
 // Remote validation is not, by default, supported