diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index c8697fe614..c12b65ac80 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -50,6 +50,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ ///
+ /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version
+ /// bumps here should be compatible.
+ ///
+ public static int MAX_MAJOR_VERSION = 0;
+
protected TarArchiveReader archive;
private UserAccount m_userInfo;
@@ -126,7 +132,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{
- if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
+ if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
+ {
+ LoadControlFile(filePath, data);
+ }
+ else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
if (LoadAsset(filePath, data))
successfulAssetRestores++;
@@ -448,5 +458,44 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false;
}
}
+
+ ///
+ /// Load control file
+ ///
+ ///
+ ///
+ protected void LoadControlFile(string path, byte[] data)
+ {
+ int majorVersion = -1;
+ int minorVersion = -1;
+ string version = "ERROR";
+
+ NameTable nt = new NameTable();
+ XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
+ XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
+ XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
+ while (xtr.Read())
+ {
+ if (xtr.NodeType == XmlNodeType.Element)
+ {
+ if (xtr.Name.ToString() == "archive")
+ {
+ majorVersion = int.Parse(xtr["major_version"]);
+ minorVersion = int.Parse(xtr["minor_version"]);
+ version = string.Format("{0}.{1}", majorVersion, minorVersion);
+ }
+ }
+ }
+
+ if (majorVersion > MAX_MAJOR_VERSION)
+ {
+ throw new Exception(
+ string.Format(
+ "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",
+ majorVersion, MAX_MAJOR_VERSION));
+ }
+
+ m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
+ }
}
-}
\ No newline at end of file
+}