aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-10-22 19:30:15 +0100
committerJustin Clark-Casey (justincc)2010-10-22 19:30:15 +0100
commit7f2d8449169481f1ec6ee5373bdfeef83c3434bc (patch)
tree4d1bedf96294227caba40313d62e5d9ccfdd506a /OpenSim/Region/CoreModules
parentstart parsing iar control file (diff)
downloadopensim-SC_OLD-7f2d8449169481f1ec6ee5373bdfeef83c3434bc.zip
opensim-SC_OLD-7f2d8449169481f1ec6ee5373bdfeef83c3434bc.tar.gz
opensim-SC_OLD-7f2d8449169481f1ec6ee5373bdfeef83c3434bc.tar.bz2
opensim-SC_OLD-7f2d8449169481f1ec6ee5373bdfeef83c3434bc.tar.xz
Implement guard against trying to load incompatible version IARs
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs21
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs2
2 files changed, 20 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 2beea8e..5500557 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -51,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
51 { 51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 /// <summary>
55 /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version
56 /// bumps here should be compatible.
57 /// </summary>
58 public static int MAX_MAJOR_VERSION = 0;
59
54 protected TarArchiveReader archive; 60 protected TarArchiveReader archive;
55 61
56 private UserAccount m_userInfo; 62 private UserAccount m_userInfo;
@@ -476,8 +482,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
476 { 482 {
477 XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); 483 XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
478 XElement archiveElement = doc.Element("archive"); 484 XElement archiveElement = doc.Element("archive");
479 int.Parse(archiveElement.Attribute("major_version").Value); 485 int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value);
480 int.Parse(archiveElement.Attribute("minor_version").Value); 486 int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value);
487 string version = string.Format("{0}.{1}", majorVersion, minorVersion);
488
489 if (majorVersion > MAX_MAJOR_VERSION)
490 {
491 throw new Exception(
492 string.Format(
493 "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below",
494 majorVersion, MAX_MAJOR_VERSION));
495 }
496
497 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
481 } 498 }
482 } 499 }
483} \ No newline at end of file 500} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 087d3df..117b2fd 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
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 54
55 /// <summary> 55 /// <summary>
56 /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version 56 /// The maximum major version of OAR that we can read. Minor versions shouldn't need a max number since version
57 /// bumps here should be compatible. 57 /// bumps here should be compatible.
58 /// </summary> 58 /// </summary>
59 public static int MAX_MAJOR_VERSION = 0; 59 public static int MAX_MAJOR_VERSION = 0;