From 3df8d8ff7601f8dd1bc818ed2a13946fd0d9a91e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 16 Oct 2010 04:59:51 +0100
Subject: Have OpenSim throw a strop if it tries to load an OAR with a major
version that is too high for it to handle
---
.../World/Archiver/ArchiveReadRequest.cs | 22 ++++++++++++++++++++++
.../Archiver/ArchiveWriteRequestPreparation.cs | 2 +-
2 files changed, 23 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 6b538f6..f1f5258 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -51,6 +51,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
public class ArchiveReadRequest
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ ///
+ /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version
+ /// bumps here should be compatible.
+ ///
+ public static int MAX_MAJOR_VERSION = 0;
protected Scene m_scene;
protected Stream m_loadStream;
@@ -497,6 +503,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
if (xtr.NodeType == XmlNodeType.Element)
{
+ if (xtr.Name.ToString() == "archive")
+ {
+ int majorVersion = int.Parse(xtr["major_version"]);
+ int minorVersion = int.Parse(xtr["minor_version"]);
+ string version = string.Format("{0}.{1}", majorVersion, minorVersion);
+
+ if (majorVersion > MAX_MAJOR_VERSION)
+ {
+ throw new Exception(
+ string.Format(
+ "The OAR you are trying to load has major version number of {0} but this version of OpenSim can only load OARs with major version number {1} and below",
+ majorVersion, MAX_MAJOR_VERSION));
+ }
+
+ m_log.InfoFormat("[ARCHIVER]: Loading OAR with version {0}", version);
+ }
if (xtr.Name.ToString() == "datetime")
{
int value;
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index f867e50..bae1bdd 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
///
- /// Create the control file for a 0.2 version archive
+ /// Create the control file for the most up to date archive
///
///
public static string Create0p2ControlFile()
--
cgit v1.1