-
Notifications
You must be signed in to change notification settings - Fork 129
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
Fixed MariaDB protocol handling issue #662
Conversation
Fixed inconsitency in protocol between MariaDB and MySQL
Extended with tests
Added tests
Removed unsused stuff
# Conflicts: # decryptor/mysql/packet_test.go
Fixed conflicts
Extend integration tests
|
||
// https://mariadb.com/kb/en/com_stmt_execute/#statement-id | ||
// Since MariaDB server version 10.2, value -1 (0xFFFFFFFF) can be used to indicate to use the last | ||
// statement prepared on current connection if no COM_STMT_PREPARE has fail since. |
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.
hm.... we should handle it somehow too. reset lastStatementID
class TestMariaDBTextTypeAwareDecryptionWithCiphertext(test_common.AcraCatchLogsMixin, test_common.BaseBinaryMariaDBTestCase, | ||
test_searchable_transparent_encryption.BaseTransparentEncryption): | ||
# test table used for queries and data mapping into python types | ||
test_table = sa.Table( |
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.
I remember we had some problems with using shared metadata and registering tables with same names. And for that started to use def get_encryptor_table(self)
methods and test_common.SeparateMetadataMixin
mixin to use separate metadata if it can be used to avoid conflicts. please look at that, is it relevant here
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.
We already have test_common.SeparateMetadataMixin
inside test_searchable_transparent_encryption.BaseTransparentEncryption
class. And this test inherits this class.
tests/test.py
Outdated
|
||
def executePreparedStatement(self, query, args=None): | ||
return MariaDBExecutor( | ||
ConnectionArgs(host='127.0.0.1', port=self.ACRASERVER_PORT, |
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.
let's use host from the configured variable
tests/test_common.py
Outdated
@@ -79,6 +82,13 @@ class MysqlExecutorMixin(ExecutorMixin): | |||
executor_cls = base.MysqlExecutor | |||
|
|||
|
|||
class MariaDBExecutorMixin(ExecutorMixin): | |||
def get_db_host(self): | |||
return '127.0.0.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.
same here, can we use value from the DB_HOST?
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.
As we discussed, MariaDB expects 127.0.0.1 explicitly because it is using socket auth by default in the case of localhost
row = self.executor1.execute(query)[0] | ||
for column in columns: | ||
self.assertEqual(data[column], row[column]) | ||
self.assertIsInstance(row[column], type(data[column])) |
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.
yay, no hacks with type conversion, just simple comparison)
|
||
// if not (CLIENT_DEPRECATE_EOF capability set) EOF_Packet | ||
// https://mariadb.com/kb/en/result-set-packets/#column-definition-packet | ||
if eofPacket.data[0] != EOFPacket { |
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.
I hope we will never get empty slice and err=nil here ))
Fixed issue related to MariaDB protocol. What has been done in this PR:
MARIADB_CLIENT_EXTENDED_TYPE_INFO
capability from the client and server sides;updateFieldEncodedType
func with updating specific type data asCharset
,ColumnLength
, etc;Checklist
with new changes