-
Notifications
You must be signed in to change notification settings - Fork 1k
Read auth_data_len from InitialHandshake packet instead of hard code #640
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
Conversation
Btw, when syncer receive an EOF Packet, it's means that user set 'BINLOG_DUMP_NON_BLOCK' flag in COM_BINLOG_DUMP command and there is no more binlog event now. master will send this Packet instead of blocking |
client/auth.go
Outdated
// auth_data is end with 0x00, max data length is 13 + 8 = 21 | ||
// ref to https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake | ||
maxAuthDataLen := 21 | ||
if c.capability&CLIENT_PLUGIN_AUTH != 0 && int(data[pos]) < maxAuthDataLen { |
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.
if int(data[pos])
is 9
, resetOfAuthDataEndPos
will equals pos
. But as stated $len=MAX(13, length of auth-plugin-data - 8)
in https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake, resetOfAuthDataEndPos
should be pos + 13 - 1
?
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.
sorry, it's my fault. it's min_auth_data_len
is 21, not max_data_len
.
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.
and this pr is a little bit old, need to be updated :-)
Now
When Fake Slave receive initialHandshake packet from Master, it'll decodes this packet. The current implementation uses hard-coded methods to obtain auth_data_part_2.
Change
But actually we can get auth_data_len from initHandshake packet. We can use the same method to get auth_plugin_name(ref to MySQL Doc)
Test
I've tested this change with my local MySQL, it's ok