Skip to content

Commit a5bb807

Browse files
Fix sha256_password auth plugin on unix transport (go-sql-driver#1246)
caching_sha2_password uses cleartext password when the connection is Unix or sharedmemory protocol. but sha256_password do not.
1 parent e8f8fcd commit a5bb807

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Reed Allman <rdallman10 at gmail.com>
8282
Richard Wilkes <wilkes at me.com>
8383
Robert Russell <robert at rrbrussell.com>
8484
Runrioter Wung <runrioter at gmail.com>
85+
Santhosh Kumar Tekuri <santhosh.tekuri at gmail.com>
8586
Sho Iizuka <sho.i518 at gmail.com>
8687
Sho Ikeda <suicaicoca at gmail.com>
8788
Shuode Li <elemount at qq.com>

auth.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ func (mc *mysqlConn) auth(authData []byte, plugin string) ([]byte, error) {
274274
if len(mc.cfg.Passwd) == 0 {
275275
return []byte{0}, nil
276276
}
277-
if mc.cfg.tls != nil || mc.cfg.Net == "unix" {
277+
// unlike caching_sha2_password, sha256_password does not accept
278+
// cleartext password on unix transport.
279+
if mc.cfg.tls != nil {
278280
// write cleartext auth packet
279281
return append([]byte(mc.cfg.Passwd), 0), nil
280282
}

0 commit comments

Comments
 (0)