good morning!!!!

Skip to content
Snippets Groups Projects
Commit 4aa6a5dc authored by Garet Halliday's avatar Garet Halliday
Browse files

thinking

parent e2499aa5
No related branches found
No related tags found
No related merge requests found
package backends
import (
"log"
"errors"
"net"
"pggat2/lib/backend"
......@@ -47,7 +47,40 @@ func (T *Server) accept() error {
return err
}
log.Printf("%#v", auth)
reader := packet.MakeReader(auth)
switch reader.Type() {
case packet.Authentication:
method, ok := reader.Int32()
if !ok {
return errors.New("expected authentication method")
}
// they have more authentication methods than there are pokemon
switch method {
case 0:
// we're good to go, that was easy
case 2:
return errors.New("kerberos v5 is not supported")
case 3:
return errors.New("cleartext is not supported")
case 5:
return errors.New("md5 password is not supported")
case 6:
return errors.New("scm credential is not supported")
case 7:
return errors.New("gss is not supported")
case 9:
return errors.New("sspi is not supported")
case 10:
return errors.New("sasl is not supported")
default:
return errors.New("unknown authentication method")
}
case packet.ErrorResponse:
return errors.New("backend errored")
case packet.NegotiateProtocolVersion:
// we only support 3.0 as of now
return errors.New("unsupported protocol version")
}
return nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment