Skip to content

Exception when opening connection using SSPI/GSS authentication from Windows Server 2012 R2 with version 7.0.1 #4888

@biodevc

Description

@biodevc

Steps to reproduce

Open a connection using SSPI authentication from a Windows Server 2012 R2 client (or Windows 8.1) using version 7.0.1 of Npgsql.

The issue

Getting an 'Exception while reading from stream' when opening a connection using SSPI authentication and version 7.0.1 of Npgsql from a Windows Server 2012 R2 client (or Windows 8.1).

Non-SSPI, ie standard username/password, authentication works fine.

Npgsql version 6.0.8 is unaffected.

Windows 10 clients are unaffected.

Exception message: 
   Exception while reading from stream
Stack trace:
   at Npgsql.Internal.NpgsqlReadBuffer.<Ensure>g__EnsureLong|42_0(NpgsqlReadBuffer buffer, Int32 count, Boolean async, Boolean readingNotifications)
   at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|226_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.Internal.NpgsqlConnector.AuthenticateGSS(Boolean async)
   at Npgsql.Internal.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|208_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt)
   at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.PoolingDataSource.<Get>g__RentAsync|28_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|45_0(Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlConnection.Open()

Further technical details

Npgsql version: 7.0.1
.NET version: 7.0.101
PostgreSQL version: 15.1
Operating system: Windows Server 2012 R2 (and also Windows 8.1)

Other details about my project setup:
Works fine when not using SSPI.
Works fine when connecting from Windows 10 clients.
Works fine when using Npgsql version 6.0.8.
Also affects Windows 8.1 which I realise is EOL however Windows Server 2012 R2 is supposedly still in support.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions