File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -879,10 +879,11 @@ def _request_authentication(self):
879
879
else :
880
880
authresp = b"\0 " # empty password
881
881
882
- if self .server_capabilities & CLIENT .PLUGIN_AUTH_LENENC_CLIENT_DATA :
882
+ if (
883
+ self .server_capabilities & CLIENT .PLUGIN_AUTH_LENENC_CLIENT_DATA
884
+ or self .server_capabilities & CLIENT .SECURE_CONNECTION
885
+ ):
883
886
data += _lenenc_int (len (authresp )) + authresp
884
- elif self .server_capabilities & CLIENT .SECURE_CONNECTION :
885
- data += struct .pack ("B" , len (authresp )) + authresp
886
887
else : # pragma: no cover - not testing against servers without secure auth (>=5.0)
887
888
data += authresp + b"\0 "
888
889
@@ -898,10 +899,10 @@ def _request_authentication(self):
898
899
connect_attrs = b""
899
900
for k , v in self ._connect_attrs .items ():
900
901
k = k .encode ("utf-8" )
901
- connect_attrs += struct . pack ( "B" , len (k )) + k
902
+ connect_attrs += _lenenc_int ( len (k )) + k
902
903
v = v .encode ("utf-8" )
903
- connect_attrs += struct . pack ( "B" , len (v )) + v
904
- data += struct . pack ( "B" , len (connect_attrs )) + connect_attrs
904
+ connect_attrs += _lenenc_int ( len (v )) + v
905
+ data += _lenenc_int ( len (connect_attrs )) + connect_attrs
905
906
906
907
self .write_packet (data )
907
908
auth_packet = self ._read_packet ()
You can’t perform that action at this time.
0 commit comments