Skip to content

Commit e78fff0

Browse files
theniksojulienschmidt
authored andcommitted
Fixed old_password authentication cipher removal
1 parent b03abe2 commit e78fff0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packets.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ func (mc *mysqlConn) writeAuthPacket() error {
226226

227227
// User Password
228228
scrambleBuff := scramblePassword(mc.cipher, []byte(mc.cfg.passwd))
229-
mc.cipher = nil
230229

231230
pktLen := 4 + 4 + 1 + 23 + len(mc.cfg.user) + 1 + 1 + len(scrambleBuff)
232231

@@ -409,6 +408,8 @@ func (mc *mysqlConn) readResultOK() error {
409408
switch data[0] {
410409

411410
case iOK:
411+
// Remove the chipher in case of successfull authentication
412+
mc.cipher = nil
412413
return mc.handleOkPacket(data)
413414

414415
case iEOF:

0 commit comments

Comments
 (0)