mirror of
https://github.com/claunia/apprepodbmgr.git
synced 2025-12-16 19:24:42 +00:00
Do not continue with symbolic links, not yet supported.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2017-05-21 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Workers/Files.cs:
|
||||
* Workers/Compression.cs:
|
||||
Do not continue with symbolic links, not yet supported.
|
||||
|
||||
2017-05-21 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Workers/Clamd.cs:
|
||||
|
||||
@@ -345,11 +345,29 @@ namespace osrepodbmgr.Core
|
||||
#endif
|
||||
long counter = 0;
|
||||
string format = null;
|
||||
bool isLink = false;
|
||||
JsonTextReader jsReader = new JsonTextReader(new StringReader(lsarOutput));
|
||||
while(jsReader.Read())
|
||||
{
|
||||
if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "XADFileName")
|
||||
counter++;
|
||||
else if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "XADIsLink")
|
||||
{
|
||||
jsReader.Read();
|
||||
if(jsReader.TokenType == JsonToken.Integer)
|
||||
isLink = int.Parse(jsReader.Value.ToString()) > 0;
|
||||
}
|
||||
else if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "XADIsHardLink")
|
||||
{
|
||||
jsReader.Read();
|
||||
// TODO: Support symlinks, devices, hardlinks, whatever?
|
||||
if(jsReader.TokenType == JsonToken.Integer && isLink && int.Parse(jsReader.Value.ToString()) == 0)
|
||||
{
|
||||
if(Failed != null)
|
||||
Failed("Archive contains unsupported symbolic links, not continuing.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "lsarFormatName")
|
||||
{
|
||||
jsReader.Read();
|
||||
|
||||
@@ -338,6 +338,15 @@ namespace osrepodbmgr.Core
|
||||
filesPath = Context.path;
|
||||
|
||||
string relpath = file.Substring(filesPath.Length + 1);
|
||||
|
||||
// TODO: Support symlinks, devices, hardlinks, whatever?
|
||||
if(fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
|
||||
{
|
||||
if(Failed != null)
|
||||
Failed(string.Format("{0} is an unsupported symbolic link, not continuing.", relpath));
|
||||
return;
|
||||
}
|
||||
|
||||
if(UpdateProgress != null)
|
||||
UpdateProgress(string.Format("Hashing file {0} of {1}", counter, Context.files.Count), null, counter, Context.files.Count);
|
||||
FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read);
|
||||
|
||||
Reference in New Issue
Block a user