@@ -24,7 +24,6 @@ import (
2424 "crypto/sha1"
2525 "crypto/sha256"
2626 "crypto/subtle"
27- "crypto/x509"
2827 "encoding/hex"
2928 "net"
3029 "strings"
@@ -132,7 +131,7 @@ const (
132131// such a hash based on the salt and auth response provided here after retrieving
133132// the hashed password from the storage.
134133type HashStorage interface {
135- UserEntryWithHash (userCerts [] * x509. Certificate , salt []byte , user string , authResponse []byte , remoteAddr net.Addr ) (Getter , error )
134+ UserEntryWithHash (conn * Conn , salt []byte , user string , authResponse []byte , remoteAddr net.Addr ) (Getter , error )
136135}
137136
138137// PlainTextStorage describes an object that is suitable to retrieve user information
@@ -146,7 +145,7 @@ type HashStorage interface {
146145// When comparing plain text passwords directly, please ensure to use `subtle.ConstantTimeCompare`
147146// to prevent timing based attacks on the password.
148147type PlainTextStorage interface {
149- UserEntryWithPassword (userCerts [] * x509. Certificate , user string , password string , remoteAddr net.Addr ) (Getter , error )
148+ UserEntryWithPassword (conn * Conn , user string , password string , remoteAddr net.Addr ) (Getter , error )
150149}
151150
152151// CachingStorage describes an object that is suitable to retrieve user information
@@ -159,7 +158,7 @@ type PlainTextStorage interface {
159158// such a hash based on the salt and auth response provided here after retrieving
160159// the hashed password from the cache.
161160type CachingStorage interface {
162- UserEntryWithCacheHash (userCerts [] * x509. Certificate , salt []byte , user string , authResponse []byte , remoteAddr net.Addr ) (Getter , CacheState , error )
161+ UserEntryWithCacheHash (conn * Conn , salt []byte , user string , authResponse []byte , remoteAddr net.Addr ) (Getter , CacheState , error )
163162}
164163
165164// NewMysqlNativeAuthMethod will create a new AuthMethod that implements the
@@ -507,7 +506,7 @@ func (n *mysqlNativePasswordAuthMethod) HandleAuthPluginData(conn *Conn, user st
507506 return nil , NewSQLError (ERAccessDeniedError , SSAccessDeniedError , "Access denied for user '%v'" , user )
508507 }
509508 salt := serverAuthPluginData [:len (serverAuthPluginData )- 1 ]
510- return n .storage .UserEntryWithHash (conn . GetTLSClientCerts () , salt , user , clientAuthPluginData , remoteAddr )
509+ return n .storage .UserEntryWithHash (conn , salt , user , clientAuthPluginData , remoteAddr )
511510}
512511
513512type mysqlClearAuthMethod struct {
@@ -532,7 +531,7 @@ func (n *mysqlClearAuthMethod) HandleAuthPluginData(conn *Conn, user string, ser
532531 if len (clientAuthPluginData ) > 0 {
533532 password = string (clientAuthPluginData [:len (clientAuthPluginData )- 1 ])
534533 }
535- return n .storage .UserEntryWithPassword (conn . GetTLSClientCerts () , user , password , remoteAddr )
534+ return n .storage .UserEntryWithPassword (conn , user , password , remoteAddr )
536535}
537536
538537type mysqlDialogAuthMethod struct {
@@ -557,7 +556,7 @@ func (n *mysqlDialogAuthMethod) AuthPluginData() ([]byte, error) {
557556 return result , nil
558557}
559558func (n * mysqlDialogAuthMethod ) HandleAuthPluginData (conn * Conn , user string , serverAuthPluginData []byte , clientAuthPluginData []byte , remoteAddr net.Addr ) (Getter , error ) {
560- return n .storage .UserEntryWithPassword (conn . GetTLSClientCerts () , user , string (clientAuthPluginData [:len (clientAuthPluginData )- 1 ]), remoteAddr )
559+ return n .storage .UserEntryWithPassword (conn , user , string (clientAuthPluginData [:len (clientAuthPluginData )- 1 ]), remoteAddr )
561560}
562561
563562type mysqlCachingSha2AuthMethod struct {
@@ -594,7 +593,7 @@ func (n *mysqlCachingSha2AuthMethod) HandleAuthPluginData(c *Conn, user string,
594593 return nil , NewSQLError (ERAccessDeniedError , SSAccessDeniedError , "Access denied for user '%v'" , user )
595594 }
596595 salt := serverAuthPluginData [:len (serverAuthPluginData )- 1 ]
597- result , cacheState , err := n .cache .UserEntryWithCacheHash (c . GetTLSClientCerts () , salt , user , clientAuthPluginData , remoteAddr )
596+ result , cacheState , err := n .cache .UserEntryWithCacheHash (c , salt , user , clientAuthPluginData , remoteAddr )
598597 if err != nil {
599598 return nil , err
600599 }
@@ -638,7 +637,7 @@ func (n *mysqlCachingSha2AuthMethod) HandleAuthPluginData(c *Conn, user string,
638637 if err != nil {
639638 return nil , err
640639 }
641- return n .storage .UserEntryWithPassword (c . GetTLSClientCerts () , user , password , remoteAddr )
640+ return n .storage .UserEntryWithPassword (c , user , password , remoteAddr )
642641}
643642
644643// ScrambleMysqlNativePassword computes the hash of the password using 4.1+ method.
0 commit comments