Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@@ -46,12 +46,7 @@ using Mono.Security.Cryptography;
namespace Mono.Security.Protocol.Ntlm {
[Obsolete (Type3Message.LegacyAPIWarning)]
#if INSIDE_SYSTEM
internal
#else
public
#endif
class ChallengeResponse : IDisposable {
public class ChallengeResponse : IDisposable {
static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };

View File

@@ -49,12 +49,7 @@ using Mono.Security.Cryptography;
namespace Mono.Security.Protocol.Ntlm {
#if INSIDE_SYSTEM
internal
#else
public
#endif
static class ChallengeResponse2 {
public static class ChallengeResponse2 {
static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };

View File

@@ -39,12 +39,7 @@ using System.Globalization;
namespace Mono.Security.Protocol.Ntlm {
#if INSIDE_SYSTEM
internal
#else
public
#endif
abstract class MessageBase {
public abstract class MessageBase {
static private byte[] header = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00 };

View File

@@ -36,12 +36,7 @@ namespace Mono.Security.Protocol.Ntlm {
* is LM_and_NTLM_and_try_NTLMv2_Session.
*/
#if INSIDE_SYSTEM
internal
#else
public
#endif
enum NtlmAuthLevel {
public enum NtlmAuthLevel {
/* Use LM and NTLM, never use NTLMv2 session security. */
LM_and_NTLM,

View File

@@ -40,12 +40,7 @@ using System;
namespace Mono.Security.Protocol.Ntlm {
[Flags]
#if INSIDE_SYSTEM
internal
#else
public
#endif
enum NtlmFlags : int {
public enum NtlmFlags : int {
// The client sets this flag to indicate that it supports Unicode strings.
NegotiateUnicode = 0x00000001,
// This is set to indicate that the client supports OEM strings.

View File

@@ -38,48 +38,13 @@ namespace Mono.Security.Protocol.Ntlm {
* is LM_and_NTLM_and_try_NTLMv2_Session.
*/
#if INSIDE_SYSTEM
internal
#else
public
#endif
static class NtlmSettings {
public static class NtlmSettings {
static NtlmAuthLevel defaultAuthLevel = NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session;
static FieldInfo GetDefaultAuthLevelField ()
{
#if INSIDE_SYSTEM
return null;
#else
var type = typeof (HttpWebRequest).Assembly.GetType ("Mono.Security.Protocol.Ntlm.NtlmSettings", false);
if (type == null)
return null;
return type.GetField ("defaultAuthLevel", BindingFlags.Static | BindingFlags.NonPublic);
#endif
}
#if INSIDE_SYSTEM
internal
#else
public
#endif
static NtlmAuthLevel DefaultAuthLevel {
get {
var field = GetDefaultAuthLevelField ();
if (field != null)
return (NtlmAuthLevel)field.GetValue (null);
else
return defaultAuthLevel;
}
set {
var field = GetDefaultAuthLevelField ();
if (field != null)
field.SetValue (null, value);
else
defaultAuthLevel = value;
}
public static NtlmAuthLevel DefaultAuthLevel {
get { return defaultAuthLevel; }
set { defaultAuthLevel = value; }
}
}
}

View File

@@ -39,12 +39,7 @@ using System.Text;
namespace Mono.Security.Protocol.Ntlm {
#if INSIDE_SYSTEM
internal
#else
public
#endif
class Type1Message : MessageBase {
public class Type1Message : MessageBase {
private string _host;
private string _domain;

View File

@@ -39,12 +39,7 @@ using System.Security.Cryptography;
namespace Mono.Security.Protocol.Ntlm {
#if INSIDE_SYSTEM
internal
#else
public
#endif
class Type2Message : MessageBase {
public class Type2Message : MessageBase {
private byte[] _nonce;
private string _targetName;

View File

@@ -39,12 +39,7 @@ using System.Text;
namespace Mono.Security.Protocol.Ntlm {
#if INSIDE_SYSTEM
internal
#else
public
#endif
class Type3Message : MessageBase {
public class Type3Message : MessageBase {
private NtlmAuthLevel _level;
private byte[] _challenge;
@@ -89,7 +84,7 @@ namespace Mono.Security.Protocol.Ntlm {
public Type3Message (Type2Message type2) : base (3)
{
_type2 = type2;
_level = DefaultAuthLevel;
_level = NtlmSettings.DefaultAuthLevel;
_challenge = (byte[]) type2.Nonce.Clone ();
_domain = type2.TargetName;
@@ -269,11 +264,13 @@ namespace Mono.Security.Protocol.Ntlm {
throw new InvalidOperationException (
"Refusing to use legacy-mode LM/NTLM authentication " +
"unless explicitly enabled using DefaultAuthLevel.");
#pragma warning disable 618
using (var legacy = new ChallengeResponse (_password, _challenge)) {
lm = legacy.LM;
ntlm = legacy.NT;
}
#pragma warning restore 618
} else {
ChallengeResponse2.Compute (_type2, _level, _username, _password, _domain, out lm, out ntlm);
}