From c789659d8770f30ee5d06168b22d7d61d68b40b5 Mon Sep 17 00:00:00 2001 From: Srdjan Bozovic Date: Sat, 15 Jul 2023 20:59:04 +0200 Subject: [PATCH] fix: protocol version --- tds.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tds.go b/tds.go index 2fae4b18..2f04e90d 100644 --- a/tds.go +++ b/tds.go @@ -102,6 +102,7 @@ const ( verTDS73 = verTDS73A verTDS73B = 0x730B0003 verTDS74 = 0x74000004 + verTDS80 = 0x08000000 ) // packet types @@ -1026,6 +1027,12 @@ func interpretPreloginResponse(p msdsn.Config, fe *featureExtFedAuth, fields map } func prepareLogin(ctx context.Context, c *Connector, p msdsn.Config, logger ContextLogger, auth integratedauth.IntegratedAuthenticator, fe *featureExtFedAuth, packetSize uint32) (l *login, err error) { + var TDSVersion uint32 + if(p.Encryption == msdsn.EncryptionStrict) { + TDSVersion = verTDS80 + } else { + TDSVersion = verTDS74 + } var typeFlags uint8 if p.ReadOnlyIntent { typeFlags |= fReadOnlyIntent @@ -1038,7 +1045,7 @@ func prepareLogin(ctx context.Context, c *Connector, p msdsn.Config, logger Cont serverName = p.Host } l = &login{ - TDSVersion: verTDS74, + TDSVersion: TDSVersion, PacketSize: packetSize, Database: p.Database, OptionFlags2: fODBC, // to get unlimited TEXTSIZE