Imported Upstream version 3.12.0

Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
Jo Shields
2015-01-13 10:44:36 +00:00
parent 8b9b85e7f5
commit 181b81b4a4
659 changed files with 12743 additions and 16300 deletions

View File

@@ -41,7 +41,9 @@ using System.ComponentModel;
using System.Diagnostics;
using System.Net.Sockets;
using System.Globalization;
using System.Security;
using System.Text;
using System.Runtime.InteropServices;
namespace Mono.Data.Tds.Protocol
{
@@ -1468,7 +1470,7 @@ namespace Mono.Data.Tds.Protocol
t3.Domain = this.connectionParms.DefaultDomain;
t3.Host = this.connectionParms.Hostname;
t3.Username = this.connectionParms.User;
t3.Password = this.connectionParms.Password;
t3.Password = GetPlainPassword(this.connectionParms.Password);
Comm.StartPacket (TdsPacketType.SspAuth); // 0x11
Comm.Append (t3.GetBytes ());
@@ -1919,6 +1921,20 @@ namespace Mono.Data.Tds.Protocol
comm.Skip(4);
}
public static string GetPlainPassword(SecureString secPass)
{
IntPtr plainString = IntPtr.Zero;
try
{
plainString = Marshal.SecureStringToGlobalAllocUnicode(secPass);
return Marshal.PtrToStringUni(plainString);
}
finally
{
Marshal.ZeroFreeGlobalAllocUnicode(plainString);
}
}
#endregion // Private Methods
#if NET_2_0