зеркало из https://github.com/mono/ikvm-fork.git
Partrial trust improvements:
- File.listRoots() now uses Environment.GetLogicalDrives() instead of Directory.GetLogicalDrives(). Both methods are semantically identical, but the former requires EnvironmentPermission(Unrestricted = true) and the latter SecurityPermission(UnmanagedCode = true). We also now swallow a SecurityException, should it occur. - Getting the host name now falls back to "localhost" if we don't have permission to query the name (or if anything else causes GetHostName to fail).
This commit is contained in:
Родитель
ceff3d0656
Коммит
ac3b45aae2
|
@ -1495,7 +1495,7 @@ namespace IKVM.NativeCode.java
|
|||
try
|
||||
{
|
||||
int drives = 0;
|
||||
foreach (string drive in System.IO.Directory.GetLogicalDrives())
|
||||
foreach (string drive in Environment.GetLogicalDrives())
|
||||
{
|
||||
char c = Char.ToUpper(drive[0]);
|
||||
drives |= 1 << (c - 'A');
|
||||
|
@ -1508,6 +1508,9 @@ namespace IKVM.NativeCode.java
|
|||
catch (System.UnauthorizedAccessException)
|
||||
{
|
||||
}
|
||||
catch (System.Security.SecurityException)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3532,10 +3535,13 @@ namespace IKVM.NativeCode.java
|
|||
{
|
||||
return System.Net.Dns.GetHostName();
|
||||
}
|
||||
catch (System.Net.Sockets.SocketException x)
|
||||
catch (System.Net.Sockets.SocketException)
|
||||
{
|
||||
throw new jnUnknownHostException(x.Message);
|
||||
}
|
||||
catch (System.Security.SecurityException)
|
||||
{
|
||||
}
|
||||
return "localhost";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче