From 919248abb37a9a29460fd743bce620cf208e28f9 Mon Sep 17 00:00:00 2001 From: Lars Hanisch Date: Sun, 5 Feb 2012 16:01:45 +0100 Subject: test udev-allowed source at ProvidesChannel --- dynamicdevice.c | 29 +++++++++++++++++++++-------- dynamicdevice.h | 1 + 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/dynamicdevice.c b/dynamicdevice.c index a594438..6845e1c 100644 --- a/dynamicdevice.c +++ b/dynamicdevice.c @@ -661,6 +661,19 @@ void cDynamicDevice::InternSetLock(bool Lock) isyslog("dynamite: %slocked device %s", Lock ? "" : "un", GetDevPath()); } +bool cDynamicDevice::InternProvidesSource(int Source) const +{ + if (udevProvidesSources) { + cString source = cSource::ToString(Source); + cString search = cString::sprintf(",%s,", *source); + if (strstr(**udevProvidesSources, *search) == NULL) { + isyslog("dynamite: device %s shall not provide source %s", GetDevPath(), *source); + return false; + } + } + return true; +} + void cDynamicDevice::DeleteSubDevice() { subDeviceIsReady = false; @@ -807,14 +820,8 @@ void cDynamicDevice::CloseFilter(int Handle) bool cDynamicDevice::ProvidesSource(int Source) const { - if (udevProvidesSources) { - cString source = cSource::ToString(Source); - cString search = cString::sprintf(",%s,", *source); - if (strstr(**udevProvidesSources, *search) == NULL) { - isyslog("dynamite: device %s shall not provide source %s", GetDevPath(), *source); - return false; - } - } + if (!InternProvidesSource(Source)) + return false; if (subDevice) return subDevice->ProvidesSource(Source); return cDevice::ProvidesSource(Source); @@ -822,6 +829,8 @@ bool cDynamicDevice::ProvidesSource(int Source) const bool cDynamicDevice::ProvidesTransponder(const cChannel *Channel) const { + if (!InternProvidesSource(Channel->Source())) + return false; if (subDevice) return subDevice->ProvidesTransponder(Channel); return cDevice::ProvidesTransponder(Channel); @@ -829,6 +838,8 @@ bool cDynamicDevice::ProvidesTransponder(const cChannel *Channel) const bool cDynamicDevice::ProvidesTransponderExclusively(const cChannel *Channel) const { + if (!InternProvidesSource(Channel->Source())) + return false; if (subDevice) return subDevice->ProvidesTransponderExclusively(Channel); return cDevice::ProvidesTransponderExclusively(Channel); @@ -836,6 +847,8 @@ bool cDynamicDevice::ProvidesTransponderExclusively(const cChannel *Channel) con bool cDynamicDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const { + if (!InternProvidesSource(Channel->Source())) + return false; if (subDevice) return subDevice->ProvidesChannel(Channel, Priority, NeedsDetachReceivers); return cDevice::ProvidesChannel(Channel, Priority, NeedsDetachReceivers); diff --git a/dynamicdevice.h b/dynamicdevice.h index efb44cc..4c4ac1c 100644 --- a/dynamicdevice.h +++ b/dynamicdevice.h @@ -84,6 +84,7 @@ private: void InternSetGetTSTimeout(int Seconds); void InternSetGetTSTimeoutHandlerArg(const char *Arg); void InternSetLock(bool Lock); + bool InternProvidesSource(int Source) const; public: cDynamicDevice(); const char *GetDevPath(void) const; -- cgit v1.2.3