Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLServer add suport for SSMS client #13372

Merged
merged 8 commits into from
Jun 13, 2022
9 changes: 5 additions & 4 deletions lib/srv/db/sqlserver/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"net"
"strconv"

"github.com/gravitational/teleport/lib/srv/db/common"
"github.com/gravitational/teleport/lib/srv/db/sqlserver/protocol"
"github.com/gravitational/trace"

mssql "github.com/denisenkom/go-mssqldb"
"github.com/denisenkom/go-mssqldb/msdsn"
"github.com/gravitational/trace"

"github.com/gravitational/teleport/lib/srv/db/common"
"github.com/gravitational/teleport/lib/srv/db/sqlserver/protocol"
)

// Connector defines an interface for connecting to a SQL Server so it can be
Expand Down Expand Up @@ -76,6 +76,7 @@ func (c *connector) Connect(ctx context.Context, sessionCtx *common.Session, log
LoginOptions: options,
Encryption: msdsn.EncryptionRequired,
TLSConfig: tlsConfig,
PacketSize: loginPacket.PacketSize(),
}, auth)

conn, err := connector.Connect(ctx)
Expand Down
6 changes: 6 additions & 0 deletions lib/srv/db/sqlserver/protocol/login7.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ func (p *Login7Packet) TypeFlags() uint8 {
return p.header.TypeFlags
}

// PacketSize return the packet size from the Login7 packet.
// Packet size is used by a server to negation the size of max packet length.
func (p *Login7Packet) PacketSize() uint16 {
return uint16(p.header.PacketSize)
}

// Login7Header contains options and offset/length pairs parsed from the Login7
// packet sent by client.
//
Expand Down