-
Notifications
You must be signed in to change notification settings - Fork 41
Support for latest Connector/J 8.0.22 #14
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
1668f5b
b9ea222
0f7fa54
f0b5cc0
a195d32
4f018e4
2ede00d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -101,7 +101,7 @@ use std::io::prelude::*; | |||
| use std::iter; | ||||
| use std::net; | ||||
|
|
||||
| pub use crate::myc::constants::{ColumnFlags, ColumnType, StatusFlags}; | ||||
| pub use crate::myc::constants::{CapabilityFlags, ColumnFlags, ColumnType, StatusFlags}; | ||||
|
|
||||
| mod commands; | ||||
| mod errorcodes; | ||||
|
|
@@ -238,15 +238,22 @@ impl<B: MysqlShim<W>, R: Read, W: Write> MysqlIntermediary<B, R, W> { | |||
| fn init(&mut self) -> Result<(), B::Error> { | ||||
| self.writer.write_all(&[10])?; // protocol 10 | ||||
|
|
||||
| let mut capabilities = CapabilityFlags::empty(); | ||||
| capabilities.insert(CapabilityFlags::CLIENT_PROTOCOL_41); | ||||
| capabilities.insert(CapabilityFlags::CLIENT_RESERVED); | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does setting this do? Aren't generally reserved flags supposed to be 0?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It came from default capabilities flags. Here you set it. Line 246 in 4f301c9
It should be 0x02 if you only meant CLIENT_PROTOCOL_41.
|
||||
| capabilities.insert(CapabilityFlags::CLIENT_SECURE_CONNECTION); | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we actually support secure connections? I did not think so?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't. But those two are the minimal sets of flags that fixed the connection phase issue with the latest Connector/J. But I have to fix the client authentication problem. |
||||
| capabilities.insert(CapabilityFlags::CLIENT_PLUGIN_AUTH); | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What makes it so that we support plugin auths? |
||||
| let capabilities_bytes = capabilities.bits().to_le_bytes(); | ||||
|
|
||||
| // 5.1.10 because that's what Ruby's ActiveRecord requires | ||||
| self.writer.write_all(&b"5.1.10-alpha-msql-proxy\0"[..])?; | ||||
|
|
||||
| self.writer.write_all(&[0x08, 0x00, 0x00, 0x00])?; // TODO: connection ID | ||||
| self.writer.write_all(&b";X,po_k}\0"[..])?; // auth seed | ||||
| self.writer.write_all(&[0x00, 0x42])?; // just 4.1 proto | ||||
| self.writer.write_all(&capabilities_bytes[..2])?; // just 4.1 proto | ||||
| self.writer.write_all(&[0x21])?; // UTF8_GENERAL_CI | ||||
| self.writer.write_all(&[0x00, 0x00])?; // status flags | ||||
| self.writer.write_all(&[0x00, 0x00])?; // extended capabilities | ||||
| self.writer.write_all(&capabilities_bytes[2..])?; // extended capabilities | ||||
| self.writer.write_all(&[0x00])?; // no plugins | ||||
| self.writer.write_all(&[0x00; 6][..])?; // filler | ||||
| self.writer.write_all(&[0x00; 4][..])?; // filler | ||||
|
|
@@ -266,17 +273,22 @@ impl<B: MysqlShim<W>, R: Read, W: Write> MysqlIntermediary<B, R, W> { | |||
| io::ErrorKind::UnexpectedEof, | ||||
| "client sent incomplete handshake", | ||||
| ), | ||||
| nom::Err::Failure((input, nom_e_kind)) | ||||
| | nom::Err::Error((input, nom_e_kind)) => { | ||||
| if let nom::error::ErrorKind::Eof = nom_e_kind { | ||||
| nom::Err::Failure(nom_error) | nom::Err::Error(nom_error) => { | ||||
| if let nom::error::ErrorKind::Eof = nom_error.code { | ||||
| io::Error::new( | ||||
| io::ErrorKind::UnexpectedEof, | ||||
| format!("client did not complete handshake; got {:?}", input), | ||||
| format!( | ||||
| "client did not complete handshake; got {:?}", | ||||
| nom_error.input | ||||
| ), | ||||
| ) | ||||
| } else { | ||||
| io::Error::new( | ||||
| io::ErrorKind::InvalidData, | ||||
| format!("bad client handshake; got {:?} ({:?})", input, nom_e_kind), | ||||
| format!( | ||||
| "bad client handshake; got {:?} ({:?})", | ||||
| nom_error.input, nom_error.code | ||||
| ), | ||||
| ) | ||||
| } | ||||
| } | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| use byteorder::{ByteOrder, LittleEndian}; | ||
| use nom; | ||
| use std::io; | ||
| use std::io::prelude::*; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the handshake change the only difference with the 4.1 protocol?