From: Peter Eisentraut Date: Sun, 11 Aug 2019 19:51:25 +0000 (+0200) Subject: Add tests for taking password from auth_file X-Git-Tag: pgbouncer_1_11_0~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4b46f461a70f3fcde0baac214b8ad63ebad36ce;p=pgbouncer Add tests for taking password from auth_file --- diff --git a/doc/config.md b/doc/config.md index 1d06bec..534723b 100644 --- a/doc/config.md +++ b/doc/config.md @@ -795,7 +795,7 @@ Default: not set, meaning to use a Unix socket. Default: 5432 -### user, password +### user If `user=` is set, all connections to the destination database will be done with the specified user, meaning that there will be only one pool @@ -804,8 +804,13 @@ for this database. Otherwise PgBouncer tries to log into the destination database with client username, meaning that there will be one pool per user. +### password + The length for `password` is limited to 128 characters maximum. +If no password is specified here, the password from the `auth_file` or +`auth_query` will be used. + ### auth_user Override of the global `auth_user` setting, if specified. diff --git a/test/test.ini b/test/test.ini index 5659243..0f22aaa 100644 --- a/test/test.ini +++ b/test/test.ini @@ -2,10 +2,14 @@ p0 = port=6666 host=127.0.0.1 dbname=p0 user=bouncer pool_size=2 p1 = port=6666 host=127.0.0.1 dbname=p1 user=bouncer p3 = port=6666 host=127.0.0.1 dbname=p0 user=bouncer pool_mode=session -p4 = port=6666 host=127.0.0.1 dbname=p4 user=muser1 password=foo -p4x= port=6666 host=127.0.0.1 dbname=p4 user=muser1 password=wrong +p4 = port=6666 host=127.0.0.1 dbname=p4 user=puser1 password=foo +p4x= port=6666 host=127.0.0.1 dbname=p4 user=puser1 password=wrong +p4y= port=6666 host=127.0.0.1 dbname=p4 user=puser1 +p4z= port=6666 host=127.0.0.1 dbname=p4 user=puser2 p5 = port=6666 host=127.0.0.1 dbname=p5 user=muser1 password=foo p5x= port=6666 host=127.0.0.1 dbname=p5 user=muser1 password=wrong +p5y= port=6666 host=127.0.0.1 dbname=p5 user=muser1 +p5z= port=6666 host=127.0.0.1 dbname=p5 user=muser2 authdb = port=6666 host=127.0.0.1 dbname=p1 auth_user=pswcheck diff --git a/test/test.sh b/test/test.sh index 2fae0de..7af9aa5 100755 --- a/test/test.sh +++ b/test/test.sh @@ -112,6 +112,9 @@ psql -X -p $PG_PORT -d p0 -c "select * from pg_user" | grep pswcheck > /dev/null psql -X -o /dev/null -p $PG_PORT -c "create user pswcheck with superuser createdb password 'pgbouncer-check';" p0 || exit 1 psql -X -o /dev/null -p $PG_PORT -c "create user someuser with password 'anypasswd';" p0 || exit 1 psql -X -o /dev/null -p $PG_PORT -c "create user muser1 password 'foo';" p0 || exit 1 + psql -X -o /dev/null -p $PG_PORT -c "create user muser2 password 'wrong';" p0 || exit 1 + psql -X -o /dev/null -p $PG_PORT -c "create user puser1 password 'foo';" p0 || exit 1 + psql -X -o /dev/null -p $PG_PORT -c "create user puser2 password 'wrong';" p0 || exit 1 } echo "Starting bouncer" @@ -595,11 +598,16 @@ test_auth_user() { test_password_server() { admin "set auth_type='trust'" - # good password + # good password from ini psql -X -c "select 1" p4 || return 1 - # bad password + # bad password from ini psql -X -c "select 2" p4x && return 1 + # good password from auth_file + psql -X -c "select 1" p4y || return 1 + # bad password from auth_file + psql -X -c "select 1" p4z && return 1 + return 0 } @@ -630,11 +638,16 @@ test_password_client() { test_md5_server() { admin "set auth_type='trust'" - # good password + # good password from ini psql -X -c "select 1" p5 || return 1 - # bad password + # bad password from ini psql -X -c "select 2" p5x && return 1 + # good password from auth_file + psql -X -c "select 1" p5y || return 1 + # bad password from auth_file + psql -X -c "select 1" p5z && return 1 + return 0 }