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/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |
parent | start parsing iar control file (diff) | |
download | opensim-SC_OLD-bdd6857006906227470e296161483a7839cb8b91.zip opensim-SC_OLD-bdd6857006906227470e296161483a7839cb8b91.tar.gz opensim-SC_OLD-bdd6857006906227470e296161483a7839cb8b91.tar.bz2 opensim-SC_OLD-bdd6857006906227470e296161483a7839cb8b91.tar.xz |
Implement guard against trying to load incompatible version IARs
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 21 |
1 files changed, 19 insertions, 2 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 |