diff options
Diffstat (limited to 'vdr-vdrmanager')
-rw-r--r-- | vdr-vdrmanager/clientsock.cpp | 14 | ||||
-rw-r--r-- | vdr-vdrmanager/serversock.cpp | 20 | ||||
-rw-r--r-- | vdr-vdrmanager/vdrmanager.cpp | 2 |
3 files changed, 22 insertions, 14 deletions
diff --git a/vdr-vdrmanager/clientsock.cpp b/vdr-vdrmanager/clientsock.cpp index 0bce192..133fba6 100644 --- a/vdr-vdrmanager/clientsock.cpp +++ b/vdr-vdrmanager/clientsock.cpp @@ -35,6 +35,7 @@ cVdrmanagerClientSocket::cVdrmanagerClientSocket(const char * password, int comp initCompression = false; #if VDRMANAGER_USE_SSL ssl = NULL; + sslCtx = NULL; sslReadWrite = SSL_NO_RETRY; sslWantsSelect = SSL_ERROR_NONE; #endif @@ -399,11 +400,14 @@ bool cVdrmanagerClientSocket::Attach(int fd) { if (!LoadCerts()) { return false; } - ssl = SSL_new(sslCtx); - SSL_set_accept_state(ssl); - BIO *bio = BIO_new_socket(sock, BIO_NOCLOSE); - SSL_set_bio(ssl, bio, bio); - BIO_set_nbio(bio, 1); + + if (certFile) { + ssl = SSL_new(sslCtx); + SSL_set_accept_state(ssl); + BIO *bio = BIO_new_socket(sock, BIO_NOCLOSE); + SSL_set_bio(ssl, bio, bio); + BIO_set_nbio(bio, 1); + } #endif return true; diff --git a/vdr-vdrmanager/serversock.cpp b/vdr-vdrmanager/serversock.cpp index 0c44a45..60b5f85 100644 --- a/vdr-vdrmanager/serversock.cpp +++ b/vdr-vdrmanager/serversock.cpp @@ -1,6 +1,7 @@ /* * extendes sockets */ +#include <string.h> #include <unistd.h> #include <vdr/plugin.h> @@ -35,7 +36,7 @@ bool cVdrmanagerServerSocket::Create(int port, const char * password, bool force this->keyFile = keyFile; // create socket - sock = socket(PF_INET, SOCK_STREAM, 0); + sock = socket(AF_INET6, SOCK_STREAM, 0); if (sock < 0) { LOG_ERROR; return false; @@ -48,11 +49,12 @@ bool cVdrmanagerServerSocket::Create(int port, const char * password, bool force setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &ReUseAddr, sizeof(ReUseAddr)); // bind to address - struct sockaddr_in name; - name.sin_family = AF_INET; - name.sin_port = htons(port); - name.sin_addr.s_addr = htonl(INADDR_ANY); - if (bind(sock, (struct sockaddr *) &name, sizeof(name)) < 0) { + struct sockaddr_in6 addr; + memset(&addr, 0, sizeof(addr)); + addr.sin6_family = AF_INET6; + addr.sin6_port = htons(port); + addr.sin6_addr = in6addr_any; + if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { LOG_ERROR; Close(); return false; @@ -93,7 +95,7 @@ cVdrmanagerClientSocket * cVdrmanagerServerSocket::Accept() { isyslog("[vdrmanager] new client on port %d", port); // accept the connection - struct sockaddr_in clientname; + struct sockaddr_in6 clientname; uint size = sizeof(clientname); int newsock = accept(sock, (struct sockaddr *) &clientname, &size); if (newsock > 0) { @@ -105,7 +107,8 @@ cVdrmanagerClientSocket * cVdrmanagerServerSocket::Accept() { } if (!IsPasswordSet() || forceCheckSvdrp == true) { - bool accepted = SVDRPhosts.Acceptable(clientname.sin_addr.s_addr); +/* + bool accepted = SVDRPhosts.Acceptable(clientname.sin6_addr); if (!accepted) { newsocket->Write(string("NACC Access denied.\n")); newsocket->Flush(); @@ -115,6 +118,7 @@ cVdrmanagerClientSocket * cVdrmanagerServerSocket::Accept() { dsyslog("[vdrmanager] 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; diff --git a/vdr-vdrmanager/vdrmanager.cpp b/vdr-vdrmanager/vdrmanager.cpp index 791d6a5..7c1913e 100644 --- a/vdr-vdrmanager/vdrmanager.cpp +++ b/vdr-vdrmanager/vdrmanager.cpp @@ -35,7 +35,7 @@ #endif #define VDRMANAGER_ARGS VDRMANAGER_ARGS_COMMON VDRMANAGER_ARGS_SSL VDRMANAGER_ARGS_COMPRESS -static const char *VERSION = "0.14"; +static const char *VERSION = "0.15"; static const char *DESCRIPTION = "VDR-Manager plugin"; class cVdrManager: public cPlugin { |