git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: be4b0c0) | patch
Remove arbitrary restrictions on password length.
Fri, 4 Sep 2020 00:09:18 +0000 (20:09 -0400)
Fri, 4 Sep 2020 00:09:18 +0000 (20:09 -0400)
commit 67a472d71c98c3d2fa322a1b4013080b20720b98
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
21 files changed:
contrib/oid2name/oid2name.c diff | blob | blame | history
contrib/vacuumlo/vacuumlo.c diff | blob | blame | history
src/backend/libpq/auth.c diff | blob | blame | history
src/bin/initdb/initdb.c diff | blob | blame | history
src/bin/pg_basebackup/streamutil.c diff | blob | blame | history
src/bin/pg_dump/pg_backup_db.c diff | blob | blame | history
src/bin/pg_dump/pg_dumpall.c diff | blob | blame | history
src/bin/pgbench/pgbench.c diff | blob | blame | history
src/bin/psql/command.c diff | blob | blame | history
src/bin/psql/startup.c diff | blob | blame | history
src/bin/scripts/common.c diff | blob | blame | history
src/bin/scripts/createuser.c diff | blob | blame | history
src/bin/scripts/dropuser.c diff | blob | blame | history
src/common/Makefile diff | blob | blame | history
src/common/pg_get_line.c [new file with mode: 0644] blob
src/common/saslprep.c diff | blob | blame | history
src/common/sprompt.c [moved from src/port/sprompt.c with 81% similarity] diff | blob | blame | history
src/include/common/string.h diff | blob | blame | history
src/include/port.h diff | blob | blame | history
src/port/Makefile diff | blob | blame | history
src/tools/msvc/Mkvcbuild.pm diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /