From 3bb8c17c5771444becc68cbc8cc75618c707d51f Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Mon, 10 Jun 2019 22:07:47 -0700 Subject: [PATCH] Support sending passwords in cleartext --- mason-postgres/src/connection.rs | 4 ++++ mason-postgres/src/protocol/server.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/mason-postgres/src/connection.rs b/mason-postgres/src/connection.rs index 23e4dc93..3c8cf362 100644 --- a/mason-postgres/src/connection.rs +++ b/mason-postgres/src/connection.rs @@ -78,6 +78,10 @@ impl Connection { // there is no password needed } + ServerMessage::AuthenticationCleartextPassword => { + conn.send(PasswordMessage { password: options.password.unwrap_or_default() }).await?; + } + ServerMessage::AuthenticationMd5Password(body) => { // Hash password|username // FIXME: ConnectOptions should prepare a default user diff --git a/mason-postgres/src/protocol/server.rs b/mason-postgres/src/protocol/server.rs index adda14ff..d0f9344d 100644 --- a/mason-postgres/src/protocol/server.rs +++ b/mason-postgres/src/protocol/server.rs @@ -76,6 +76,7 @@ impl Message { b'R' => match BigEndian::read_i32(&buf[idx..]) { 0 => Message::AuthenticationOk, + 3 => Message::AuthenticationCleartextPassword, 5 => Message::AuthenticationMd5Password(AuthenticationMd5Password { salt: buf.slice_from(idx + 4), }),