Merge branch 'upstream'

Former-commit-id: 75a5a059521e71c41e46362655d4f34c1384a580
This commit is contained in:
Xamarin Public Jenkins 2016-03-16 12:40:50 -04:00
commit 6f878b8431
110 changed files with 1496 additions and 556 deletions

View File

@ -84,8 +84,8 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in mkinstalldirs \
$(srcdir)/mono-uninstalled.pc.in COPYING.LIB ChangeLog NEWS \
compile config.guess config.rpath config.sub install-sh \
missing ltmain.sh
compile config.guess config.rpath config.sub depcomp \
install-sh missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \

View File

@ -1 +1 @@
79ba3854a41b122e90badfb88a8aba24b6abc54c
25ac5dd52e897440dac529dfcfe2034bdae89d53

View File

@ -1 +1 @@
568cb227ed520bd10d312bf4a66ccba0f772b016
3decb1ccc1162ebbe9663424f20f2ace97e2921f

View File

@ -293,8 +293,10 @@ namespace System.Diagnostics {
internal void WaitUtilEOF() {
if( eofEvent != null) {
eofEvent.WaitOne();
#if !MONO
eofEvent.Close();
eofEvent = null;
#endif
}
}
}

View File

@ -142,6 +142,11 @@ instead of going through the operating system symbol lookup operation.
.I llvm-path=<PREFIX>
Same for the llvm tools 'opt' and 'llc'.
.TP
.I gen-seq-points-file=FILE.msym
Instructs the AOT compiler to generate offline sequence points .msym files.
The path is optional, if none is passed then a .msym file will be generated
next to the input assembly.
.TP
.I mtriple=<TRIPLE>
Use the GNU style target triple <TRIPLE> to determine some code generation options, i.e.
--mtriple=armv7-linux-gnueabi will generate code that targets ARMv7. This is currently

View File

@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "4.3.2.0";
public const string MonoVersion = "4.4.0.0";
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

@ -153,7 +153,7 @@ namespace Microsoft.Build.Tasks
throw;
}
Log.LogErrorWithCodeFromResources ("XmlPeek.ArgumentError", e.Message);
Log.LogError ("MSB3741: Unable to load arguments for the XmlPeek task. {0}", e.Message);
return false;
}
@ -169,7 +169,7 @@ namespace Microsoft.Build.Tasks
throw;
}
Log.LogErrorWithCodeFromResources ("XmlPeekPoke.InputFileError", _xmlInputPath.ItemSpec, e.Message);
Log.LogError ("MSB3733: Input file \"{0}\" cannot be opened. {1}", _xmlInputPath.ItemSpec, e.Message);
return false;
} finally {
xmlinput.CloseReader ();
@ -185,7 +185,7 @@ namespace Microsoft.Build.Tasks
throw;
}
Log.LogErrorWithCodeFromResources ("XmlPeekPoke.XPathError", _query, e.Message);
Log.LogError ("MSB3734: XPath Query \"{0}\" cannot be loaded. {1}", _query, e.Message);
return false;
}
@ -199,14 +199,14 @@ namespace Microsoft.Build.Tasks
throw;
}
Log.LogErrorWithCodeFromResources ("XmlPeek.NamespacesError", e.Message);
Log.LogError ("MSB3742: Unable to process the Namespaces argument for the XmlPeek task. {0}", e.Message);
return false;
}
try {
expr.SetContext (xmlNamespaceManager);
} catch (XPathException e) {
Log.LogErrorWithCodeFromResources ("XmlPeek.XPathContextError", e.Message);
Log.LogError ("MSB3743: Unable to set XPath expression's Context. {0}", e.Message);
return false;
}
@ -228,12 +228,12 @@ namespace Microsoft.Build.Tasks
_result [i++] = new TaskItem (item);
// This can be logged a lot, so low importance
Log.LogMessageFromResources (MessageImportance.Low, "XmlPeek.Found", item);
Log.LogMessage (MessageImportance.Low, "Found \"{0}\".", item);
}
if (_result.Length == 0) {
// Logged no more than once per execute of this task
Log.LogMessageFromResources ("XmlPeek.NotFound");
Log.LogMessage ("The specified XPath query did not capture any nodes.");
}
return true;

View File

@ -21,5 +21,5 @@ EXTRA_DISTFILES = Mono.Security.Interface/README.md
#
# Update this comment to trigger a build in System
# +1
# +2
#

View File

