瀏覽代碼

Fixed old_password authentication cipher removal

Nicola Peduzzi 12 年之前
父節點
當前提交
e78fff054d
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      packets.go

+ 2 - 1
packets.go

@@ -226,7 +226,6 @@ func (mc *mysqlConn) writeAuthPacket() error {
 
 	// User Password
 	scrambleBuff := scramblePassword(mc.cipher, []byte(mc.cfg.passwd))
-	mc.cipher = nil
 
 	pktLen := 4 + 4 + 1 + 23 + len(mc.cfg.user) + 1 + 1 + len(scrambleBuff)
 
@@ -409,6 +408,8 @@ func (mc *mysqlConn) readResultOK() error {
 		switch data[0] {
 
 		case iOK:
+			// Remove the chipher in case of successfull authentication
+			mc.cipher = nil
 			return mc.handleOkPacket(data)
 
 		case iEOF: