Skip to content

fix: enforce socket deadlines during prelogin in encrypt=strict TLS mode #372

@dlevy-msft-sql

Description

@dlevy-msft-sql

Problem

In the encrypt=strict TLS path in tds.go, getTLSConn replaces outbuf.transport with a *tls.Conn, which bypasses the timeoutConn wrapper. This means the computed preloginTimeout (and even the original ConnTimeout) won't enforce a socket deadline in strict mode. Without a context deadline/cancel, readPrelogin can still hang indefinitely in this path.

Context

Identified during review of PR #360 (which fixed the non-strict prelogin hang). The strict mode path was out of scope for that change.

Suggested Fix

Ensure the TLS strict mode wraps the timeout-aware conn, e.g. pass the timeoutConn itself into tls.Client or otherwise apply read/write deadlines on the underlying net.Conn during prelogin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions