From 4a486de7c9db11591840c451ebb84c3ac1b2e8b9 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Wed, 10 Dec 2008 14:51:56 +0100 Subject: updated ssl patch --- tntconfig.cpp | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'tntconfig.cpp') diff --git a/tntconfig.cpp b/tntconfig.cpp index 71bee4d..23943a5 100644 --- a/tntconfig.cpp +++ b/tntconfig.cpp @@ -128,24 +128,6 @@ namespace vdrlive { for ( Setup::IpList::const_iterator ip = ips.begin(); ip != ips.end(); ++ip ) { file << "Listen " << *ip << " " << port << endl; } - -// not used any more see below: #ifdef TNTVERS7 -// not used any more see below: int s_port = LiveSetup().GetServerSslPort(); -// not used any more see below: string s_cert = LiveSetup().GetServerSslCert(); -// not used any more see below: -// not used any more see below: if (s_cert.empty()) { -// not used any more see below: s_cert = configDir + "/live.pem"; -// not used any more see below: } -// not used any more see below: -// not used any more see below: if ( ifstream( s_cert.c_str() ) ) { -// not used any more see below: for ( Setup::IpList::const_iterator ip = ips.begin(); ip != ips.end(); ++ip ) { -// not used any more see below: file << "SslListen " << *ip << " " << s_port << " " << s_cert << endl; -// not used any more see below: } -// not used any more see below: } -// not used any more see below: else { -// not used any more see below: esyslog( "ERROR: %s: %s", s_cert.c_str(), strerror( errno ) ); -// not used any more see below: } -// not used any more see below: #endif } #endif @@ -277,18 +259,23 @@ namespace vdrlive { #if TNTSSLSUPPORT int s_port = LiveSetup().GetServerSslPort(); string s_cert = LiveSetup().GetServerSslCert(); + string s_key = LiveSetup().GetServerSslKey(); if (s_cert.empty()) { s_cert = configDir + "/live.pem"; } - if ( ifstream( s_cert.c_str() ) ) { + if (s_key.empty()) { + s_key = configDir + "/live-key.pem"; + } + + if ( ifstream( s_cert.c_str() ) && ifstream( s_key.c_str() ) ) { for ( Setup::IpList::const_iterator ip = ips.begin(); ip != ips.end(); ++ip ) { - app.sslListen(s_cert, s_cert, *ip, s_port); + app.sslListen(s_cert, s_key, *ip, s_port); } } else { - esyslog( "ERROR: %s: %s", s_cert.c_str(), strerror( errno ) ); + esyslog( "ERROR: Unable to load cert/key (%s/%s): %s", s_cert.c_str(), s_key.c_str(), strerror( errno ) ); } #endif // TNTSSLSUPPORT -- cgit v1.2.3 From e3343f602dfe288afa1f027563d307d049d95c1e Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Wed, 18 Feb 2009 00:19:32 +0100 Subject: Fixed the need to add an --ip parameter on the live command line if the host had no IPv6 support in the kernel (or module). Don't abort operation if one of the given ips fails at bind call. Abort only if every bind call fails. --- tntconfig.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tntconfig.cpp') diff --git a/tntconfig.cpp b/tntconfig.cpp index 23943a5..d35dad4 100644 --- a/tntconfig.cpp +++ b/tntconfig.cpp @@ -252,8 +252,19 @@ namespace vdrlive { Setup::IpList const& ips = LiveSetup().GetServerIps(); int port = LiveSetup().GetServerPort(); + size_t listenFailures = 0; for ( Setup::IpList::const_iterator ip = ips.begin(); ip != ips.end(); ++ip ) { - app.listen(*ip, port); + try { + app.listen(*ip, port); + } + catch (exception const & ex) { + esyslog("ERROR: live ip = %s is invalid: exception = %s", ip->c_str(), ex.what()); + if (++listenFailures == ips.size()) { + // if no listener was initialized we throw at + // least the last exception to the next layer. + throw; + } + } } #if TNTSSLSUPPORT -- cgit v1.2.3