@ -49,7 +49,7 @@ namespace Mono.Security.Interface
set { checkCertRevocationStatus = value; }
}
public bool UseServicePointManagerCallback {
public bool? UseServicePointManagerCallback {
get { return useServicePointManagerCallback; }
set { useServicePointManagerCallback = value; }
}
@ -89,7 +89,7 @@ namespace Mono.Security.Interface
bool cloned = false;
bool checkCertName = true;
bool checkCertRevocationStatus = false;
bool useServicePointManagerCallback = true;
bool? useServicePointManagerCallback = null;
bool skipSystemValidators = false;
bool callbackNeedsChain = true;
ICertificateValidator certificateValidator;

View File

@ -128,12 +128,25 @@ namespace Mono.Security.X509 {
string filename = Path.Combine (_storePath, GetUniqueName (certificate));
if (!File.Exists (filename)) {
using (FileStream fs = File.Create (filename)) {
byte[] data = certificate.RawData;
fs.Write (data, 0, data.Length);
fs.Close ();
filename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate));
if (!File.Exists (filename)) {
using (FileStream fs = File.Create (filename)) {
byte[] data = certificate.RawData;
fs.Write (data, 0, data.Length);
fs.Close ();
}
ClearCertificates (); // We have modified the store on disk. So forget the old state.
}
} else {
string newfilename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate));
if (GetUniqueNameWithSerial (LoadCertificate (filename)) != GetUniqueNameWithSerial (certificate)) {
using (FileStream fs = File.Create (newfilename)) {
byte[] data = certificate.RawData;
fs.Write (data, 0, data.Length);
fs.Close ();
}
ClearCertificates (); // We have modified the store on disk. So forget the old state.
}
ClearCertificates (); // We have modified the store on disk. So forget the old state.
}
#if !NET_2_1
// Try to save privateKey if available..
@ -164,10 +177,16 @@ namespace Mono.Security.X509 {
public void Remove (X509Certificate certificate)
{
string filename = Path.Combine (_storePath, GetUniqueName (certificate));
string filename = Path.Combine (_storePath, GetUniqueNameWithSerial (certificate));
if (File.Exists (filename)) {
File.Delete (filename);
ClearCertificates (); // We have modified the store on disk. So forget the old state.
} else {
filename = Path.Combine (_storePath, GetUniqueName (certificate));
if (File.Exists (filename)) {
File.Delete (filename);
ClearCertificates (); // We have modified the store on disk. So forget the old state.
}
}
}
@ -182,10 +201,15 @@ namespace Mono.Security.X509 {
// private stuff
private string GetUniqueName (X509Certificate certificate)
private string GetUniqueNameWithSerial (X509Certificate certificate)
{
return GetUniqueName (certificate, certificate.SerialNumber);
}
private string GetUniqueName (X509Certificate certificate, byte[] serial = null)
{
string method;
byte[] name = GetUniqueName (certificate.Extensions);
byte[] name = GetUniqueName (certificate.Extensions, serial);
if (name == null) {
method = "tbp"; // thumbprint
name = certificate.Hash;
@ -208,7 +232,7 @@ namespace Mono.Security.X509 {
return GetUniqueName (method, name, ".crl");
}
private byte[] GetUniqueName (X509ExtensionCollection extensions)
private byte[] GetUniqueName (X509ExtensionCollection extensions, byte[] serial = null)
{
// We prefer Subject Key Identifier as the unique name
// as it will provide faster lookups
@ -217,7 +241,14 @@ namespace Mono.Security.X509 {
return null;
SubjectKeyIdentifierExtension ski = new SubjectKeyIdentifierExtension (ext);
return ski.Identifier;
if (serial == null) {
return ski.Identifier;
} else {
byte[] uniqueWithSerial = new byte[ski.Identifier.Length + serial.Length];
System.Buffer.BlockCopy (ski.Identifier, 0, uniqueWithSerial, 0, ski.Identifier.Length );
System.Buffer.BlockCopy (serial, 0, uniqueWithSerial, ski.Identifier.Length, serial.Length );
return uniqueWithSerial;
}
}
private string GetUniqueName (string method, byte[] name, string fileExtension)

View File

@ -22,7 +22,7 @@ namespace SharpCompress.Writer.Zip
byte[] encodedFilename = Encoding.UTF8.GetBytes(FileName);
byte[] encodedComment = Encoding.UTF8.GetBytes(Comment);
outputStream.Write(new byte[] {80, 75, 1, 2, 0x3F, 0, 0x0A, 0}, 0, 8);
outputStream.Write(new byte[] {80, 75, 1, 2, 0x14, 0, 0x0A, 0}, 0, 8);
HeaderFlags flags = HeaderFlags.UTF8;
if (!outputStream.CanSeek)
{

View File

@ -142,7 +142,7 @@ namespace SharpCompress.Writer.Zip
byte[] encodedFilename = encoding.GetBytes(filename);
OutputStream.Write(BitConverter.GetBytes(ZipHeaderFactory.ENTRY_HEADER_BYTES), 0, 4);
OutputStream.Write(new byte[] {63, 0}, 0, 2); //version
OutputStream.Write(new byte[] {20, 0}, 0, 2); //version
HeaderFlags flags = encoding == Encoding.UTF8 ? HeaderFlags.UTF8 : (HeaderFlags)0;
if (!OutputStream.CanSeek)
{

View File

@ -114,6 +114,51 @@ namespace MonoTests.System.IO.Compression
File.Delete ("test.zip");
}
[Test]
public void ZipOpenAndReopenEntry()
{
try {
File.Copy("archive.zip", "test.zip", overwrite: true);
using (var archive = new ZipArchive(File.Open("test.zip", FileMode.Open),
ZipArchiveMode.Update))
{
var entry = archive.GetEntry("foo.txt");
Assert.IsNotNull(entry);
var stream = entry.Open();
try {
stream = entry.Open();
} catch (global::System.IO.IOException ex) {
return;
}
Assert.Fail();
}
} finally {
File.Delete ("test.zip");
}
}
[Test]
public void ZipOpenCloseAndReopenEntry()
{
File.Copy("archive.zip", "test.zip", overwrite: true);
using (var archive = new ZipArchive(File.Open("test.zip", FileMode.Open),
ZipArchiveMode.Update))
{
var entry = archive.GetEntry("foo.txt");
Assert.IsNotNull(entry);
var stream = entry.Open();
stream.Dispose();
stream = entry.Open();
}
File.Delete ("test.zip");
}
[Test]
public void ZipGetEntryDeleteReadMode()
{

View File

@ -29,10 +29,96 @@ using SharpCompress.Archive;
namespace System.IO.Compression
{
internal class ZipArchiveEntryStream : Stream, IDisposable
{
private readonly ZipArchiveEntry entry;
private readonly Stream stream;
public override bool CanRead {
get {
return stream.CanRead;
}
}
public override bool CanSeek {
get {
return stream.CanSeek;
}
}
public override bool CanWrite {
get {
return stream.CanWrite;
}
}
public override long Length {
get {
return stream.Length;
}
}
public override long Position {
get {
return stream.Position;
}
set {
stream.Position = value;
}
}
public ZipArchiveEntryStream(ZipArchiveEntry entry, Stream stream)
{
this.entry = entry;
this.stream = stream;
}
public override void Flush ()
{
stream.Flush();
}
public override long Seek (long offset, SeekOrigin origin)
{
return stream.Seek(offset, origin);
}
public override void SetLength (long value)
{
stream.SetLength(value);
}
public override int Read (byte[] buffer, int offset, int count)
{
return stream.Read(buffer, offset, count);
}
public override void Write (byte[] buffer, int offset, int count)
{
stream.Write(buffer, offset, count);
}
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
base.Dispose();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
entry.openStream = null;
stream.Dispose();
}
}
}
public class ZipArchiveEntry
{
readonly SharpCompress.Archive.Zip.ZipArchiveEntry entry;
private Stream openStream;
internal ZipArchiveEntryStream openStream;
private bool wasDeleted;
internal ZipArchiveEntry(ZipArchive archive, SharpCompress.Archive.Zip.ZipArchiveEntry entry)
@ -112,7 +198,7 @@ namespace System.IO.Compression
if (Archive.Mode == ZipArchiveMode.Create && openStream != null)
throw new IOException("The archive for this entry was opened with the Create mode, and this entry has already been written to.");
openStream = entry.OpenEntryStream();
openStream = new ZipArchiveEntryStream(this, entry.OpenEntryStream());
return openStream;
}

View File

@ -442,7 +442,7 @@ namespace System.Json
{
if (value == null)
throw new ArgumentNullException ("value");
return Convert.ToUInt16 (((JsonPrimitive) value).Value, NumberFormatInfo.InvariantInfo);
return Convert.ToUInt32 (((JsonPrimitive) value).Value, NumberFormatInfo.InvariantInfo);
}
public static implicit operator ulong (JsonValue value)

View File

@ -112,6 +112,30 @@ namespace MonoTests.System
Assert.AreEqual (number, jvalue); // should be exactly the same
}
[Test]
public void CheckIntegers ()
{
Assert.AreEqual (sbyte.MinValue, (sbyte) JsonValue.Parse (new JsonPrimitive (sbyte.MinValue).ToString ()));
Assert.AreEqual (sbyte.MaxValue, (sbyte) JsonValue.Parse (new JsonPrimitive (sbyte.MaxValue).ToString ()));
Assert.AreEqual (byte.MinValue, (byte) JsonValue.Parse (new JsonPrimitive (byte.MinValue).ToString ()));
Assert.AreEqual (byte.MaxValue, (byte) JsonValue.Parse (new JsonPrimitive (byte.MaxValue).ToString ()));
Assert.AreEqual (short.MinValue, (short) JsonValue.Parse (new JsonPrimitive (short.MinValue).ToString ()));
Assert.AreEqual (short.MaxValue, (short) JsonValue.Parse (new JsonPrimitive (short.MaxValue).ToString ()));
Assert.AreEqual (ushort.MinValue, (ushort) JsonValue.Parse (new JsonPrimitive (ushort.MinValue).ToString ()));
Assert.AreEqual (ushort.MaxValue, (ushort) JsonValue.Parse (new JsonPrimitive (ushort.MaxValue).ToString ()));
Assert.AreEqual (int.MinValue, (int) JsonValue.Parse (new JsonPrimitive (int.MinValue).ToString ()));
Assert.AreEqual (int.MaxValue, (int) JsonValue.Parse (new JsonPrimitive (int.MaxValue).ToString ()));
Assert.AreEqual (uint.MinValue, (uint) JsonValue.Parse (new JsonPrimitive (uint.MinValue).ToString ()));
Assert.AreEqual (uint.MaxValue, (uint) JsonValue.Parse (new JsonPrimitive (uint.MaxValue).ToString ()));
Assert.AreEqual (long.MinValue, (long) JsonValue.Parse (new JsonPrimitive (long.MinValue).ToString ()));
Assert.AreEqual (long.MaxValue, (long) JsonValue.Parse (new JsonPrimitive (long.MaxValue).ToString ()));
Assert.AreEqual (ulong.MinValue, (ulong) JsonValue.Parse (new JsonPrimitive (ulong.MinValue).ToString ()));
Assert.AreEqual (ulong.MaxValue, (ulong) JsonValue.Parse (new JsonPrimitive (ulong.MaxValue).ToString ()));
}
[Test]
public void CheckNumbers ()
{
@ -262,3 +286,10 @@ namespace MonoTests.System
}
}
}
// vim: noexpandtab
// Local Variables:
// tab-width: 4
// c-basic-offset: 4
// indent-tabs-mode: t
// End:

View File

@ -0,0 +1 @@
#include System.Net.Http.dll.sources

View File

@ -0,0 +1 @@
#include System.Net.Http.dll.sources

View File

@ -237,23 +237,29 @@ namespace Mono.Security.Cryptography {
private static RSA user;
private static RSA machine;
private readonly static object user_lock = new object ();
private readonly static object machine_lock = new object ();
private static RSA GetKey (DataProtectionScope scope)
{
switch (scope) {
case DataProtectionScope.CurrentUser:
if (user == null) {
CspParameters csp = new CspParameters ();
csp.KeyContainerName = "DAPI";
user = new RSACryptoServiceProvider (1536, csp);
lock (user_lock) {
CspParameters csp = new CspParameters ();
csp.KeyContainerName = "DAPI";
user = new RSACryptoServiceProvider (1536, csp);
}
}
return user;
case DataProtectionScope.LocalMachine:
if (machine == null) {
CspParameters csp = new CspParameters ();
csp.KeyContainerName = "DAPI";
csp.Flags = CspProviderFlags.UseMachineKeyStore;
machine = new RSACryptoServiceProvider (1536, csp);
lock (machine_lock) {
CspParameters csp = new CspParameters ();
csp.KeyContainerName = "DAPI";
csp.Flags = CspProviderFlags.UseMachineKeyStore;
machine = new RSACryptoServiceProvider (1536, csp);
}
}
return machine;
default:

View File

@ -12,6 +12,9 @@
using NUnit.Framework;
using System;
using System.Text;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace MonoTests.System.Security.Cryptography {
@ -64,6 +67,31 @@ namespace MonoTests.System.Security.Cryptography {
ProtectUnprotect (notMuchEntropy, DataProtectionScope.LocalMachine);
}
[Test] // https://bugzilla.xamarin.com/show_bug.cgi?id=38933
public void ProtectCurrentUserMultiThread ()
{
string data = "Hello World";
string entropy = "This is a long string with no meaningful content.";
var entropyBytes = Encoding.UTF8.GetBytes (entropy);
var dataBytes = Encoding.UTF8.GetBytes (data);
var tasks = new List<Task> ();
for (int i = 0; i < 20; i++)
{
tasks.Add (new Task (() => {
byte[] encryptedBytes = ProtectedData.Protect (dataBytes, entropyBytes, DataProtectionScope.CurrentUser);
Assert.IsFalse (IsEmpty (encryptedBytes), "#1");
byte[] decryptedBytes = ProtectedData.Unprotect (encryptedBytes, entropyBytes, DataProtectionScope.CurrentUser);
string decryptedString = Encoding.UTF8.GetString(decryptedBytes);
Assert.AreEqual (data, decryptedString, "#2");
}, TaskCreationOptions.LongRunning));
}
foreach (var t in tasks) t.Start ();
Task.WaitAll (tasks.ToArray ());
}
[Test]
public void DataProtectionScope_All ()
{

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