зеркало из https://github.com/mono/ikvm-fork.git
Added security manager checks.
This commit is contained in:
Родитель
2e222f1600
Коммит
90f06f8f71
|
@ -418,11 +418,21 @@ final class NetPath extends AbstractPath
|
|||
{
|
||||
return this;
|
||||
}
|
||||
// System.getProperty("user.dir") will trigger the specified security check
|
||||
return new NetPath(fs, cli.System.IO.Path.GetFullPath(cli.System.IO.Path.Combine(System.getProperty("user.dir"), path)));
|
||||
}
|
||||
|
||||
public Path toRealPath(LinkOption... options) throws IOException
|
||||
{
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
{
|
||||
sm.checkRead(path);
|
||||
if (!isAbsolute())
|
||||
{
|
||||
sm.checkPropertyAccess("user.dir");
|
||||
}
|
||||
}
|
||||
return new NetPath(fs, toRealPathImpl(path));
|
||||
}
|
||||
|
||||
|
@ -487,6 +497,15 @@ final class NetPath extends AbstractPath
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
{
|
||||
sm.checkRead(path);
|
||||
if (subtree)
|
||||
{
|
||||
sm.checkRead(path + cli.System.IO.Path.DirectorySeparatorChar + '-');
|
||||
}
|
||||
}
|
||||
return ((NetFileSystem.NetWatchService)watcher).register(this, create, delete, modify, overflow, subtree);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче