Merge branch '2.3' into 2.4

This commit is contained in:
Esa Korhonen
2019-08-14 17:40:30 +03:00

View File

@ -211,15 +211,34 @@ bool PamBackendSession::extract(DCB* dcb, GWBUF* buffer)
switch (m_state) switch (m_state)
{ {
case State::INIT: case State::INIT:
// Server should have sent the AuthSwitchRequest + 1st prompt // Server should have sent the AuthSwitchRequest. If server version is 10.4, the server may not
if (parse_authswitchreq(&data_ptr, end_ptr) // send a prompt. Older versions add the first prompt to the same packet.
&& parse_password_prompt(&data_ptr, end_ptr)) if (parse_authswitchreq(&data_ptr, end_ptr))
{ {
m_state = State::RECEIVED_PROMPT; if (end_ptr > data_ptr)
success = true; {
if (parse_password_prompt(&data_ptr, end_ptr))
{
m_state = State::RECEIVED_PROMPT;
success = true;
}
else
{
// Password prompt should have been there, but was not.
unexpected_data = true;
}
}
else
{
// Just the AuthSwitchRequest, this is ok. The server now expects a password so set state
// accordingly.
m_state = State::RECEIVED_PROMPT;
success = true;
}
} }
else else
{ {
// No AuthSwitchRequest, error.
unexpected_data = true; unexpected_data = true;
} }
break; break;