From 93a6be63a55a8cd0d73b3fa81eb6a46013a3a974 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 20 Jan 2009 09:10:20 +0000 Subject: Revise the permission checking on user mapping DDL commands. CREATE/ALTER/DROP USER MAPPING are now allowed either by the server owner or by a user with USAGE privileges for his own user name. This is more or less what the SQL standard wants anyway (plus "implementation-defined") Hide information_schema.user_mapping_options.option_value, unless the current user is the one associated with the user mapping, or is the server owner and the mapping is for PUBLIC, or is a superuser. This is to protect passwords. Also, fix a bug in information_schema._pg_foreign_servers, which hid servers using wrappers where the current user did not have privileges on the wrapper. The correct behavior is to hide servers where the current user has no privileges on the server. --- doc/src/sgml/information_schema.sgml | 9 +++++++-- doc/src/sgml/ref/alter_user_mapping.sgml | 11 ++++++++--- doc/src/sgml/ref/create_user_mapping.sgml | 11 ++++++++--- doc/src/sgml/ref/drop_user_mapping.sgml | 12 +++++++++--- 4 files changed, 32 insertions(+), 11 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index f645c1252d6..96cbf1f12ad 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -1,4 +1,4 @@ - + The Information Schema @@ -5081,7 +5081,12 @@ ORDER BY c.ordinal_position; option_value character_data - Value of the option + Value of the option. This column will show as null + unless the current user is the user being mapped, or the mapping + is for PUBLIC and the current user is the + server owner, or the current user is a superuser. The intent is + to protect password information stored as user mapping + option. diff --git a/doc/src/sgml/ref/alter_user_mapping.sgml b/doc/src/sgml/ref/alter_user_mapping.sgml index 38bff39ece7..fef968a32e1 100644 --- a/doc/src/sgml/ref/alter_user_mapping.sgml +++ b/doc/src/sgml/ref/alter_user_mapping.sgml @@ -1,5 +1,5 @@ @@ -31,10 +31,15 @@ ALTER USER MAPPING FOR { username | ALTER USER MAPPING changes the definition of a - user mapping. Only the owner of the server can change the user - mappings of that server. + user mapping. + + The owner of a foreign server can alter user mappings for that + server for any user. Also, a user can alter a user mapping for + his own user name if USAGE privilege on the server has + been granted to the user. + diff --git a/doc/src/sgml/ref/create_user_mapping.sgml b/doc/src/sgml/ref/create_user_mapping.sgml index b0589817492..6857b3eb7e9 100644 --- a/doc/src/sgml/ref/create_user_mapping.sgml +++ b/doc/src/sgml/ref/create_user_mapping.sgml @@ -1,5 +1,5 @@ @@ -31,10 +31,15 @@ CREATE USER MAPPING FOR { username CREATE USER MAPPING defines a mapping of a user - to a foreign server. You must be the owner of the server to define - user mappings for it. + to a foreign server. + + The owner of a foreign server can create user mappings for that + server for any user. Also, a user can create a user mapping for + his own user name if USAGE privilege on the server has + been granted to the user. + diff --git a/doc/src/sgml/ref/drop_user_mapping.sgml b/doc/src/sgml/ref/drop_user_mapping.sgml index c22dedb661a..82d5fa5dcb1 100644 --- a/doc/src/sgml/ref/drop_user_mapping.sgml +++ b/doc/src/sgml/ref/drop_user_mapping.sgml @@ -1,5 +1,5 @@ @@ -29,8 +29,14 @@ DROP USER MAPPING [ IF EXISTS ] FOR { username DROP USER MAPPING removes an existing user - mapping from foreign server. To execute this command, the current - user must be the owner of the server containing the mapping. + mapping from foreign server. + + + + The owner of a foreign server can drop user mappings for that server + for any user. Also, a user can drop a user mapping for his own + user name if USAGE privilege on the server has been + granted to the user. -- cgit v1.2.3