From dfdf3e68bc65fdec70cc5f4ce68fb72a45a31c6a Mon Sep 17 00:00:00 2001 From: Jon Tirsen Date: Thu, 15 Dec 2022 16:05:37 +0100 Subject: [PATCH] Support "mysql_clear_password" auth plugin This is required to connect with Amazon RDS MySQL databases that only supports clear password over TLS. --- client/auth.go | 2 ++ mysql/const.go | 1 + 2 files changed, 3 insertions(+) diff --git a/client/auth.go b/client/auth.go index a9fd48099..eb2db6eb9 100644 --- a/client/auth.go +++ b/client/auth.go @@ -120,6 +120,8 @@ func (c *Conn) genAuthResponse(authData []byte) ([]byte, bool, error) { return CalcPassword(authData[:20], []byte(c.password)), false, nil case AUTH_CACHING_SHA2_PASSWORD: return CalcCachingSha2Password(authData, c.password), false, nil + case AUTH_CLEAR_PASSWORD: + return []byte(c.password), true, nil case AUTH_SHA256_PASSWORD: if len(c.password) == 0 { return nil, true, nil diff --git a/mysql/const.go b/mysql/const.go index 9721cf8ee..e2f3a0afe 100644 --- a/mysql/const.go +++ b/mysql/const.go @@ -20,6 +20,7 @@ const ( const ( AUTH_MYSQL_OLD_PASSWORD = "mysql_old_password" AUTH_NATIVE_PASSWORD = "mysql_native_password" + AUTH_CLEAR_PASSWORD = "mysql_clear_password" AUTH_CACHING_SHA2_PASSWORD = "caching_sha2_password" AUTH_SHA256_PASSWORD = "sha256_password" )