summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-02-02 17:20:54 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-02-02 17:20:54 +0100
commit0b7e9057daceab33b13238f4dea90976b5d2074d (patch)
treed295db6809e43a22e09e704e8a45bfaf3c10e9cb /svdrp.c
parentfa32be64a8781d8c1cdec9b359a2e8fe62668416 (diff)
downloadvdr-0b7e9057daceab33b13238f4dea90976b5d2074d.tar.gz
vdr-0b7e9057daceab33b13238f4dea90976b5d2074d.tar.bz2
Introduced 'svdrphosts.conf'
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/svdrp.c b/svdrp.c
index eba409bb..08da0667 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.29 2002/02/02 13:33:57 kls Exp $
+ * $Id: svdrp.c 1.30 2002/02/02 15:59:18 kls Exp $
*/
#include "svdrp.h"
@@ -101,8 +101,16 @@ int cSocket::Accept(void)
struct sockaddr_in clientname;
uint size = sizeof(clientname);
int newsock = accept(sock, (struct sockaddr *)&clientname, &size);
- if (newsock > 0)
- isyslog(LOG_INFO, "connect from %s, port %hd", inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port));
+ if (newsock > 0) {
+ bool accepted = SVDRPhosts.Acceptable(clientname.sin_addr.s_addr);
+ if (!accepted) {
+ const char *s = "Access denied!\n";
+ write(newsock, s, strlen(s));
+ close(newsock);
+ newsock = -1;
+ }
+ isyslog(LOG_INFO, "connect from %s, port %hd - %s", inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port), accepted ? "accepted" : "DENIED");
+ }
else if (errno != EINTR && errno != EAGAIN)
LOG_ERROR;
return newsock;