diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs b/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs index a1884d5..afe5938 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs | |||
@@ -27,7 +27,9 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | ||
30 | using System.Text; | 31 | using System.Text; |
32 | using log4net; | ||
31 | 33 | ||
32 | namespace OpenSim.Region.CoreModules.World.Archiver | 34 | namespace OpenSim.Region.CoreModules.World.Archiver |
33 | { | 35 | { |
@@ -36,7 +38,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
36 | /// </summary> | 38 | /// </summary> |
37 | public class TarArchiveReader | 39 | public class TarArchiveReader |
38 | { | 40 | { |
39 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | 42 | ||
41 | public enum TarEntryType | 43 | public enum TarEntryType |
42 | { | 44 | { |
@@ -116,12 +118,24 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
116 | // If we've reached the end of the archive we'll be in null block territory, which means | 118 | // If we've reached the end of the archive we'll be in null block territory, which means |
117 | // the next byte will be 0 | 119 | // the next byte will be 0 |
118 | if (header[0] == 0) | 120 | if (header[0] == 0) |
119 | return null; | 121 | return null; |
120 | 122 | ||
121 | TarHeader tarHeader = new TarHeader(); | 123 | TarHeader tarHeader = new TarHeader(); |
122 | 124 | ||
123 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); | 125 | // If we're looking at a GNU tar long link then extract the long name and pull up the next header |
124 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); | 126 | if (header[156] == (byte)'L') |
127 | { | ||
128 | int longNameLength = ConvertOctalBytesToDecimal(header, 124, 11); | ||
129 | tarHeader.FilePath = m_asciiEncoding.GetString(m_br.ReadBytes(longNameLength)); | ||
130 | m_log.DebugFormat("[TAR ARCHIVE READER]: Got long file name {0}", tarHeader.FilePath); | ||
131 | header = m_br.ReadBytes(512); | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); | ||
136 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); | ||
137 | } | ||
138 | |||
125 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); | 139 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); |
126 | 140 | ||
127 | switch (header[156]) | 141 | switch (header[156]) |