Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2011-10-22 10:33:39 +0400
committerjfrijters <jfrijters>2011-10-22 10:33:39 +0400
commit90f06f8f714362c10310753e2c4ccb9034a6bf44 (patch)
treec7482ef4456a7ac8c3a107562923fb987cba7baf /openjdk/sun
parent2e222f1600b7c243ddb0ecf1a7ac246be25e2244 (diff)
Added security manager checks.
Diffstat (limited to 'openjdk/sun')
-rw-r--r--openjdk/sun/nio/fs/NetPath.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/openjdk/sun/nio/fs/NetPath.java b/openjdk/sun/nio/fs/NetPath.java
index 991cec4d..6861a1e2 100644
--- a/openjdk/sun/nio/fs/NetPath.java
+++ b/openjdk/sun/nio/fs/NetPath.java
@@ -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);
}