Преглед на файлове

End handshake work, begin listening work.

Josh Brickner преди 7 години
родител
ревизия
9fd26f06ef
променени са 3 файла, в които са добавени 6 реда и са изтрити 14 реда
  1. 4 2
      binlog/authentication.go
  2. 0 10
      binlog/connection.go
  3. 2 2
      docker-compose.yaml

+ 4 - 2
binlog/authentication.go

@@ -4,7 +4,6 @@ import (
 	"bytes"
 	"crypto/sha1"
 	"crypto/sha256"
-	"fmt"
 )
 
 type AuthResponsePacket struct {
@@ -52,7 +51,6 @@ func (c *Conn) authenticate(salt []byte, password []byte) {
 	case "mysql_native_password":
 		ar = c.nativeSha1Auth(salt, password)
 	case "caching_sha2_password":
-		fmt.Println(len(salt))
 		ar = c.cachingSha2Auth(salt, password)
 	}
 
@@ -70,6 +68,10 @@ func (c *Conn) authenticate(salt []byte, password []byte) {
 }
 
 func (c *Conn) nativeSha1Auth(salt []byte, password []byte) []byte {
+	if len(password) < 1 {
+		return nil
+	}
+
 	pHash := c.sha1Hash(password)
 	pHashHash := c.sha1Hash(pHash)
 	spHash := c.sha1Hash(append(salt, pHashHash...))

+ 0 - 10
binlog/connection.go

@@ -132,16 +132,6 @@ func (d Driver) Open(dsn string) (driver.Conn, error) {
 		return nil, err
 	}
 
-	// _, err = c.decodeAuthResponsePacket()
-	// if err != nil {
-	// 	return nil, err
-	// }
-
-	// 	err = c.writeAuthSwitchPacket(packet)
-	// 	if err != nil {
-	// 		return nil, err
-	// 	}
-
 	return c, err
 }
 

+ 2 - 2
docker-compose.yaml

@@ -6,7 +6,7 @@ services:
       MYSQL_ROOT_PASSWORD: root
       MYSQL_DATABASE: root
     ports:
-      - "3316:3306"
+      - "3317:3306"
     command: "--default-authentication-plugin=mysql_native_password"
     restart: always
   mysql56:
@@ -15,6 +15,6 @@ services:
       MYSQL_ROOT_PASSWORD: root
       MYSQL_DATABASE: root
     ports:
-      - "3317:3306"
+      - "3316:3306"
     command: "--default-authentication-plugin=mysql_native_password"
     restart: always