Commit Graph

5 Commits (175856ffd3c8377db2e631b99ef7a7c996fdae77)

Author SHA1 Message Date
Yuli Khodorkovskiy 7c9e840726 Add support for identifying authentication messages
The pgprotocol overloads 'p' messages with PasswordMessage,
SASLInitialResponse, SASLResponse, and GSSResponse. This patch allows
contextual identification of the message by setting the authType in the
frontend and then setting this value in the backend when a
AuthenticationResponseMessage is received.
2021-06-12 13:54:34 -05:00
Yuli Khodorkovskiy 28c20e93c0 Fix json marshal/unmarshal implementations
Fix marshal/unmarshal for:
- authentication_{cleartext_password, md5_password, ok, sasl, sasl_continue, sasl_final}
- error_response
2021-05-29 11:06:05 -05:00
Henrique Vicente ba924e5715 json: Implement json.Unmarshaler for messages.
This will allow using pgmockproxy output as ingestion data for pgmock.
2021-05-22 11:34:25 -05:00
Yuli Khodorkovskiy 1c20e7d36e Fix malformed SASL messages
Per the PG documentation [0], an AuthenticationSASLContinue message has:

    AuthenticationSASLContinue (B)
	Byte1('R')
	    Identifies the message as an authentication request.
	Int32
	    Length of message contents in bytes, including self.
	Int32(11)
	    Specifies that this message contains a SASL challenge.
	Byten
	    SASL data, specific to the SASL mechanism being used.

The current implementation was mistakenly adding the lengh of msg bytes
in between the Int32(11) and Byten. There was a similar issue for
AuthenticationSASLFinal.

[0] https://www.postgresql.org/docs/current/protocol-message-formats.html
2019-12-17 20:28:01 -05:00
Jack Christensen 0d1ceed7a6 Refactor authentication message handling 2019-08-31 15:43:07 -05:00