diff options
author | Saurabh Singh <saurabh500@users.noreply.github.com> | 2017-03-17 01:27:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-17 01:27:37 +0300 |
commit | 93dda8318bf887e2fd94f46a278358a86fa9411b (patch) | |
tree | 8e9a489e2bd70ae4545d48e8f1e5f79df0ed2ca0 /src/System.Data.SqlClient | |
parent | 82e88c6fd450c47d9a10d835187bae6b60620f2d (diff) |
Adding the sspi buffer pass by ref so that the retrieved value for buffer gets propagated all the way up (#17197)
Diffstat (limited to 'src/System.Data.SqlClient')
4 files changed, 10 insertions, 10 deletions
diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs index 88040ee6b5..adebcdb901 100644 --- a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs +++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs @@ -5938,7 +5938,7 @@ namespace System.Data.SqlClient Debug.Assert(SniContext.Snix_Login == _physicalStateObj.SniContext, String.Format((IFormatProvider)null, "Unexpected SniContext. Expecting Snix_Login, actual value is '{0}'", _physicalStateObj.SniContext)); _physicalStateObj.SniContext = SniContext.Snix_LoginSspi; - SSPIData(null, 0, outSSPIBuff, ref outSSPILength); + SSPIData(null, 0, ref outSSPIBuff, ref outSSPILength); if (TdsParserStateObjectFactory.UseManagedSNI) { outSSPILength = outSSPIBuff != null ? (uint)outSSPIBuff.Length : 0; @@ -6196,19 +6196,19 @@ namespace System.Data.SqlClient _physicalStateObj._messageStatus = 0; }// tdsLogin - private void SSPIData(byte[] receivedBuff, UInt32 receivedLength, byte[] sendBuff, ref UInt32 sendLength) + private void SSPIData(byte[] receivedBuff, UInt32 receivedLength, ref byte[] sendBuff, ref UInt32 sendLength) { - SNISSPIData(receivedBuff, receivedLength, sendBuff, ref sendLength); + SNISSPIData(receivedBuff, receivedLength, ref sendBuff, ref sendLength); } - private void SNISSPIData(byte[] receivedBuff, UInt32 receivedLength, byte[] sendBuff, ref UInt32 sendLength) + private void SNISSPIData(byte[] receivedBuff, UInt32 receivedLength, ref byte[] sendBuff, ref UInt32 sendLength) { if (TdsParserStateObjectFactory.UseManagedSNI) { try { - _physicalStateObj.GenerateSspiClientContext(receivedBuff, receivedLength, sendBuff, ref sendLength, _sniSpnBuffer); + _physicalStateObj.GenerateSspiClientContext(receivedBuff, receivedLength, ref sendBuff, ref sendLength, _sniSpnBuffer); } catch (Exception e) { @@ -6224,7 +6224,7 @@ namespace System.Data.SqlClient } // we need to respond to the server's message with SSPI data - if (0 != _physicalStateObj.GenerateSspiClientContext(receivedBuff, receivedLength, sendBuff, ref sendLength, _sniSpnBuffer)) + if (0 != _physicalStateObj.GenerateSspiClientContext(receivedBuff, receivedLength, ref sendBuff, ref sendLength, _sniSpnBuffer)) { SSPIError(SQLMessage.SSPIGenerateError(), TdsEnums.GEN_CLIENT_CONTEXT); } @@ -6249,7 +6249,7 @@ namespace System.Data.SqlClient // make call for SSPI data - SSPIData(receivedBuff, (UInt32)receivedLength, sendBuff, ref sendLength); + SSPIData(receivedBuff, (UInt32)receivedLength, ref sendBuff, ref sendLength); // DO NOT SEND LENGTH - TDS DOC INCORRECT! JUST SEND SSPI DATA! _physicalStateObj.WriteByteArray(sendBuff, (int)sendLength, 0); diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObject.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObject.cs index eb113a1f5a..b70b113008 100644 --- a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObject.cs +++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObject.cs @@ -774,7 +774,7 @@ namespace System.Data.SqlClient protected abstract void RemovePacketFromPendingList(object pointer); - internal abstract uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, byte[] sendBuff, ref uint sendLength, byte[] _sniSpnBuffer); + internal abstract uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, ref byte[] sendBuff, ref uint sendLength, byte[] _sniSpnBuffer); internal bool Deactivate() { diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs index e976b9c835..cf49c7975a 100644 --- a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs +++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs @@ -224,7 +224,7 @@ namespace System.Data.SqlClient.SNI internal override uint SetConnectionBufferSize(ref uint unsignedPacketSize) => SNIProxy.Singleton.SetConnectionBufferSize(Handle, unsignedPacketSize); - internal override uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, byte[] sendBuff, ref uint sendLength, byte[] _sniSpnBuffer) + internal override uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, ref byte[] sendBuff, ref uint sendLength, byte[] _sniSpnBuffer) { SNIProxy.Singleton.GenSspiClientContext(sspiClientContextStatus, receivedBuff, ref sendBuff, _sniSpnBuffer); return 0; diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectNative.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectNative.cs index 4669bb931e..bebd574324 100644 --- a/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectNative.cs +++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectNative.cs @@ -277,7 +277,7 @@ namespace System.Data.SqlClient internal override uint SetConnectionBufferSize(ref uint unsignedPacketSize) => SNINativeMethodWrapper.SNISetInfo(Handle, SNINativeMethodWrapper.QTypes.SNI_QUERY_CONN_BUFSIZE, ref unsignedPacketSize); - internal override uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, byte[] sendBuff, ref uint sendLength, byte[] _sniSpnBuffer) + internal override uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, ref byte[] sendBuff, ref uint sendLength, byte[] _sniSpnBuffer) => SNINativeMethodWrapper.SNISecGenClientContext(Handle, receivedBuff, receivedLength, sendBuff, ref sendLength, _sniSpnBuffer); |