You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -32,10 +32,11 @@ RESX_RESOURCE_STRING = \
|
||||
../../../external/corefx/src/System.ComponentModel.TypeConverter/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Security.Cryptography.Encoding/src/Resources/Strings.resx
|
||||
|
||||
TEST_RESOURCES = \
|
||||
TEST_RESOURCE_FILES = \
|
||||
Test/System/test-uri-props.txt \
|
||||
Test/System/test-uri-props-manual.txt \
|
||||
Test/System/test-uri-relative-props.txt
|
||||
Test/System/test-uri-relative-props.txt \
|
||||
Test/compressed.bin
|
||||
|
||||
USE_XTEST_REMOTE_EXECUTOR = YES
|
||||
XTEST_LIB_REFS = System System.Core System.Net Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Net.Http
|
||||
@@ -63,7 +64,7 @@ TEST_LIB_REFS = $(MONO_SECURITY) System.Data System.Xml System.Core
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = -nowarn:618,672,219,67,169,612 \
|
||||
$(foreach f, $(TEST_RESOURCES), -resource:$(f),$(notdir $(f)))
|
||||
$(foreach r, $(TEST_RESOURCE_FILES), -resource:$(r),$(r))
|
||||
|
||||
TEST_NUNITLITE_APP_CONFIG_GLOBAL=Test/test-config-file
|
||||
|
||||
@@ -128,11 +129,11 @@ EXTRA_DISTFILES = \
|
||||
Test/System.Security.Cryptography.X509Certificates/pkits/README \
|
||||
Test/System.Security.Cryptography.X509Certificates/pkits/x509build.cs \
|
||||
$(RESOURCE_FILES) \
|
||||
$(TEST_RESOURCES)
|
||||
$(TEST_RESOURCE_FILES)
|
||||
|
||||
include ../../build/library.make
|
||||
|
||||
$(test_lib_output): $(TEST_RESOURCES) | $(test_lib_dir)
|
||||
$(test_lib_output): $(TEST_RESOURCE_FILES) $(test_lib_dir)
|
||||
|
||||
# Helper target to run the perl regex test suite
|
||||
regex-check:
|
||||
|
||||
@@ -67,7 +67,8 @@ namespace Microsoft.CSharp
|
||||
|
||||
mcs.StartInfo.Arguments += BuildArgs (options, fileNames, _provOptions);
|
||||
|
||||
var mcsOutMutex = new Mutex ();
|
||||
var stderr_completed = new ManualResetEvent (false);
|
||||
var stdout_completed = new ManualResetEvent (false);
|
||||
/*
|
||||
string monoPath = Environment.GetEnvironmentVariable ("MONO_PATH");
|
||||
if (monoPath != null)
|
||||
@@ -93,15 +94,19 @@ namespace Microsoft.CSharp
|
||||
|
||||
mcs.StartInfo.CreateNoWindow=true;
|
||||
mcs.StartInfo.UseShellExecute=false;
|
||||
mcs.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
mcs.StartInfo.RedirectStandardOutput=true;
|
||||
mcs.StartInfo.RedirectStandardError=true;
|
||||
mcs.ErrorDataReceived += new DataReceivedEventHandler ((sender, args) => {
|
||||
if (args.Data != null) {
|
||||
mcsOutMutex.WaitOne ();
|
||||
if (args.Data != null)
|
||||
results.Output.Add (args.Data);
|
||||
mcsOutMutex.ReleaseMutex ();
|
||||
}
|
||||
else
|
||||
stderr_completed.Set ();
|
||||
});
|
||||
mcs.OutputDataReceived += new DataReceivedEventHandler ((sender, args) => {
|
||||
if (args.Data == null)
|
||||
stdout_completed.Set ();
|
||||
});
|
||||
|
||||
// Use same text decoder as mcs and not user set values in Console
|
||||
mcs.StartInfo.StandardOutputEncoding =
|
||||
@@ -125,8 +130,8 @@ namespace Microsoft.CSharp
|
||||
|
||||
results.NativeCompilerReturnValue = mcs.ExitCode;
|
||||
} finally {
|
||||
mcs.CancelErrorRead ();
|
||||
mcs.CancelOutputRead ();
|
||||
stderr_completed.WaitOne (TimeSpan.FromSeconds (30));
|
||||
stdout_completed.WaitOne (TimeSpan.FromSeconds (30));
|
||||
mcs.Close();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if !MONO_FEATURE_BTLS
|
||||
#if MONO_SECURITY_ALIAS
|
||||
extern alias MonoSecurity;
|
||||
using MonoSecurity::Mono.Security.Cryptography;
|
||||
#else
|
||||
using Mono.Security.Cryptography;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -38,8 +48,6 @@ using Mono.Net;
|
||||
|
||||
#if MONO_FEATURE_BTLS
|
||||
using Mono.Btls;
|
||||
#else
|
||||
using Mono.Security.Cryptography;
|
||||
#endif
|
||||
|
||||
namespace Mono.AppleTls
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
#if SECURITY_DEP && MONO_FEATURE_BTLS
|
||||
#if MONO_SECURITY_ALIAS
|
||||
extern alias MonoSecurity;
|
||||
using MX = MonoSecurity::Mono.Security.Cryptography;
|
||||
#else
|
||||
using MX = Mono.Security.Cryptography;
|
||||
#endif
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@@ -109,7 +115,7 @@ namespace Mono.Btls
|
||||
|
||||
public static MonoBtlsKey CreateFromRSAPrivateKey (System.Security.Cryptography.RSA privateKey)
|
||||
{
|
||||
var keyData = Mono.Security.Cryptography.PKCS8.PrivateKeyInfo.Encode (privateKey);
|
||||
var keyData = MX.PKCS8.PrivateKeyInfo.Encode (privateKey);
|
||||
var key = new MonoBtlsKey (new BoringKeyHandle (mono_btls_key_new ()));
|
||||
|
||||
var ret = mono_btls_key_assign_rsa_private_key (key.Handle.DangerousGetHandle (), keyData, keyData.Length);
|
||||
|
||||
@@ -30,8 +30,10 @@ extern alias MonoSecurity;
|
||||
|
||||
#if MONO_SECURITY_ALIAS
|
||||
using MX = MonoSecurity::Mono.Security.X509;
|
||||
using MonoSecurity::Mono.Security.Cryptography;
|
||||
#else
|
||||
using MX = Mono.Security.X509;
|
||||
using Mono.Security.Cryptography;
|
||||
#endif
|
||||
|
||||
using System;
|
||||
@@ -41,7 +43,6 @@ using System.Security;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Runtime.InteropServices;
|
||||
using Mono.Security.Cryptography;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace Mono.Btls
|
||||
|
||||
@@ -24,13 +24,18 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
#if SECURITY_DEP && MONO_FEATURE_BTLS
|
||||
#if MONO_SECURITY_ALIAS
|
||||
extern alias MonoSecurity;
|
||||
using MX = MonoSecurity::Mono.Security.X509;
|
||||
#else
|
||||
using MX = Mono.Security.X509;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Security;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using MX = Mono.Security.X509;
|
||||
|
||||
namespace Mono.Btls
|
||||
{
|
||||
|
||||
@@ -178,7 +178,11 @@ namespace Mono.Net.Security
|
||||
};
|
||||
|
||||
var task = ProcessAuthentication (true, options, CancellationToken.None);
|
||||
task.Wait ();
|
||||
try {
|
||||
task.Wait ();
|
||||
} catch (Exception ex) {
|
||||
throw HttpWebRequest.FlattenException (ex);
|
||||
}
|
||||
}
|
||||
|
||||
public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
|
||||
@@ -231,7 +235,11 @@ namespace Mono.Net.Security
|
||||
};
|
||||
|
||||
var task = ProcessAuthentication (true, options, CancellationToken.None);
|
||||
task.Wait ();
|
||||
try {
|
||||
task.Wait ();
|
||||
} catch (Exception ex) {
|
||||
throw HttpWebRequest.FlattenException (ex);
|
||||
}
|
||||
}
|
||||
|
||||
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Threading;
|
||||
@@ -504,28 +505,7 @@ namespace System.IO.Compression
|
||||
throw new IOException (error + " " + where);
|
||||
}
|
||||
|
||||
#if MONOTOUCH || MONODROID
|
||||
const string LIBNAME = "__Internal";
|
||||
#else
|
||||
const string LIBNAME = "MonoPosixHelper";
|
||||
#endif
|
||||
|
||||
#if !ORBIS
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern SafeDeflateStreamHandle CreateZStream (CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data);
|
||||
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int CloseZStream (IntPtr stream);
|
||||
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int Flush (SafeDeflateStreamHandle stream);
|
||||
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int ReadZStream (SafeDeflateStreamHandle stream, IntPtr buffer, int length);
|
||||
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int WriteZStream (SafeDeflateStreamHandle stream, IntPtr buffer, int length);
|
||||
#else
|
||||
#if ORBIS
|
||||
static SafeDeflateStreamHandle CreateZStream (CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
@@ -550,6 +530,82 @@ namespace System.IO.Compression
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
#elif MONOTOUCH || MONODROID
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern IntPtr CreateZStream (int compress, bool gzip, IntPtr feeder, IntPtr data);
|
||||
|
||||
static SafeDeflateStreamHandle CreateZStream (CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data)
|
||||
{
|
||||
SafeDeflateStreamHandle res;
|
||||
try {} finally {
|
||||
res = new SafeDeflateStreamHandle (CreateZStream ((int) compress, gzip, Marshal.GetFunctionPointerForDelegate<UnmanagedReadOrWrite> (feeder), data));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern int CloseZStream (IntPtr stream);
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern int Flush (IntPtr stream);
|
||||
|
||||
static int Flush (SafeDeflateStreamHandle stream)
|
||||
{
|
||||
bool release = false;
|
||||
try {
|
||||
stream.DangerousAddRef (ref release);
|
||||
return Flush (stream.DangerousGetHandle ());
|
||||
} finally {
|
||||
if (release)
|
||||
stream.DangerousRelease ();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern int ReadZStream (IntPtr stream, IntPtr buffer, int length);
|
||||
|
||||
static int ReadZStream (SafeDeflateStreamHandle stream, IntPtr buffer, int length)
|
||||
{
|
||||
bool release = false;
|
||||
try {
|
||||
stream.DangerousAddRef (ref release);
|
||||
return ReadZStream (stream.DangerousGetHandle (), buffer, length);
|
||||
} finally {
|
||||
if (release)
|
||||
stream.DangerousRelease ();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern int WriteZStream (IntPtr stream, IntPtr buffer, int length);
|
||||
|
||||
static int WriteZStream (SafeDeflateStreamHandle stream, IntPtr buffer, int length)
|
||||
{
|
||||
bool release = false;
|
||||
try {
|
||||
stream.DangerousAddRef (ref release);
|
||||
return WriteZStream (stream.DangerousGetHandle (), buffer, length);
|
||||
} finally {
|
||||
if (release)
|
||||
stream.DangerousRelease ();
|
||||
}
|
||||
}
|
||||
#else
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern SafeDeflateStreamHandle CreateZStream (CompressionMode compress, bool gzip, UnmanagedReadOrWrite feeder, IntPtr data);
|
||||
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int CloseZStream (IntPtr stream);
|
||||
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int Flush (SafeDeflateStreamHandle stream);
|
||||
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int ReadZStream (SafeDeflateStreamHandle stream, IntPtr buffer, int length);
|
||||
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern int WriteZStream (SafeDeflateStreamHandle stream, IntPtr buffer, int length);
|
||||
#endif
|
||||
|
||||
sealed class SafeDeflateStreamHandle : SafeHandle
|
||||
@@ -563,6 +619,10 @@ namespace System.IO.Compression
|
||||
{
|
||||
}
|
||||
|
||||
internal SafeDeflateStreamHandle(IntPtr handle) : base (handle, true)
|
||||
{
|
||||
}
|
||||
|
||||
override protected bool ReleaseHandle()
|
||||
{
|
||||
DeflateStreamNative.CloseZStream(handle);
|
||||
|
||||
@@ -144,10 +144,6 @@ namespace System.IO {
|
||||
ok = FAMWatcher.GetInstance (out watcher, true);
|
||||
watcher_handle = this;
|
||||
break;
|
||||
case 5: // inotify
|
||||
ok = InotifyWatcher.GetInstance (out watcher, true);
|
||||
watcher_handle = this;
|
||||
break;
|
||||
case 6: // CoreFX
|
||||
ok = CoreFXFileSystemWatcherProxy.GetInstance (out watcher);
|
||||
watcher_handle = (watcher as CoreFXFileSystemWatcherProxy).NewWatcher (this);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@
|
||||
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
@@ -326,7 +327,7 @@ namespace System.Net.NetworkInformation {
|
||||
|
||||
internal sealed class LinuxNetworkChange : INetworkChange {
|
||||
[Flags]
|
||||
enum EventType {
|
||||
enum EventType : int {
|
||||
Availability = 1 << 0,
|
||||
Address = 1 << 1,
|
||||
}
|
||||
@@ -485,20 +486,25 @@ namespace System.Net.NetworkInformation {
|
||||
}
|
||||
}
|
||||
|
||||
#if MONOTOUCH || MONODROID
|
||||
const string LIBNAME = "__Internal";
|
||||
#else
|
||||
const string LIBNAME = "MonoPosixHelper";
|
||||
#endif
|
||||
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
#if MONODROID
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern IntPtr CreateNLSocket ();
|
||||
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern EventType ReadEvents (IntPtr sock, IntPtr buffer, int count, int size);
|
||||
|
||||
[DllImport (LIBNAME, CallingConvention=CallingConvention.Cdecl)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
static extern IntPtr CloseNLSocket (IntPtr sock);
|
||||
#else
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern IntPtr CreateNLSocket ();
|
||||
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern EventType ReadEvents (IntPtr sock, IntPtr buffer, int count, int size);
|
||||
|
||||
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern IntPtr CloseNLSocket (IntPtr sock);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -79,6 +79,25 @@ namespace System.Net.NetworkInformation {
|
||||
return c;
|
||||
}
|
||||
|
||||
public static Win32IPAddressCollection FromSocketAddress (Win32_SOCKET_ADDRESS addr)
|
||||
{
|
||||
Win32IPAddressCollection c = new Win32IPAddressCollection ();
|
||||
if (addr.Sockaddr != IntPtr.Zero)
|
||||
c.InternalAdd (addr.GetIPAddress ());
|
||||
return c;
|
||||
}
|
||||
|
||||
public static Win32IPAddressCollection FromWinsServer (IntPtr ptr)
|
||||
{
|
||||
Win32IPAddressCollection c = new Win32IPAddressCollection ();
|
||||
Win32_IP_ADAPTER_WINS_SERVER_ADDRESS a;
|
||||
for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
|
||||
a = (Win32_IP_ADAPTER_WINS_SERVER_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_WINS_SERVER_ADDRESS));
|
||||
c.InternalAdd (a.Address.GetIPAddress ());
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void AddSubsequentlyString (IntPtr head)
|
||||
{
|
||||
Win32_IP_ADDR_STRING a;
|
||||
|
||||
@@ -44,13 +44,11 @@ namespace System.Net.NetworkInformation {
|
||||
|
||||
public override IPv4InterfaceProperties GetIPv4Properties ()
|
||||
{
|
||||
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
|
||||
return new Win32IPv4InterfaceProperties (v4info, mib4);
|
||||
return new Win32IPv4InterfaceProperties (addr, mib4);
|
||||
}
|
||||
|
||||
public override IPv6InterfaceProperties GetIPv6Properties ()
|
||||
{
|
||||
Win32_IP_ADAPTER_INFO v6info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib6.Index);
|
||||
return new Win32IPv6InterfaceProperties (mib6);
|
||||
}
|
||||
|
||||
@@ -74,10 +72,9 @@ namespace System.Net.NetworkInformation {
|
||||
|
||||
public override IPAddressCollection DhcpServerAddresses {
|
||||
get {
|
||||
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
|
||||
// FIXME: should ipv6 DhcpServer be considered?
|
||||
try {
|
||||
return new Win32IPAddressCollection (v4info.DhcpServer);
|
||||
return Win32IPAddressCollection.FromSocketAddress (addr.Dhcpv4Server);
|
||||
} catch (IndexOutOfRangeException) {
|
||||
return Win32IPAddressCollection.Empty;
|
||||
}
|
||||
@@ -96,28 +93,17 @@ namespace System.Net.NetworkInformation {
|
||||
get {
|
||||
var col = new GatewayIPAddressInformationCollection ();
|
||||
try {
|
||||
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
|
||||
// FIXME: should ipv6 DhcpServer be considered?
|
||||
|
||||
var a = v4info.GatewayList;
|
||||
if (!String.IsNullOrEmpty (a.IpAddress)) {
|
||||
col.InternalAdd(new SystemGatewayIPAddressInformation(IPAddress.Parse (a.IpAddress)));
|
||||
AddSubsequently (a.Next, col);
|
||||
Win32_IP_ADAPTER_GATEWAY_ADDRESS a;
|
||||
for (IntPtr p = addr.FirstGatewayAddress; p != IntPtr.Zero; p = a.Next) {
|
||||
a = (Win32_IP_ADAPTER_GATEWAY_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_GATEWAY_ADDRESS));
|
||||
col.InternalAdd (new SystemGatewayIPAddressInformation (a.Address.GetIPAddress ()));
|
||||
}
|
||||
} catch (IndexOutOfRangeException) {}
|
||||
return col;
|
||||
}
|
||||
}
|
||||
|
||||
static void AddSubsequently (IntPtr head, GatewayIPAddressInformationCollection col)
|
||||
{
|
||||
Win32_IP_ADDR_STRING a;
|
||||
for (IntPtr p = head; p != IntPtr.Zero; p = a.Next) {
|
||||
a = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p, typeof (Win32_IP_ADDR_STRING));
|
||||
col.InternalAdd (new SystemGatewayIPAddressInformation (IPAddress.Parse (a.IpAddress)));
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsDnsEnabled {
|
||||
get { return Win32NetworkInterface.FixedInfo.EnableDns != 0; }
|
||||
}
|
||||
@@ -147,7 +133,6 @@ namespace System.Net.NetworkInformation {
|
||||
public override UnicastIPAddressInformationCollection UnicastAddresses {
|
||||
get {
|
||||
try {
|
||||
Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
|
||||
// FIXME: should ipv6 DhcpServer be considered?
|
||||
return Win32FromUnicast (addr.FirstUnicastAddress);
|
||||
} catch (IndexOutOfRangeException) {
|
||||
@@ -170,9 +155,7 @@ namespace System.Net.NetworkInformation {
|
||||
public override IPAddressCollection WinsServersAddresses {
|
||||
get {
|
||||
try {
|
||||
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
|
||||
// FIXME: should ipv6 DhcpServer be considered?
|
||||
return new Win32IPAddressCollection (v4info.PrimaryWinsServer, v4info.SecondaryWinsServer);
|
||||
return Win32IPAddressCollection.FromWinsServer (addr.FirstWinsServerAddress);
|
||||
} catch (IndexOutOfRangeException) {
|
||||
return Win32IPAddressCollection.Empty;
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ namespace System.Net.NetworkInformation {
|
||||
[DllImport ("iphlpapi.dll")]
|
||||
static extern int GetPerAdapterInfo (int IfIndex, Win32_IP_PER_ADAPTER_INFO pPerAdapterInfo, ref int pOutBufLen);
|
||||
|
||||
Win32_IP_ADAPTER_INFO ainfo;
|
||||
Win32_IP_ADAPTER_ADDRESSES addr;
|
||||
Win32_IP_PER_ADAPTER_INFO painfo;
|
||||
Win32_MIB_IFROW mib;
|
||||
|
||||
public Win32IPv4InterfaceProperties (Win32_IP_ADAPTER_INFO ainfo, Win32_MIB_IFROW mib)
|
||||
public Win32IPv4InterfaceProperties (Win32_IP_ADAPTER_ADDRESSES addr, Win32_MIB_IFROW mib)
|
||||
{
|
||||
this.ainfo = ainfo;
|
||||
this.addr = addr;
|
||||
this.mib = mib;
|
||||
|
||||
// get per-adapter info.
|
||||
@@ -67,7 +67,7 @@ namespace System.Net.NetworkInformation {
|
||||
}
|
||||
|
||||
public override bool IsDhcpEnabled {
|
||||
get { return ainfo.DhcpEnabled != 0; }
|
||||
get { return addr.DhcpEnabled; }
|
||||
}
|
||||
|
||||
public override bool IsForwardingEnabled {
|
||||
@@ -80,7 +80,7 @@ namespace System.Net.NetworkInformation {
|
||||
}
|
||||
|
||||
public override bool UsesWins {
|
||||
get { return ainfo.HaveWins; }
|
||||
get { return addr.FirstWinsServerAddress != IntPtr.Zero; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,12 @@ namespace System.Net.NetworkInformation {
|
||||
{
|
||||
IntPtr ptr = IntPtr.Zero;
|
||||
int len = 0;
|
||||
GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len);
|
||||
uint flags = Win32_IP_ADAPTER_ADDRESSES.GAA_FLAG_INCLUDE_WINS_INFO | Win32_IP_ADAPTER_ADDRESSES.GAA_FLAG_INCLUDE_GATEWAYS;
|
||||
GetAdaptersAddresses (0, flags, IntPtr.Zero, ptr, ref len);
|
||||
if (Marshal.SizeOf (typeof (Win32_IP_ADAPTER_ADDRESSES)) > len)
|
||||
throw new NetworkInformationException ();
|
||||
ptr = Marshal.AllocHGlobal(len);
|
||||
int ret = GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len);
|
||||
int ret = GetAdaptersAddresses (0, flags, IntPtr.Zero, ptr, ref len);
|
||||
if (ret != 0)
|
||||
throw new NetworkInformationException (ret);
|
||||
|
||||
@@ -105,14 +108,6 @@ namespace System.Net.NetworkInformation {
|
||||
[DllImport ("iphlpapi.dll", SetLastError = true)]
|
||||
static extern int GetIfEntry (ref Win32_MIB_IFROW row);
|
||||
|
||||
public static Win32_IP_ADAPTER_INFO GetAdapterInfoByIndex (int index)
|
||||
{
|
||||
foreach (Win32_IP_ADAPTER_INFO info in GetAdaptersInfo ())
|
||||
if (info.Index == index)
|
||||
return info;
|
||||
throw new IndexOutOfRangeException ("No adapter found for index " + index);
|
||||
}
|
||||
|
||||
static Win32_IP_ADAPTER_INFO [] GetAdaptersInfo ()
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@@ -109,15 +109,37 @@ namespace System.Net.NetworkInformation
|
||||
public NetworkInterfaceType IfType;
|
||||
public OperationalStatus OperStatus;
|
||||
public int Ipv6IfIndex;
|
||||
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 16 * 4)]
|
||||
[MarshalAs (UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public uint [] ZoneIndices;
|
||||
public IntPtr FirstPrefix; // to PIP_ADAPTER_PREFIX
|
||||
public UInt64 TransmitLinkSpeed;
|
||||
public UInt64 ReceiveLinkSpeed;
|
||||
public IntPtr FirstWinsServerAddress; // to PIP_ADAPTER_WINS_SERVER_ADDRESS_LH
|
||||
public IntPtr FirstGatewayAddress; // to PIP_ADAPTER_GATEWAY_ADDRESS_LH
|
||||
public uint Ipv4Metric;
|
||||
public uint Ipv6Metric;
|
||||
public UInt64 Luid;
|
||||
public Win32_SOCKET_ADDRESS Dhcpv4Server;
|
||||
public uint CompartmentId;
|
||||
public UInt64 NetworkGuid;
|
||||
public int ConnectionType;
|
||||
public int TunnelType;
|
||||
public Win32_SOCKET_ADDRESS Dhcpv6Server;
|
||||
[MarshalAs (UnmanagedType.ByValArray, SizeConst = MAX_DHCPV6_DUID_LENGTH)]
|
||||
public byte [] Dhcpv6ClientDuid;
|
||||
public ulong Dhcpv6ClientDuidLength;
|
||||
public ulong Dhcpv6Iaid;
|
||||
public IntPtr FirstDnsSuffix; // to PIP_ADAPTER_DNS_SUFFIX
|
||||
|
||||
// Note that Vista-only members and XP-SP1-only member are
|
||||
// omitted.
|
||||
//Flags For GetAdapterAddresses
|
||||
public const int GAA_FLAG_INCLUDE_WINS_INFO = 0x0040;
|
||||
public const int GAA_FLAG_INCLUDE_GATEWAYS = 0x0080;
|
||||
|
||||
const int MAX_ADAPTER_ADDRESS_LENGTH = 8;
|
||||
const int MAX_DHCPV6_DUID_LENGTH = 130;
|
||||
|
||||
const int IP_ADAPTER_DDNS_ENABLED = 1;
|
||||
const int IP_ADAPTER_DHCP_ENABLED = 4;
|
||||
const int IP_ADAPTER_RECEIVE_ONLY = 8;
|
||||
const int IP_ADAPTER_NO_MULTICAST = 0x10;
|
||||
|
||||
@@ -125,6 +147,10 @@ namespace System.Net.NetworkInformation
|
||||
get { return (Flags & IP_ADAPTER_DDNS_ENABLED) != 0; }
|
||||
}
|
||||
|
||||
public bool DhcpEnabled {
|
||||
get { return (Flags & IP_ADAPTER_DHCP_ENABLED) != 0; }
|
||||
}
|
||||
|
||||
public bool IsReceiveOnly {
|
||||
get { return (Flags & IP_ADAPTER_RECEIVE_ONLY) != 0; }
|
||||
}
|
||||
@@ -255,6 +281,22 @@ namespace System.Net.NetworkInformation
|
||||
public Win32_SOCKET_ADDRESS Address;
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
struct Win32_IP_ADAPTER_GATEWAY_ADDRESS
|
||||
{
|
||||
public Win32LengthFlagsUnion LengthFlags;
|
||||
public IntPtr Next; // to Win32_IP_ADAPTER_GATEWAY_ADDRESS
|
||||
public Win32_SOCKET_ADDRESS Address;
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
struct Win32_IP_ADAPTER_WINS_SERVER_ADDRESS
|
||||
{
|
||||
public Win32LengthFlagsUnion LengthFlags;
|
||||
public IntPtr Next; // to Win32_IP_ADAPTER_WINS_SERVER_ADDRESS
|
||||
public Win32_SOCKET_ADDRESS Address;
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
struct Win32_IP_ADAPTER_UNICAST_ADDRESS
|
||||
{
|
||||
|
||||
@@ -400,6 +400,8 @@ namespace System.Net
|
||||
WebConnection.Debug ($"{ME} CLOSE #1: read_eof={read_eof} bufferedEntireContent={bufferedEntireContent}");
|
||||
if (read_eof || bufferedEntireContent) {
|
||||
disposed = true;
|
||||
innerStream?.Dispose ();
|
||||
innerStream = null;
|
||||
Operation.Finish (true);
|
||||
} else {
|
||||
// If we have not read all the contents
|
||||
|
||||
@@ -68,61 +68,68 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public X509Certificate2 (byte[] rawData)
|
||||
{
|
||||
Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
|
||||
// MONO: temporary hack until `X509CertificateImplApple` derives from
|
||||
// `X509Certificate2Impl`.
|
||||
if (rawData != null && rawData.Length != 0) {
|
||||
using (var safePasswordHandle = new SafePasswordHandle ((string)null)) {
|
||||
var impl = X509Helper.Import (rawData, safePasswordHandle, X509KeyStorageFlags.DefaultKeySet);
|
||||
ImportHandle (impl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, string password)
|
||||
: base (rawData, password)
|
||||
{
|
||||
Import (rawData, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, SecureString password)
|
||||
: base (rawData, password)
|
||||
{
|
||||
Import (rawData, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (rawData, password, keyStorageFlags)
|
||||
{
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (rawData, password, keyStorageFlags)
|
||||
{
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName)
|
||||
: base (fileName)
|
||||
{
|
||||
Import (fileName, String.Empty, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, string password)
|
||||
: base (fileName, password)
|
||||
{
|
||||
Import (fileName, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, SecureString password)
|
||||
: base (fileName, password)
|
||||
{
|
||||
Import (fileName, password, X509KeyStorageFlags.DefaultKeySet);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (fileName, password, keyStorageFlags)
|
||||
{
|
||||
Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
: base (fileName, password, keyStorageFlags)
|
||||
{
|
||||
Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public X509Certificate2 (IntPtr handle) : base (handle)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public X509Certificate2 (X509Certificate certificate)
|
||||
: base (SystemDependencyProvider.Instance.CertificateProvider.Import (certificate))
|
||||
: base (certificate)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -175,8 +182,10 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public AsymmetricAlgorithm PrivateKey {
|
||||
get { return Impl.PrivateKey; }
|
||||
set { Impl.PrivateKey = value; }
|
||||
}
|
||||
set {
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public PublicKey PublicKey {
|
||||
get { return Impl.PublicKey; }
|
||||
@@ -216,46 +225,32 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public override void Import (byte[] rawData)
|
||||
{
|
||||
Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
|
||||
base.Import (rawData);
|
||||
}
|
||||
|
||||
[MonoTODO ("missing KeyStorageFlags support")]
|
||||
public override void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
Reset ();
|
||||
using (var handle = new SafePasswordHandle (password)) {
|
||||
var impl = SystemDependencyProvider.Instance.CertificateProvider.Import (rawData, handle, keyStorageFlags);
|
||||
ImportHandle (impl);
|
||||
}
|
||||
base.Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public override void Import (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
Reset ();
|
||||
using (var handle = new SafePasswordHandle (password)) {
|
||||
var impl = SystemDependencyProvider.Instance.CertificateProvider.Import (rawData, handle, keyStorageFlags);
|
||||
ImportHandle (impl);
|
||||
}
|
||||
base.Import (rawData, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
public override void Import (string fileName)
|
||||
{
|
||||
byte[] rawData = File.ReadAllBytes (fileName);
|
||||
Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
|
||||
base.Import (fileName);
|
||||
}
|
||||
|
||||
[MonoTODO ("missing KeyStorageFlags support")]
|
||||
public override void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
byte[] rawData = File.ReadAllBytes (fileName);
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
base.Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
[MonoTODO ("SecureString is incomplete")]
|
||||
public override void Import (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
byte[] rawData = File.ReadAllBytes (fileName);
|
||||
Import (rawData, password, keyStorageFlags);
|
||||
base.Import (fileName, password, keyStorageFlags);
|
||||
}
|
||||
|
||||
[MonoTODO ("X509ContentType.SerializedCert is not supported")]
|
||||
|
||||
@@ -333,8 +333,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (byte[] rawData)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (rawData);
|
||||
X509Certificate2 cert = new X509Certificate2 (rawData);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
@@ -342,8 +341,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (rawData, password, keyStorageFlags);
|
||||
X509Certificate2 cert = new X509Certificate2 (rawData, password, keyStorageFlags);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
@@ -351,8 +349,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (string fileName)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (fileName);
|
||||
X509Certificate2 cert = new X509Certificate2 (fileName);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
@@ -360,8 +357,7 @@ namespace System.Security.Cryptography.X509Certificates {
|
||||
public void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
|
||||
{
|
||||
// FIXME: can it import multiple certificates, e.g. a pkcs7 file ?
|
||||
X509Certificate2 cert = new X509Certificate2 ();
|
||||
cert.Import (fileName, password, keyStorageFlags);
|
||||
X509Certificate2 cert = new X509Certificate2 (fileName, password, keyStorageFlags);
|
||||
Add (cert);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
|
||||
#if SECURITY_DEP
|
||||
|
||||
using Mono.Security.X509;
|
||||
|
||||
namespace System.Security.Cryptography.X509Certificates {
|
||||
|
||||
public class X509ChainElement {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user