pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove arbitrary restrictions on password length.
Date: Fri, 04 Sep 2020 00:09:40 +0000
Message-ID: <E1kDzIS-0003OC-10@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1kDzIS-0003OC-10@gemulon.postgresql.org>
Permalink:  ../E1kDzIS-0003OC-10@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kDzIS-0003OC-10@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Remove arbitrary restrictions on password length.
  In-Reply-To: <E1kDzIS-0003OC-10@gemulon.postgresql.org>
  References: <E1kDzIS-0003OC-10@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox