NETProvider icon indicating copy to clipboard operation
NETProvider copied to clipboard

InitializeSecurityContext failed Exception when try to authenticate with Win_Sspi Authentication

Open luronumen opened this issue 7 months ago • 4 comments

Actual Result

  • InitializeSecurityContext failed Exception when try to authenticate with Win_Sspi Authentication in PC without register in a Microsoft Active Directory domain:

Image

System.Exception: InitializeSecurityContext failed
   at FirebirdSql.Data.Client.Managed.Sspi.SspiHelper.GetClientSecurity(Byte[] serverToken)
   at FirebirdSql.Data.Client.Managed.AuthBlock.Start(Byte[] serverData, String acceptPluginName, Boolean isAuthenticated, Byte[] serverKeys)
   at FirebirdSql.Data.Client.Managed.GdsConnection.Identify(String database)
   at FirebirdSql.Data.Client.ClientFactory.CreateManagedDatabase(ConnectionString options)
   at FirebirdSql.Data.Client.ClientFactory.CreateDatabase(ConnectionString options)
   at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
   at FirebirdSql.Data.FirebirdClient.FbConnection.Open()

Expected Result

  • Firebird Exception (code and message) should happen.

Enviroment Setup

  • Windows 11 Pro
  • FirebirdSql.Data.FirebirdClient Version 10.3.3

luronumen avatar Jun 11 '25 04:06 luronumen

AD is not required for SSPI. It works with "local" account as well.

Do you have a repro?

cincuranet avatar Jun 11 '25 08:06 cincuranet

AD is not required for SSPI. It works with "local" account as well.

Do you have a repro?

The issue occurs when trying to access a FirebirdSQL database that is on another computer controlled by a Microsoft Active Directory. When the client computer, which is not controlled by any Active Directory, tries to access this database without providing login credentials, the exception occurs.

luronumen avatar Jun 11 '25 12:06 luronumen

Ahh, OK. In that case that is expected. So it's only about the exception type/message, right?

cincuranet avatar Jun 11 '25 12:06 cincuranet

Ahh, OK. In that case that is expected. So it's only about the exception type/message, right?

Right. the issue is that it is not generating a FbException as it should and my software is not able to handle this exception.

For your fix reference here is the fbclient.dll exception error message for the same scenario:

Image

luronumen avatar Jun 11 '25 12:06 luronumen