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
win_sspi auth info overflows isc_dpb_version1 parameter block [DNET936] #859
Comments
Modified by: Foodstuffs INCA team (fssi-inca)description: 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 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? PS C:\temp> Add-Type -Path FirebirdSql.Data.FirebirdClient.7.5.0+isc_dpb_version2.dll PS C:\temp> $conn diff --git a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs
- WriteByte(2);
- WriteByte((byte)4); @@ -57,7 +57,7 @@ namespace FirebirdSql.Data.Common
+ public const int isc_dpb_version2 = 2; // sjd: support >256-byte entries - requires FB3 / protocol 13 - dpb.Append(IscCodes.isc_dpb_version1); - dpb.Append(IscCodes.isc_dpb_version1); => 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 Description: This appears to be a result of win_sspi auth info overflowing the isc_dpb_version1 block - presumably there is an element to this specific to the Windows domain? PS C:\temp> Add-Type -Path FirebirdSql.Data.FirebirdClient.7.5.0+isc_dpb_version2.dll PS C:\temp> $conn diff --git a/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs b/Provider/src/FirebirdSql.Data.FirebirdClient/Common/DatabaseParameterBuffer.cs
- WriteByte(2);
- WriteByte((byte)4); @@ -57,7 +57,7 @@ namespace FirebirdSql.Data.Common
+ public const int isc_dpb_version2 = 2; // sjd: support >256-byte entries - requires FB3 / protocol 13 - dpb.Append(IscCodes.isc_dpb_version1); - dpb.Append(IscCodes.isc_dpb_version1); |
Modified by: @cincuranet |
Modified by: @cincuranet |
Modified by: @cincuranetstatus: Open [ 1 ] => In Progress [ 3 ] |
Modified by: @cincuranet |
Commented by: @cincuranet The issue should be fixed now (at least in my environment it is) in this (https://teamcity.jetbrains.com/viewLog.html?buildId=3099959&buildTypeId=OpenSourceProjects_FirebirdClient_CiBuildItems_ProviderCoreFb30&tab=artifacts) build. Can somebody test it and confirm? |
Commented by: @luronumen Retest result on https://teamcity.jetbrains.com/repository/download/OpenSourceProjects_FirebirdClient_CiBuildItems_ProviderCoreFb30/3099959:id/FirebirdSql.Data.FirebirdClient.7.5.0.nupkg!/lib/net452/FirebirdSql.Data.FirebirdClient.dll : PASSED! Thank you very much for the fix Jiri Cincura! Best Regards, |
Commented by: @cincuranet Thanks for confirmation. It will be in next release (1-2 months). |
Modified by: @cincuranetstatus: In Progress [ 3 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: vNext [ 10920 ] |
Commented by: @luronumen Thank you very much Jiri Cincura! |
Submitted by: Foodstuffs INCA team (fssi-inca)
Is duplicated by DNET941
Votes: 1
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 an element to this specific to the Windows domain?
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);
}
- WriteByte(2);
+ Write((int)2);
Write(value);
}
- 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_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);
Commits: 2679471
The text was updated successfully, but these errors were encountered: