aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-10-16 04:59:51 +0100
committerJustin Clark-Casey (justincc)2010-10-16 04:59:51 +0100
commit3df8d8ff7601f8dd1bc818ed2a13946fd0d9a91e (patch)
tree0427f18ba7619e1d94a24e4a04b5a96264da52a6 /OpenSim
parentsave oar control file first rather than in the middle so that it's the first ... (diff)
downloadopensim-SC_OLD-3df8d8ff7601f8dd1bc818ed2a13946fd0d9a91e.zip
opensim-SC_OLD-3df8d8ff7601f8dd1bc818ed2a13946fd0d9a91e.tar.gz
opensim-SC_OLD-3df8d8ff7601f8dd1bc818ed2a13946fd0d9a91e.tar.bz2
opensim-SC_OLD-3df8d8ff7601f8dd1bc818ed2a13946fd0d9a91e.tar.xz
Have OpenSim throw a strop if it tries to load an OAR with a major version that is too high for it to handle
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs2
2 files changed, 23 insertions, 1 deletions
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
51 public class ArchiveReadRequest 51 public class ArchiveReadRequest
52 { 52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 /// <summary>
56 /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version
57 /// bumps here should be compatible.
58 /// </summary>
59 public static int MAX_MAJOR_VERSION = 0;
54 60
55 protected Scene m_scene; 61 protected Scene m_scene;
56 protected Stream m_loadStream; 62 protected Stream m_loadStream;
@@ -497,6 +503,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
497 { 503 {
498 if (xtr.NodeType == XmlNodeType.Element) 504 if (xtr.NodeType == XmlNodeType.Element)
499 { 505 {
506 if (xtr.Name.ToString() == "archive")
507 {
508 int majorVersion = int.Parse(xtr["major_version"]);
509 int minorVersion = int.Parse(xtr["minor_version"]);
510 string version = string.Format("{0}.{1}", majorVersion, minorVersion);
511
512 if (majorVersion > MAX_MAJOR_VERSION)
513 {
514 throw new Exception(
515 string.Format(
516 "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",
517 majorVersion, MAX_MAJOR_VERSION));
518 }
519
520 m_log.InfoFormat("[ARCHIVER]: Loading OAR with version {0}", version);
521 }
500 if (xtr.Name.ToString() == "datetime") 522 if (xtr.Name.ToString() == "datetime")
501 { 523 {
502 int value; 524 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
181 } 181 }
182 182
183 /// <summary> 183 /// <summary>
184 /// Create the control file for a 0.2 version archive 184 /// Create the control file for the most up to date archive
185 /// </summary> 185 /// </summary>
186 /// <returns></returns> 186 /// <returns></returns>
187 public static string Create0p2ControlFile() 187 public static string Create0p2ControlFile()