win_sspi auth info overflows isc_dpb_version1 parameter block -------------------------------------------------------------
Key: DNET-936 URL: http://tracker.firebirdsql.org/browse/DNET-936 Project: .NET Data provider Issue Type: Bug Components: ADO.NET Provider Affects Versions: 7.5.0.0 Environment: Windows 10 64-bit / Firebird 3.0.5 server Reporter: Foodstuffs INCA team Assignee: Jiri Cincura Expected behaviour: .NET provider supports connections with Windows Trusted User authentication. Actual behaviour: Windows Trusted User authentication connection fails with "Invalid clumplet buffer structure: buffer end before end of clumplet - clumplet too long". Steps to reproduce: PS C:\temp> Add-Type -Path FirebirdSql.Data.FirebirdClient.7.5.0.dll >> $factory = [FirebirdSql.Data.FirebirdClient.FirebirdClientFactory]::Instance >> $conn = $factory.CreateConnection() >> $conn.ConnectionString = "Server=dvpapainca01;Port=3051;Database=incastatus;" >> $conn.Open() Exception calling "Open" with "0" argument(s): "Invalid clumplet buffer structure: buffer end before end of clumplet - clumplet too long" At line:5 char:1 + $conn.Open() + ~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : FbException Description: This appears to be a result of win_sspi auth info overflowing the isc_dpb_version1 block - presumably there is a Windows domain specific element to this? By changing to isc_dpb_version2, the connection succeeds. I've attached a diff for this change below, but it's a naive solution - presumably there would be backwards compatibility issues with a straight switch. PS C:\temp> Add-Type -Path FirebirdSql.Data.FirebirdClient.7.5.0+isc_dpb_version2.dll >> $factory = [FirebirdSql.Data.FirebirdClient.FirebirdClientFactory]::Instance >> $conn = $factory.CreateConnection() >> $conn.ConnectionString = "Server=dvpapainca01;Port=3051;Database=incastatus;" >> $conn.Open() PS C:\temp> $conn ConnectionString : Server=dvpapainca01;Port=3051;Database=incastatus; ConnectionTimeout : 15 Database : incastatus DataSource : dvpapainca01 ServerVersion : WI-V3.0.5.33220 Firebird 3.0/tcp (DVPAPAINCA01)/P13 State : Open PacketSize : 8192 Site : Container : diff --git a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs index 4f10ee72..aa851e6e 100644 --- a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs +++ b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs @@ -31,21 +31,21 @@ namespace FirebirdSql.Data.Common public void Append(int type, byte value) { WriteByte(type); - WriteByte(1); + Write((int)1); Write(value); } public void Append(int type, short value) { WriteByte(type); - WriteByte(2); + Write((int)2); Write(value); } public void Append(int type, int value) { WriteByte(type); - WriteByte((byte)4); + Write((int)4); Write(value); } @@ -57,7 +57,7 @@ namespace FirebirdSql.Data.Common public void Append(int type, byte[] buffer) { WriteByte(type); - WriteByte(buffer.Length); + Write((int)buffer.Length); Write(buffer); } } diff --git a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/IscCodes.cs b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/IscCodes.cs index 65c5b4e7..76a0cf0a 100644 --- a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/IscCodes.cs +++ b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/IscCodes.cs @@ -224,6 +224,7 @@ namespace FirebirdSql.Data.Common #region Database Parameter Block public const int isc_dpb_version1 = 1; + public const int isc_dpb_version2 = 2; // sjd: support >256-byte entries - requires FB3 / protocol 13 public const int isc_dpb_cdd_pathname = 1; public const int isc_dpb_allocation = 2; public const int isc_dpb_journal = 3; diff --git a/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnection.cs b/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnection.cs index f6d38a65..aa79ab62 100644 --- a/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnection.cs +++ b/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnection.cs @@ -73,7 +73,7 @@ namespace FirebirdSql.Data.FirebirdClient { var dpb = new DatabaseParameterBuffer(); - dpb.Append(IscCodes.isc_dpb_version1); + dpb.Append(IscCodes.isc_dpb_version2); dpb.Append(IscCodes.isc_dpb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 }); dpb.Append(IscCodes.isc_dpb_sql_dialect, new byte[] { options.Dialect, 0, 0, 0 }); if (!string.IsNullOrEmpty(options.UserID)) diff --git a/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionInternal.cs b/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionInternal.cs index e4890dcd..cec4413d 100644 --- a/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionInternal.cs +++ b/Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionInternal.cs @@ -402,7 +402,7 @@ namespace FirebirdSql.Data.FirebirdClient { var dpb = new DatabaseParameterBuffer(); - dpb.Append(IscCodes.isc_dpb_version1); + dpb.Append(IscCodes.isc_dpb_version2); dpb.Append(IscCodes.isc_dpb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 }); dpb.Append(IscCodes.isc_dpb_sql_dialect, new byte[] { options.Dialect, 0, 0, 0 }); dpb.Append(IscCodes.isc_dpb_lc_ctype, options.Charset); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider