Permalink
Browse files

Prevent UPnP detection from using backends of a different version

This implements the new ConnectionInfo values into the DatabaseParams
struct, and throws an error if the remote backend is found to have a
different protocol or database version.

Closes #9174

While this does not address the secondary issue that OSX does not
support detection of an interactive console, it does prevent a UPnP
connected client from ever altering the database.
  • Loading branch information...
1 parent 28a42f2 commit e2295b3627a8ff0ce38ebdd261c684b46247e6c0 @wagnerrp wagnerrp committed Jul 26, 2011
@@ -21,6 +21,12 @@ struct MBASE_PUBLIC DatabaseParams
int wolReconnect; ///< seconds to wait for reconnect
int wolRetry; ///< times to retry to reconnect
QString wolCommand; ///< command to use for wake-on-lan
+
+ QString verVersion; ///< git version string
+ QString verBranch; ///< git branch
+ QString verProtocol; ///< backend protocol
+ QString verBinary; ///< binary library version
+ QString verSchema; ///< core schema version
};
#endif
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
-#define MYTH_BINARY_VERSION "0.25.20110726-1"
+#define MYTH_BINARY_VERSION "0.25.20110726-2"
/** \brief Increment this whenever the MythTV network protocol changes.
*
@@ -21,6 +21,7 @@
//
//////////////////////////////////////////////////////////////////////////////
+#include "mythversion.h"
#include "mythxmlclient.h"
#include "mythlogging.h"
@@ -90,6 +91,19 @@ UPnPResultCode MythXMLClient::GetConnectionInfo( const QString &sPin, DatabasePa
pParams->wolRetry = GetNodeValue( wolNode, "Retry" , 0 );
pParams->wolCommand = GetNodeValue( wolNode, "Command" , QString());
+ QDomNode verNode = oNode.namedItem( "Version" );
+
+ pParams->verVersion = GetNodeValue( verNode, "Version" , "" );
+ pParams->verBranch = GetNodeValue( verNode, "Branch" , "" );
+ pParams->verProtocol = GetNodeValue( verNode, "Protocol" , "" );
+ pParams->verBinary = GetNodeValue( verNode, "Binary" , "" );
+ pParams->verSchema = GetNodeValue( verNode, "Schema" , "" );
+
+ if ((pParams->verProtocol != MYTH_PROTO_VERSION) ||
+ (pParams->verSchema != MYTH_DATABASE_VERSION))
+ // incompatible version, we cannot use this backend
+ return UPnPResult_ActionFailed;
+
return UPnPResult_Success;
}
else

0 comments on commit e2295b3

Please sign in to comment.