diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | css/Makefile | 1 | ||||
-rw-r--r-- | javascript/Makefile | 1 | ||||
-rw-r--r-- | pages/Makefile | 3 | ||||
-rw-r--r-- | pages/page_exit.eh | 4 | ||||
-rw-r--r-- | thread.cpp | 22 | ||||
-rw-r--r-- | tntconfig.cpp | 160 | ||||
-rw-r--r-- | tntconfig.h | 26 | ||||
-rw-r--r-- | tntfeatures.h | 4 |
9 files changed, 0 insertions, 222 deletions
@@ -37,7 +37,6 @@ APIVERSION = $(call PKGCFG,apiversion) ### Determine tntnet and cxxtools versions: TNTVERSION = $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') CXXTOOLVER = $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -TNTVERS7 = $(shell ver=$(TNTVERSION); if [ $$ver -ge "1606" ]; then echo "yes"; fi) CXXFLAGS += $(shell tntnet-config --cxxflags) LIBS += $(shell tntnet-config --libs) diff --git a/css/Makefile b/css/Makefile index 4a5528f..4373ffb 100644 --- a/css/Makefile +++ b/css/Makefile @@ -3,7 +3,6 @@ PLUGIN = live ### Additional options to silence TNTNET warnings TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-function -TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') ### Includes and Defines (add further entries here): INCLUDES += -I$(VDRDIR)/include -I.. diff --git a/javascript/Makefile b/javascript/Makefile index b2ed3c4..bca2426 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -3,7 +3,6 @@ PLUGIN = live ### Additional options to silence TNTNET warnings TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-function -TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') ### Includes and Defines (add further entries here): INCLUDES += -I$(VDRDIR)/include -I.. diff --git a/pages/Makefile b/pages/Makefile index 520b208..07fd031 100644 --- a/pages/Makefile +++ b/pages/Makefile @@ -3,9 +3,6 @@ PLUGIN = live ### Additional options to silence TNTNET warnings TNTFLAGS ?= -Wno-overloaded-virtual -Wno-unused-variable -TNTVERSION ?= $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') -CXXTOOLVER ?= $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }') - ### Includes and Defines (add further entries here): INCLUDES += -I$(VDRDIR)/include -I.. diff --git a/pages/page_exit.eh b/pages/page_exit.eh index 5101171..319260e 100644 --- a/pages/page_exit.eh +++ b/pages/page_exit.eh @@ -5,11 +5,7 @@ <%cpp> spoint.commit(); } catch ( vdrlive::HtmlError const& ex ) { -#if TNTVERSION >= 1606 tnt::QueryParams param = qparam; -#else - cxxtools::QueryParams param = qparam; -#endif param.add( "pageTitle", pageTitle ); param.add( "errorMessage", ex.what() ); callComp( "error", request, reply, param ); @@ -11,19 +11,6 @@ namespace vdrlive { using namespace std; using namespace tnt; -#if ! TNT_CONFIG_INTERNAL -class ProtectedCString -{ -public: - ProtectedCString( char const* string ): m_string( strdup( string ) ) {} - ~ProtectedCString() { free( m_string ); } - - operator char*() { return m_string; } - -private: - char* m_string; -}; -#endif // ! TNT_CONFIG_INTERNAL ServerThread::ServerThread() { @@ -45,17 +32,8 @@ void ServerThread::Stop() void ServerThread::Action() { try { -#if TNT_CONFIG_INTERNAL m_server.reset(new Tntnet()); TntConfig::Get().Configure(*m_server); -#else - ProtectedCString configPath(TntConfig::Get().GetConfigPath().c_str()); - - char* argv[] = { const_cast< char* >( "tntnet" ), const_cast< char* >( "-c" ), configPath }; - int argc = sizeof( argv ) / sizeof( argv[0] ); - - m_server.reset(new Tntnet( argc, argv )); -#endif // TNT_CONFIG_INTERNAL m_server->run(); m_server.reset(0); } catch (exception const& ex) { diff --git a/tntconfig.cpp b/tntconfig.cpp index 3325776..03bea9e 100644 --- a/tntconfig.cpp +++ b/tntconfig.cpp @@ -26,167 +26,8 @@ namespace vdrlive { TntConfig::TntConfig() { -#if ! TNT_CONFIG_INTERNAL - WriteConfig(); -#endif - } - -#if ! TNT_CONFIG_INTERNAL - void TntConfig::WriteConfig() - { - WriteProperties(); - - string const configDir(Plugin::GetConfigDirectory()); -#if APIVERSNUM > 10729 - string const resourceDir(Plugin::GetResourceDirectory()); -#endif - - ostringstream builder; - builder << configDir << "/httpd.config"; - m_configPath = builder.str(); - - ofstream file( m_configPath.c_str(), ios::out | ios::trunc ); - if ( !file ) { - ostringstream builder; - builder << "Can't open " << m_configPath << " for writing: " << strerror( errno ); - throw runtime_error( builder.str() ); - } - - // +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ - // ------------------------------------------------------------------------ - // These MapUrl statements are very security sensitive! - // A wrong mapping to content@ may allow retrieval of arbitrary files - // from your VDR system via live. - // Two meassures are taken against this in our implementation: - // 1. The MapUrls need to be checked regulary against possible exploits - // One tool to do this can be found here: - // http://www.lumadis.be/regex/test_regex.php - // Newly inserted MapUrls should be marked with author and confirmed - // by a second party. (use source code comments for this) - // 2. content.ecpp checks the given path to be - // a. an absolute path starting at / - // b. not containing ../ paths components - // In order to do so, the MapUrl statements must create absolute - // path arguments to content@ - // ------------------------------------------------------------------------ - // +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ CAUTION +++ - - - file << "MapUrl ^/$ login@" << endl; - - // the following redirects vdr_request URL to the component - // specified by the action parameter. - // inserted by 'tadi' -- verified with above, but not counterchecked yet! - file << "MapUrl ^/vdr_request/([^.]+) $1@" << endl; - - // the following selects the theme specific 'theme.css' file - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -#if APIVERSNUM > 10729 - file << "MapUrl ^/themes/([^/]*)/css.*/(.+\\.css) content@ " << resourceDir << "/themes/$1/css/$2 text/css" << endl; -#else - file << "MapUrl ^/themes/([^/]*)/css.*/(.+\\.css) content@ " << configDir << "/themes/$1/css/$2 text/css" << endl; -#endif - - // the following rules provide a search scheme for images. The first - // rule where a image is found, terminates the search. - // 1. /themes/<theme>/img/<imgname>.<ext> - // 2. /img/<imgname>.<ext> - // deprecated: 3. <imgname>.<ext> (builtin images) - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -#if APIVERSNUM > 10729 - file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << resourceDir << "/themes/$1/img/$2.$3 image/$3" << endl; - file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << resourceDir << "/img/$2.$3 image/$3" << endl; -#else - file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << configDir << "/themes/$1/img/$2.$3 image/$3" << endl; - file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) content@ " << configDir << "/img/$2.$3 image/$3" << endl; -#endif - // deprecated: file << "MapUrl ^/themes/([^/]*)/img.*/(.+)\\.(.+) $2@" << endl; - - // Epg images - string const epgImgPath(LiveSetup().GetEpgImageDir()); - if (!epgImgPath.empty()) { - // inserted by 'winni' -- EXPLOITABLE! (checked by tadi) - // file << "MapUrl ^/epgimages/(.*)\\.(.+) content@ " << epgImgPath << "/$1.$2 image/$2" << endl; - - // inserted by 'tadi' -- verified with above, but not counterchecked yet! - file << "MapUrl ^/epgimages/([^/]*)\\.([^./]+) content@ " << epgImgPath << "/$1.$2 image/$2" << endl; - } - - // select additional (not build in) javascript. - // WARNING: no path components with '.' in the name are allowed. Only - // the basename may contain dots and must end with '.js' - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -#if APIVERSNUM > 10729 - file << "MapUrl ^/js(/[^.]*)([^/]*\\.js) content@ " << resourceDir << "/js$1$2 text/javascript" << endl; -#else - file << "MapUrl ^/js(/[^.]*)([^/]*\\.js) content@ " << configDir << "/js$1$2 text/javascript" << endl; -#endif - - // map to 'css/basename(uri)' - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -#if APIVERSNUM > 10729 - file << "MapUrl ^/css.*/(.+) content@ " << resourceDir << "/css/$1 text/css" << endl; -#else - file << "MapUrl ^/css.*/(.+) content@ " << configDir << "/css/$1 text/css" << endl; -#endif - - // map to 'img/basename(uri)' - // inserted by 'tadi' -- verified with above, but not counterchecked yet! -#if APIVERSNUM > 10729 - file << "MapUrl ^/img.*/(.+)\\.([^.]+) content@ " << resourceDir << "/img/$1.$2 image/$2" << endl; -#else - file << "MapUrl ^/img.*/(.+)\\.([^.]+) content@ " << configDir << "/img/$1.$2 image/$2" << endl; -#endif - - // Map favicon.ico into img directory -#if APIVERSNUM > 10729 - file << "MapUrl ^/favicon.ico$ content@ " << resourceDir << "/img/favicon.ico image/x-icon" << endl; -#else - file << "MapUrl ^/favicon.ico$ content@ " << configDir << "/img/favicon.ico image/x-icon" << endl; -#endif - - // insecure by default: DO NOT UNKOMMENT!!! - // file << "MapUrl /([^/]+/.+) content@ $1" << endl; - - // takes first path components without 'extension' when it does not - // contain '.' - // modified by 'tadi' -- verified with above, but not counterchecked yet! - file << "MapUrl ^/([^./]+)(.*)? $1@" << endl; - - file << "PropertyFile " << m_propertiesPath << endl; - file << "SessionTimeout 86400" << endl; - file << "DefaultContentType \"text/html; charset=" << LiveI18n().CharacterEncoding() << "\"" << endl; - - Setup::IpList const& ips = LiveSetup().GetServerIps(); - int port = LiveSetup().GetServerPort(); - for ( Setup::IpList::const_iterator ip = ips.begin(); ip != ips.end(); ++ip ) { - file << "Listen " << *ip << " " << port << endl; - } - } -#endif - -#if ! TNT_CONFIG_INTERNAL - void TntConfig::WriteProperties() - { - ostringstream builder; - builder << Plugin::GetConfigDirectory() << "/httpd.properties"; - m_propertiesPath = builder.str(); - - ofstream file( m_propertiesPath.c_str(), ios::out | ios::trunc ); - if ( !file ) { - ostringstream builder; - builder << "Can't open " << m_propertiesPath << " for writing: " << strerror( errno ); - throw runtime_error( builder.str() ); - } - - // XXX modularize - file << "rootLogger=" << LiveSetup().GetTntnetLogLevel() << endl; - file << "logger.tntnet=" << LiveSetup().GetTntnetLogLevel() << endl; - file << "logger.cxxtools=" << LiveSetup().GetTntnetLogLevel() << endl; } -#endif -#if TNT_CONFIG_INTERNAL namespace { std::string GetResourcePath() { @@ -414,7 +255,6 @@ namespace vdrlive { } #endif // TNT_SSL_SUPPORT } -#endif TntConfig const& TntConfig::Get() { diff --git a/tntconfig.h b/tntconfig.h index 5e11175..118a6e5 100644 --- a/tntconfig.h +++ b/tntconfig.h @@ -8,7 +8,6 @@ namespace vdrlive { -#if TNT_CONFIG_INTERNAL class TntConfig { public: @@ -20,31 +19,6 @@ namespace vdrlive { TntConfig(); TntConfig( TntConfig const& ); }; -#else - class TntConfig - { - public: - static TntConfig const& Get(); - - std::string const& GetConfigPath() const { return m_configPath; } -#if APIVERSNUM > 10729 - std::string const& GetResourcePath() const { return m_resourcePath; } -#endif - - private: - std::string m_propertiesPath; - std::string m_configPath; -#if APIVERSNUM > 10729 - std::string m_resourcePath; -#endif - - TntConfig(); - TntConfig( TntConfig const& ); - - void WriteProperties(); - void WriteConfig(); - }; -#endif // TNT_CONFIG_INTERNAL } // namespace vdrlive diff --git a/tntfeatures.h b/tntfeatures.h index 76d3757..d28281a 100644 --- a/tntfeatures.h +++ b/tntfeatures.h @@ -10,10 +10,6 @@ // SSL-Support works from tntnet version 1.6.1 onwards. #define TNT_SSL_SUPPORT (TNTVERSION >= 16100) -// Configuration of tntnet from within the source code and not with a -// dedicated config file. -#define TNT_CONFIG_INTERNAL (TNTVERSION >= 16060) - // Query params are now in tntnet and not in cxxtools #define TNT_HAS_QUERYPARAMS (TNTVERSION >= 16060) |