diff options
author | Justin Clark-Casey (justincc) | 2010-10-22 19:30:15 +0100 |
---|---|---|
committer | Jonathan Freedman | 2010-10-22 18:33:47 -0400 |
commit | bdd6857006906227470e296161483a7839cb8b91 (patch) | |
tree | 1ba702dd44b8ff2d9e2a00a50806bc177007634a /OpenSim/Region/CoreModules | |
parent | start parsing iar control file (diff) | |
download | opensim-SC-bdd6857006906227470e296161483a7839cb8b91.zip opensim-SC-bdd6857006906227470e296161483a7839cb8b91.tar.gz opensim-SC-bdd6857006906227470e296161483a7839cb8b91.tar.bz2 opensim-SC-bdd6857006906227470e296161483a7839cb8b91.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.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 2 |
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; |