Imported Upstream version 5.4.0.199

Former-commit-id: f4d318e4b2f128fa9f4d31b37bb3839a3fc0dfb2
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-09-25 16:57:44 +00:00
parent 536cd135cc
commit 5924117973
223 changed files with 3826 additions and 487 deletions

View File

@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "5.4.0.167";
public const string MonoVersion = "5.4.0.199";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";

View File

@ -133,28 +133,28 @@ namespace Mono.AppleTls
targetHost = targetHost.Substring (0, pos);
}
var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost);
var trust = new SecTrust (certificates, policy);
using (var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost))
using (var trust = new SecTrust (certificates, policy)) {
if (validator.Settings.TrustAnchors != null) {
var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
trust.SetAnchorCertificatesOnly (false);
}
if (validator.Settings.TrustAnchors != null) {
var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
trust.SetAnchorCertificatesOnly (false);
if (validator.Settings.CertificateValidationTime != null) {
var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
}
var result = trust.Evaluate ();
if (result == SecTrustResult.Unspecified)
return true;
errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
return false;
}
if (validator.Settings.CertificateValidationTime != null) {
var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
}
var result = trust.Evaluate ();
if (result == SecTrustResult.Unspecified)
return true;
errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
return false;
}
}
}

View File

@ -235,32 +235,41 @@ namespace Mono.AppleTls
*
*/
var trust = GetPeerTrust (!IsServer);
X509CertificateCollection certificates;
if (trust == null || trust.Count == 0) {
remoteCertificate = null;
if (!IsServer)
throw new TlsException (AlertDescription.CertificateUnknown);
certificates = null;
} else {
if (trust.Count > 1)
Debug ("WARNING: Got multiple certificates in SecTrust!");
certificates = new X509CertificateCollection ();
for (int i = 0; i < trust.Count; i++)
certificates.Add (trust [(IntPtr)i].ToX509Certificate ());
remoteCertificate = certificates [0];
Debug ("Got peer trust: {0}", remoteCertificate);
}
bool ok;
SecTrust trust = null;
X509CertificateCollection certificates = null;
try {
trust = GetPeerTrust (!IsServer);
if (trust == null || trust.Count == 0) {
remoteCertificate = null;
if (!IsServer)
throw new TlsException (AlertDescription.CertificateUnknown);
certificates = null;
} else {
if (trust.Count > 1)
Debug ("WARNING: Got multiple certificates in SecTrust!");
certificates = new X509CertificateCollection ();
for (int i = 0; i < trust.Count; i++)
certificates.Add (trust.GetCertificate (i));
remoteCertificate = new X509Certificate (certificates [0]);
Debug ("Got peer trust: {0}", remoteCertificate);
}
ok = ValidateCertificate (certificates);
} catch (Exception ex) {
Debug ("Certificate validation failed: {0}", ex);
throw new TlsException (AlertDescription.CertificateUnknown, "Certificate validation threw exception.");
} finally {
if (trust != null)
trust.Dispose ();
if (certificates != null) {
for (int i = 0; i < certificates.Count; i++)
certificates [i].Dispose ();
}
}
if (!ok)
@ -665,7 +674,7 @@ namespace Mono.AppleTls
if (value == IntPtr.Zero)
throw new TlsException (AlertDescription.CertificateUnknown);
}
return (value == IntPtr.Zero) ? null : new SecTrust (value);
return (value == IntPtr.Zero) ? null : new SecTrust (value, true);
}
#endregion

View File

