Skip to content

Commit

Permalink
Support Azure's non-mutable use of cleartext passwords over TLS
Browse files Browse the repository at this point in the history
NOTE: Only allow cleartext when using an ssl connection though
  • Loading branch information
Chris Fortescue committed Dec 16, 2020
1 parent cafeaf6 commit 4a78fef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pq/connection.cr
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ module PQ
when Frame::Authentication::Type::OK
# no op
when Frame::Authentication::Type::CleartextPassword
raise "Cleartext auth is not supported"
raise "Cleartext auth over unencrypted connection is not supported" if !@soc.is_a?(OpenSSL::SSL::Socket::Client)
handle_auth_cleartext auth_frame.body
when Frame::Authentication::Type::SASL
handle_auth_sasl auth_frame.body
when Frame::Authentication::Type::MD5Password
Expand Down Expand Up @@ -356,6 +357,11 @@ module PQ
expect_frame Frame::Authentication
end

private def handle_auth_cleartext(body)
send_password_message @conninfo.password
expect_frame Frame::Authentication
end

def read_next_row_start
type = soc.read_char

Expand Down

0 comments on commit 4a78fef

Please sign in to comment.