summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2010-01-17 12:27:01 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2010-01-17 12:27:01 +0100
commitc198a259432a5ee612ac8dd211f8017f0786fedb (patch)
tree41ae5933cfac61d345c449a56d33a7dbde04169b /config.c
parent97e4dbe7737852144e97e4edff36be95f39c5cc5 (diff)
downloadvdr-c198a259432a5ee612ac8dd211f8017f0786fedb.tar.gz
vdr-c198a259432a5ee612ac8dd211f8017f0786fedb.tar.bz2
If svdrphosts.conf contains only the address of the local host, the SVDRP port is opened only for the local host
Diffstat (limited to 'config.c')
-rw-r--r--config.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/config.c b/config.c
index 1605902d..9c73e872 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 2.7 2010/01/16 14:27:29 kls Exp $
+ * $Id: config.c 2.8 2010/01/17 12:22:56 kls Exp $
*/
#include "config.h"
@@ -118,6 +118,11 @@ bool cSVDRPhost::Parse(const char *s)
return result != 0 && (mask != 0 || addr.s_addr == 0);
}
+bool cSVDRPhost::IsLocalhost(void)
+{
+ return addr.s_addr == htonl(INADDR_LOOPBACK);
+}
+
bool cSVDRPhost::Accepts(in_addr_t Address)
{
return (Address & mask) == (addr.s_addr & mask);
@@ -276,6 +281,17 @@ cCommands RecordingCommands;
cSVDRPhosts SVDRPhosts;
+bool cSVDRPhosts::LocalhostOnly(void)
+{
+ cSVDRPhost *h = First();
+ while (h) {
+ if (!h->IsLocalhost())
+ return false;
+ h = (cSVDRPhost *)h->Next();
+ }
+ return true;
+}
+
bool cSVDRPhosts::Acceptable(in_addr_t Address)
{
cSVDRPhost *h = First();