@ -66,6 +66,8 @@ namespace Mono.AppleTls {
foreach (var certificate in certificates)
array [i++] = new SecCertificate (certificate);
Initialize (array, policy);
for (i = 0; i < array.Length; i++)
array [i].Dispose ();
}
void Initialize (SecCertificate[] array, SecPolicy policy)
@ -122,6 +124,17 @@ namespace Mono.AppleTls {
}
}
internal X509Certificate GetCertificate (int index)
{
if (handle == IntPtr.Zero)
throw new ObjectDisposedException ("SecTrust");
if (index < 0 || index >= Count)
throw new ArgumentOutOfRangeException ("index");
var ptr = SecTrustGetCertificateAtIndex (handle, (IntPtr)index);
return new X509Certificate (ptr);
}
[DllImport (AppleTlsContext.SecurityLibrary)]
extern static SecStatusCode /* OSStatus */ SecTrustSetAnchorCertificates (IntPtr /* SecTrustRef */ trust, IntPtr /* CFArrayRef */ anchorCertificates);

View File

@ -1 +1 @@
fe514b868d2ddd7479dee6238a5848350be33611
83404914b3bd686a8fb10da985249e69631c4de7

View File

@ -56,7 +56,6 @@ namespace System.Net
object socketLock = new object ();
IWebConnectionState state;
WebExceptionStatus status;
WaitCallback initConn;
bool keepAlive;
byte [] buffer;
EventHandler abortHandler;

View File

@ -499,7 +499,7 @@ namespace System
m = Method;
return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ (m_target != null ? m_target.GetHashCode () : 0);
return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ RuntimeHelpers.GetHashCode (m_target);
}
protected virtual MethodInfo GetMethodImpl ()

View File

@ -49,9 +49,15 @@ namespace MonoTests.System.Globalization
c = CultureInfo.InvariantCulture;
Assert.AreEqual (2, c.NumberFormat.CurrencyDecimalDigits, "#3");
}
[Test]
public void AllCulturesCanParseNegativeNumber ()
{
foreach (var c in CultureInfo.GetCultures (CultureTypes.AllCultures))
{
int.Parse ("-1", c);
}
}
}
}

View File

@ -1258,7 +1258,7 @@ namespace MonoTests.System.Threading.Tasks
{
var t = Task.Delay (300);
Assert.IsTrue (TaskStatus.WaitingForActivation == t.Status || TaskStatus.Running == t.Status, "#1");
Assert.IsTrue (t.Wait (400), "#2");
Assert.IsTrue (t.Wait (1200), "#2");
}
[Test]

View File

@ -1 +1 @@
10372fbbaaa3df30ee1692ed4ba9d556aa985307
be9aa05dcf77e3a678e866b6356372647c1cc13c

View File

@ -1 +1 @@
2572908bbda7335a1fe58da5ee20de4af2f4a08d
3af123b023a664cae8e867980a3fac5e1f10be4d

View File

@ -1 +1 @@
80b380eeedebaad80b103098ccab73e8b25db610
91b45d039180bf17f0320233e15df3127ca1fcd6

View File

@ -1 +1 @@
60e047ccaeb1b41abb41b09e6379da97e0f1cfbc
1c2d90a445f904d7931338651b4eb30c2f90556c

View File

@ -1 +1 @@
8fbf87281f9d4c4e6c8ae070ad256bc3900957af
4561c1a91655dbff891faed14271cf5326d69171

View File

@ -1 +1 @@
5191dd468774f918ff5181ff7f4565f7c29a7ab5
909321fcb81b10103586630bae2a388b74894f4e

View File

@ -1 +1 @@
c44e32c353bd140e9905c9cd07830909994a8023
8ef5fe00834d2790dd279a4e3152ed7d3b2cf042

View File

@ -1 +1 @@
001965b608d44cc7b030fa2a7b4b87e867b310d7
1c9b11fa10eb41cba446db688ad5f32157c7c936

View File

@ -1 +1 @@
ac6b645d3c086ee485afb35b3b38824a74af56a4
949647d93cf97e4425af624028fe259adf0cadc7

View File

@ -1 +1 @@
eeb0917fef6a5f871e589bd7ae4562e91ff2da4a
c68056663022971dfea97db6fbb1305193515e0f

View File

@ -1 +1 @@
ac0bb14072cc31e58b92cf367da7804001237629
5b606e131c5591dc6a772f44ffb045ffb6bf72a9

Some files were not shown because too many files have changed in this diff Show More