makssent opened a new pull request, #40208:
URL: https://github.com/apache/shardingsphere/pull/40208
Changes proposed in this pull request:
- `FirebirdConnectPacket` now skips the unused `p_cnct_operation` field of
`op_connect`, and `FirebirdProtocol` reads the protocol version as a 16-bit
value.
- `op_connect` is written by
[Jaybird](https://github.com/FirebirdSQL/jaybird/blob/v6.0.6/src/main/org/firebirdsql/gds/ng/wire/WireConnection.java#L393-L408)
and
[fbclient](https://github.com/FirebirdSQL/firebird/blob/v5.0.4/src/remote/inet.cpp#L2852-L2856)
and read by
[Firebird](https://github.com/FirebirdSQL/firebird/blob/v5.0.4/src/remote/protocol.cpp#L320-L357).
- `p_cnct_operation` is declared unused in
[Firebird](https://github.com/FirebirdSQL/firebird/blob/v5.0.4/src/remote/protocol.h#L380-L398),
and the protocol versions are compared as unsigned 16-bit numbers by
[Firebird](https://github.com/FirebirdSQL/firebird/blob/v5.0.4/src/remote/server/server.cpp#L1994-L2011).
- Previously, when a client based on fbclient (for example, isql) sent
`op_connect` with `0x00030000` in `p_cnct_operation` and sign-extended protocol
versions (`0xFFFF8013`), the proxy parsed `p_cnct_operation` as a command
packet type and failed. The client got `op_response` with error `isc_random`,
and the proxy closed the connection. Now the proxy answers as the Firebird
server does (`op_accept_data`).
<details>
<summary>Verification</summary>
The same protocol packets were executed directly against a real database and
through the proxy, and the results were compared.
* Server: Firebird 5.0
* Clients: Jaybird 6.0.6
Two `op_connect` packets are sent, each to a new connection, and the first
answer is read. The packets are the same (user identification with `Srp256`,
protocols 13, 15, 16, 18 and 19) and differ only in the two fields that Jaybird
and fbclient write differently.
Before the fix:
| Packet | Proxy | Server | Match |
|---|---|---|---|
| `op_connect` as Jaybird writes it (`p_cnct_operation` 19, versions
`0x00008013`) | `op_accept_data` | `op_accept_data` | yes |
| `op_connect` as fbclient writes it (`p_cnct_operation` `0x00030000`,
versions `0xFFFF8013`) | `op_response`, error `isc_random` `Unknown exception.
More details: java.lang.NullPointerException: Cannot find '196608' in command
packet type` | `op_accept_data` | no |
After the fix:
| Packet | Proxy | Server | Match |
|---|---|---|---|
| `op_connect` as Jaybird writes it (`p_cnct_operation` 19, versions
`0x00008013`) | `op_accept_data` | `op_accept_data` | yes |
| `op_connect` as fbclient writes it (`p_cnct_operation` `0x00030000`,
versions `0xFFFF8013`) | `op_accept_data` | `op_accept_data` | yes |
</details>
---
Before committing this PR, I'm sure that I have checked the following
options:
- [x] My code follows the [code of
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/)
of this project.
- [x] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the
pull request.
- [ ] I have passed maven check locally : `./mvnw clean install -B -T1C
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [x] I have added corresponding unit tests for my changes.
- [ ] I have updated the Release Notes of the current development version.
For more details, see [Update Release
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
- [ ] I have specified the tool and the affected files or area for
substantial AI assistance, as required by the [AI-assisted contribution policy].
[AI-assisted contribution policy]:
https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]