summaryrefslogtreecommitdiff
path: root/setup.cpp
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger (at) gmx (dot) de>2009-02-19 20:29:24 +0100
committerChristian Wieninger <cwieninger (at) gmx (dot) de>2009-02-19 20:29:24 +0100
commitd5d59f964996c24019898e0573067b919fa83a6f (patch)
treeacbdb7d19f9083c77cb67b52b3c204defb623fca /setup.cpp
parent3b53981b41a59c7935e372a56737c14857432bae (diff)
parente3343f602dfe288afa1f027563d307d049d95c1e (diff)
downloadvdr-plugin-live-d5d59f964996c24019898e0573067b919fa83a6f.tar.gz
vdr-plugin-live-d5d59f964996c24019898e0573067b919fa83a6f.tar.bz2
Merge commit 'tadi/master'
Conflicts: README setup.cpp
Diffstat (limited to 'setup.cpp')
-rw-r--r--setup.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/setup.cpp b/setup.cpp
index 2bdf7bd..81971fd 100644
--- a/setup.cpp
+++ b/setup.cpp
@@ -155,15 +155,45 @@ bool Setup::CheckServerSslPort()
}
#endif
+namespace {
+ struct IpValidator
+ {
+ bool operator() (string const & ip)
+ {
+ struct in6_addr buf;
+ struct in_addr buf4;
+
+ bool valid = inet_aton(ip.c_str(), &buf4) || inet_pton(AF_INET6, ip.c_str(), &buf);
+
+ if (!valid) {
+ esyslog( "ERROR: live server ip %s is not a valid ip address", ip.c_str());
+ cerr << "ERROR: live server ip '" << ip << "' is not a valid ip address" << endl;
+ }
+ return valid;
+ }
+ };
+}
+
bool Setup::CheckServerIps()
{
struct in6_addr buf;
if ( m_serverIps.empty() ) {
+<<<<<<< HEAD:setup.cpp
+=======
+ // add a default IPv4 listener address
+ m_serverIps.push_back( "0.0.0.0" );
+ // and be prepared for IPv6 only hosts.
+>>>>>>> tadi/master:setup.cpp
m_serverIps.push_back( "::" );
+<<<<<<< HEAD:setup.cpp
+=======
+ // we assume these are ok :)
+>>>>>>> tadi/master:setup.cpp
return true;
}
+<<<<<<< HEAD:setup.cpp
for ( IpList::const_iterator ip = m_serverIps.begin(); ip != m_serverIps.end(); ++ip ) {
if ( inet_addr( ip->c_str() ) == static_cast< in_addr_t >( -1 ) ) {
if ( ! inet_pton( AF_INET6, ip->c_str(), &buf ) ) {
@@ -174,6 +204,12 @@ bool Setup::CheckServerIps()
}
}
return true;
+=======
+ IpList::iterator i = partition(m_serverIps.begin(), m_serverIps.end(), IpValidator());
+ m_serverIps.erase(i, m_serverIps.end());
+
+ return !m_serverIps.empty();
+>>>>>>> tadi/master:setup.cpp
}
std::string const Setup::GetMD5HashAdminPassword() const