diff options
author | Noah Misch <noah@leadboat.com> | 2017-05-08 07:24:24 -0700 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2017-05-08 07:24:24 -0700 |
commit | 3eefc51053f250837c3115c12f8119d16881a2d7 (patch) | |
tree | c626dd3c72e3c47364a9b2e615030ddb1b89b4b8 /src/backend | |
parent | 0170b10dff04e0f50f5522c377a4d10d4424155c (diff) | |
download | postgresql-3eefc51053f250837c3115c12f8119d16881a2d7.tar.gz postgresql-3eefc51053f250837c3115c12f8119d16881a2d7.zip |
Match pg_user_mappings limits to information_schema.user_mapping_options.
Both views replace the umoptions field with NULL when the user does not
meet qualifications to see it. They used different qualifications, and
pg_user_mappings documented qualifications did not match its implemented
qualifications. Make its documentation and implementation match those
of user_mapping_options. One might argue for stronger qualifications,
but these have long, documented tenure. pg_user_mappings has always
exhibited this problem, so back-patch to 9.2 (all supported versions).
Michael Paquier and Feike Steenbergen. Reviewed by Jeff Janes.
Reported by Andrew Wheelwright.
Security: CVE-2017-7486
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/catalog/system_views.sql | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 421d51db471..5cd176bc38e 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -910,11 +910,11 @@ CREATE VIEW pg_user_mappings AS ELSE A.rolname END AS usename, - CASE WHEN pg_has_role(S.srvowner, 'USAGE') OR has_server_privilege(S.oid, 'USAGE') THEN - U.umoptions - ELSE - NULL - END AS umoptions + CASE WHEN (U.umuser <> 0 AND A.rolname = current_user) + OR (U.umuser = 0 AND pg_has_role(S.srvowner, 'USAGE')) + OR (SELECT rolsuper FROM pg_authid WHERE rolname = current_user) + THEN U.umoptions + ELSE NULL END AS umoptions FROM pg_user_mapping U JOIN pg_foreign_server S ON (U.umserver = S.oid) LEFT JOIN pg_authid A ON (A.oid = U.umuser); |