diff options
| author | Heikki Linnakangas | 2017-05-08 08:26:07 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2017-05-08 08:26:07 +0000 |
| commit | eb61136dc75a76caef8460fa939244d8593100f2 (patch) | |
| tree | abaac9eb3b4c093a6a4aabd40dfb0ec23f1bc84a /src/bin/psql | |
| parent | 1f30295eab65eddaa88528876ab66e7095f4bb65 (diff) | |
Remove support for password_encryption='off' / 'plain'.
Storing passwords in plaintext hasn't been a good idea for a very long
time, if ever. Now seems like a good time to finally forbid it, since we're
messing with this in PostgreSQL 10 anyway.
Remove the CREATE/ALTER USER UNENCRYPTED PASSSWORD 'foo' syntax, since
storing passwords unencrypted is no longer supported. ENCRYPTED PASSWORD
'foo' is still accepted, but ENCRYPTED is now just a noise-word, it does
the same as just PASSWORD 'foo'.
Likewise, remove the --unencrypted option from createuser, but accept
--encrypted as a no-op for backward compatibility. AFAICS, --encrypted was
a no-op even before this patch, because createuser encrypted the password
before sending it to the server even if --encrypted was not specified. It
added the ENCRYPTED keyword to the SQL command, but since the password was
already in encrypted form, it didn't make any difference. The documentation
was not clear on whether that was intended or not, but it's moot now.
Also, while password_encryption='on' is still accepted as an alias for
'md5', it is now marked as hidden, so that it is not listed as an accepted
value in error hints, for example. That's not directly related to removing
'plain', but it seems better this way.
Reviewed by Michael Paquier
Discussion: https://www.postgresql.org/message-id/16e9b768-fd78-0b12-cfc1-7b6b7f238fde@iki.fi
Diffstat (limited to 'src/bin/psql')
| -rw-r--r-- | src/bin/psql/tab-complete.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index e2a3351210..183fc37629 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1634,10 +1634,10 @@ psql_completion(const char *text, int start, int end) { static const char *const list_ALTERUSER[] = {"BYPASSRLS", "CONNECTION LIMIT", "CREATEDB", "CREATEROLE", - "ENCRYPTED", "INHERIT", "LOGIN", "NOBYPASSRLS", + "ENCRYPTED PASSWORD", "INHERIT", "LOGIN", "NOBYPASSRLS", "NOCREATEDB", "NOCREATEROLE", "NOINHERIT", "NOLOGIN", "NOREPLICATION", "NOSUPERUSER", "PASSWORD", "RENAME TO", - "REPLICATION", "RESET", "SET", "SUPERUSER", "UNENCRYPTED", + "REPLICATION", "RESET", "SET", "SUPERUSER", "VALID UNTIL", "WITH", NULL}; COMPLETE_WITH_LIST(list_ALTERUSER); @@ -1649,18 +1649,15 @@ psql_completion(const char *text, int start, int end) /* Similar to the above, but don't complete "WITH" again. */ static const char *const list_ALTERUSER_WITH[] = {"BYPASSRLS", "CONNECTION LIMIT", "CREATEDB", "CREATEROLE", - "ENCRYPTED", "INHERIT", "LOGIN", "NOBYPASSRLS", + "ENCRYPTED PASSWORD", "INHERIT", "LOGIN", "NOBYPASSRLS", "NOCREATEDB", "NOCREATEROLE", "NOINHERIT", "NOLOGIN", "NOREPLICATION", "NOSUPERUSER", "PASSWORD", "RENAME TO", - "REPLICATION", "RESET", "SET", "SUPERUSER", "UNENCRYPTED", + "REPLICATION", "RESET", "SET", "SUPERUSER", "VALID UNTIL", NULL}; COMPLETE_WITH_LIST(list_ALTERUSER_WITH); } - /* complete ALTER USER,ROLE <name> ENCRYPTED,UNENCRYPTED with PASSWORD */ - else if (Matches4("ALTER", "USER|ROLE", MatchAny, "ENCRYPTED|UNENCRYPTED")) - COMPLETE_WITH_CONST("PASSWORD"); /* ALTER DEFAULT PRIVILEGES */ else if (Matches3("ALTER", "DEFAULT", "PRIVILEGES")) COMPLETE_WITH_LIST2("FOR ROLE", "IN SCHEMA"); @@ -2502,10 +2499,10 @@ psql_completion(const char *text, int start, int end) { static const char *const list_CREATEROLE[] = {"ADMIN", "BYPASSRLS", "CONNECTION LIMIT", "CREATEDB", "CREATEROLE", - "ENCRYPTED", "IN", "INHERIT", "LOGIN", "NOBYPASSRLS", + "ENCRYPTED PASSWORD", "IN", "INHERIT", "LOGIN", "NOBYPASSRLS", "NOCREATEDB", "NOCREATEROLE", "NOINHERIT", "NOLOGIN", "NOREPLICATION", "NOSUPERUSER", "PASSWORD", - "REPLICATION", "ROLE", "SUPERUSER", "SYSID", "UNENCRYPTED", + "REPLICATION", "ROLE", "SUPERUSER", "SYSID", "VALID UNTIL", "WITH", NULL}; COMPLETE_WITH_LIST(list_CREATEROLE); @@ -2517,21 +2514,15 @@ psql_completion(const char *text, int start, int end) /* Similar to the above, but don't complete "WITH" again. */ static const char *const list_CREATEROLE_WITH[] = {"ADMIN", "BYPASSRLS", "CONNECTION LIMIT", "CREATEDB", "CREATEROLE", - "ENCRYPTED", "IN", "INHERIT", "LOGIN", "NOBYPASSRLS", + "ENCRYPTED PASSWORD", "IN", "INHERIT", "LOGIN", "NOBYPASSRLS", "NOCREATEDB", "NOCREATEROLE", "NOINHERIT", "NOLOGIN", "NOREPLICATION", "NOSUPERUSER", "PASSWORD", - "REPLICATION", "ROLE", "SUPERUSER", "SYSID", "UNENCRYPTED", + "REPLICATION", "ROLE", "SUPERUSER", "SYSID", "VALID UNTIL", NULL}; COMPLETE_WITH_LIST(list_CREATEROLE_WITH); } - /* - * complete CREATE ROLE,USER,GROUP <name> ENCRYPTED,UNENCRYPTED with - * PASSWORD - */ - else if (Matches4("CREATE", "ROLE|USER|GROUP", MatchAny, "ENCRYPTED|UNENCRYPTED")) - COMPLETE_WITH_CONST("PASSWORD"); /* complete CREATE ROLE,USER,GROUP <name> IN with ROLE,GROUP */ else if (Matches4("CREATE", "ROLE|USER|GROUP", MatchAny, "IN")) COMPLETE_WITH_LIST2("GROUP", "ROLE"); |
