2
0

Remove code moved to pgconn

This commit is contained in:
Jack Christensen
2018-12-31 17:52:11 -06:00
parent 378ccb8945
commit af2fc36c27
-23
View File
@@ -2,10 +2,8 @@ package pgx
import ( import (
"context" "context"
"crypto/md5"
"crypto/tls" "crypto/tls"
"encoding/binary" "encoding/binary"
"encoding/hex"
"io" "io"
"net" "net"
"reflect" "reflect"
@@ -901,27 +899,6 @@ func (c *Conn) rxMsg() (pgproto3.BackendMessage, error) {
return msg, nil return msg, nil
} }
func (c *Conn) rxAuthenticationX(msg *pgproto3.Authentication) (err error) {
switch msg.Type {
case pgproto3.AuthTypeOk:
case pgproto3.AuthTypeCleartextPassword:
err = c.txPasswordMessage(c.pgConn.Config.Password)
case pgproto3.AuthTypeMD5Password:
digestedPassword := "md5" + hexMD5(hexMD5(c.pgConn.Config.Password+c.pgConn.Config.User)+string(msg.Salt[:]))
err = c.txPasswordMessage(digestedPassword)
default:
err = errors.New("Received unknown authentication message")
}
return
}
func hexMD5(s string) string {
hash := md5.New()
io.WriteString(hash, s)
return hex.EncodeToString(hash.Sum(nil))
}
func (c *Conn) rxErrorResponse(msg *pgproto3.ErrorResponse) *pgconn.PgError { func (c *Conn) rxErrorResponse(msg *pgproto3.ErrorResponse) *pgconn.PgError {
err := &pgconn.PgError{ err := &pgconn.PgError{
Severity: msg.Severity, Severity: msg.Severity,