aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
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/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
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/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs21
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