pgsql: Remove arbitrary restrictions on password length.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Remove arbitrary restrictions on password length.
Дата
Msg-id E1kDzIS-0003OC-10@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Remove arbitrary restrictions on password length.

This patch started out with the goal of harmonizing various arbitrary
limits on password length, but after awhile a better idea emerged:
let's just get rid of those fixed limits.

recv_password_packet() has an arbitrary limit on the packet size,
which we don't really need, so just drop it.  (Note that this doesn't
really affect anything for MD5 or SCRAM password verification, since
those will hash the user's password to something shorter anyway.
It does matter for auth methods that require a cleartext password.)

Likewise remove the arbitrary error condition in pg_saslprep().

The remaining limits are mostly in client-side code that prompts
for passwords.  To improve those, refactor simple_prompt() so that
it allocates its own result buffer that can be made as big as
necessary.  Actually, it proves best to make a separate routine
pg_get_line() that has essentially the semantics of fgets(), except
that it allocates a suitable result buffer and hence will never
return a truncated line.  (pg_get_line has a lot of potential
applications to replace randomly-sized fgets buffers elsewhere,
but I'll leave that for another patch.)

I built pg_get_line() atop stringinfo.c, which requires moving
that code to src/common/; but that seems fine since it was a poor
fit for src/port/ anyway.

This patch is mostly mine, but it owes a good deal to Nathan Bossart
who pressed for a solution to the password length problem and
created a predecessor patch.  Also thanks to Peter Eisentraut and
Stephen Frost for ideas and discussion.

Discussion: https://postgr.es/m/09512C4F-8CB9-4021-B455-EF4C4F0D55A0@amazon.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/67a472d71c98c3d2fa322a1b4013080b20720b98

Modified Files
--------------
contrib/oid2name/oid2name.c        | 11 +++--
contrib/vacuumlo/vacuumlo.c        | 18 ++++----
src/backend/libpq/auth.c           |  2 +-
src/bin/initdb/initdb.c            | 21 +++++-----
src/bin/pg_basebackup/streamutil.c | 13 +++---
src/bin/pg_dump/pg_backup_db.c     | 28 ++++++-------
src/bin/pg_dump/pg_dumpall.c       | 18 ++++----
src/bin/pgbench/pgbench.c          | 11 +++--
src/bin/psql/command.c             | 22 +++++-----
src/bin/psql/startup.c             | 14 +++----
src/bin/scripts/common.c           | 34 +++++++++------
src/bin/scripts/createuser.c       | 18 ++++----
src/bin/scripts/dropuser.c         |  6 +--
src/common/Makefile                |  4 +-
src/common/pg_get_line.c           | 85 ++++++++++++++++++++++++++++++++++++++
src/common/saslprep.c              | 18 --------
src/{port => common}/sprompt.c     | 45 +++++++-------------
src/include/common/string.h        |  7 ++++
src/include/port.h                 |  4 --
src/port/Makefile                  |  3 +-
src/tools/msvc/Mkvcbuild.pm        |  6 +--
21 files changed, 221 insertions(+), 167 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Avoid lockup of a parallel worker when reporting a long error me
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: Remove variable "concurrent" from ReindexStmt