Issue Details (XML | Word | Printable)

Key: DNET-936
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Foodstuffs INCA team
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

win_sspi auth info overflows isc_dpb_version1 parameter block

Created: 18/Mar/20 10:02 PM   Updated: 29/Jun/20 06:52 AM
Component/s: ADO.NET Provider
Affects Version/s: 7.5.0.0
Fix Version/s: None

Environment: Windows 10 64-bit / Firebird 3.0.5 server
Issue Links:
Relate
 


 Description  « Hide
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);
  }
 
  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);


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.