X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/6b200bc335dc93c5516ccb52f14bd896d8c7fad7..7e6b461318c8a779d91381531435a68ee4e8b6ed:/securityd/src/notifications.cpp diff --git a/securityd/src/notifications.cpp b/securityd/src/notifications.cpp index 26440052..1efed3a5 100644 --- a/securityd/src/notifications.cpp +++ b/securityd/src/notifications.cpp @@ -204,13 +204,8 @@ bool Listener::testPredicate(const std::function SharedMemoryListener::SharedMemoryListener(const char* segmentName, SegmentOffsetType segmentSize, uid_t uid, gid_t gid) : Listener (kNotificationDomainAll, kNotificationAllEvents), SharedMemoryServer (segmentName, segmentSize, uid, gid), - mActive (false) + mActive (false), mMutex() { - if (segmentName == NULL) - { - secerror("Attempted to start securityd with a NULL segmentName"); - abort(); - } } SharedMemoryListener::~SharedMemoryListener () @@ -304,10 +299,10 @@ bool SharedMemoryListener::needsPrivacyFilter(Notification *notification) { case kSecUnlockEvent: // kNotificationEventUnlocked case kSecPasswordChangedEvent: // kNotificationEventPassphraseChanged case kSecDefaultChangedEvent: - case kSecDataAccessEvent: case kSecKeychainListChangedEvent: case kSecTrustSettingsChangedEvent: return false; + case kSecDataAccessEvent: case kSecAddEvent: case kSecDeleteEvent: case kSecUpdateEvent: @@ -372,6 +367,7 @@ void SharedMemoryListener::notifyMe(Notification* notification) WriteMessage (notification->domain, notification->event, data, int_cast(length)); + StLock lock(mMutex); if (!mActive) { Server::active().setTimer (this, Time::Interval(kServerWait)); @@ -381,9 +377,10 @@ void SharedMemoryListener::notifyMe(Notification* notification) void SharedMemoryListener::action () { + StLock lock(mMutex); + notify_post (mSegmentName.c_str ()); secinfo("notify", "Posted notification to clients."); secdebug("MDSPRIVACY","[%03d] Posted notification to clients", mUID); - notify_post (mSegmentName.c_str ()); mActive = false; }