diff --git a/pgcat.toml b/pgcat.toml index ae5d74dc..654f5e89 100644 --- a/pgcat.toml +++ b/pgcat.toml @@ -187,7 +187,7 @@ sharding_function = "pg_bigint_hash" # Query to be sent to servers to obtain the hash used for md5 authentication. The connection will be # established using the database configured in the pool. This parameter is inherited by every pool # and can be redefined in pool configuration. -# auth_query = "SELECT $1" +# auth_query="SELECT usename, passwd FROM pg_shadow WHERE usename='$1'" # User to be used for connecting to servers to obtain the hash used for md5 authentication by sending the query # specified in `auth_query_user`. The connection will be established using the database configured in the pool. diff --git a/src/client.rs b/src/client.rs index 8ad0d47b..8edecea1 100644 --- a/src/client.rs +++ b/src/client.rs @@ -117,7 +117,15 @@ pub async fn client_entrypoint( log_client_connections: bool, ) -> Result<(), Error> { // Figure out if the client wants TLS or not. - let addr = stream.peer_addr().unwrap(); + let addr = match stream.peer_addr() { + Ok(addr) => addr, + Err(err) => { + return Err(Error::SocketError(format!( + "Failed to get peer address: {:?}", + err + ))); + } + }; match get_startup::(&mut stream).await { // Client requested a TLS connection.