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 ()
case kSecUnlockEvent: // kNotificationEventUnlocked
case kSecPasswordChangedEvent: // kNotificationEventPassphraseChanged
case kSecDefaultChangedEvent:
- case kSecDataAccessEvent:
case kSecKeychainListChangedEvent:
case kSecTrustSettingsChangedEvent:
return false;
+ case kSecDataAccessEvent:
case kSecAddEvent:
case kSecDeleteEvent:
case kSecUpdateEvent:
WriteMessage (notification->domain, notification->event, data, int_cast<size_t, UInt32>(length));
+ StLock<Mutex> lock(mMutex);
if (!mActive)
{
Server::active().setTimer (this, Time::Interval(kServerWait));
void SharedMemoryListener::action ()
{
+ StLock<Mutex> 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;
}