postgresql/src/include
Tom Lane a2944d8724 Fix missed corner cases for grantable permissions on GUCs.
We allow users to set the values of not-yet-loaded extension GUCs,
remembering those values in "placeholder" GUC entries.  When/if
the extension is loaded later in the session, we need to verify that
the user had permissions to set the GUC.  That was done correctly
before commit a0ffa885e, but as of that commit, we'd check the
permissions of the active role when the LOAD happens, not the role
that had set the value.  (This'd be a security bug if it had made it
into a released version.)

In principle this is simple enough to fix: we just need to remember
the exact role OID that set each GUC value, and use that not
GetUserID() when verifying permissions.  Maintaining that data in
the guc.c data structures is slightly tedious, but fortunately it's
all basically just copy-n-paste of the logic for tracking the
GucSource of each setting, as we were already doing.

Another oversight is that validate_option_array_item() hadn't
been taught to check for granted GUC privileges.  This appears
to manifest only in that ALTER ROLE/DATABASE RESET ALL will
fail to reset settings that the user should be allowed to reset.

Patch by myself and Nathan Bossart, per report from Nathan Bossart.
Back-patch to v15 where the faulty code came in.

Discussion: https://postgr.es/m/20220706224727.GA2158260@nathanxps13
2022-07-19 17:22:31 -04:00
..
access Overload index_form_tuple to allow the memory context to be supplied 2022-07-07 08:14:32 +12:00
bootstrap Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
catalog Rename pg_checkpointer predefined role to pg_checkpoint. 2022-07-05 13:31:55 -04:00
commands Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
common Remove PGDLLIMPORT marker from __pg_log_level 2022-05-13 09:39:13 +09:00
datatype Fix overflow hazards in interval input and output conversions. 2022-04-02 16:12:29 -04:00
executor Remove size increase in ExprEvalStep caused by hashed saops 2022-07-06 19:41:09 +12:00
fe_utils Allow db.schema.table patterns, but complain about random garbage. 2022-04-20 11:37:29 -04:00
foreign Update copyright for 2022 2022-01-07 19:04:57 -05:00
jit Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
lib Improve frontend error logging style. 2022-04-08 14:55:14 -04:00
libpq Add some missing PGDLLIMPORT markings 2022-05-12 15:08:45 +09:00
mb Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
nodes Tidy up code in get_cheapest_group_keys_order() 2022-07-13 14:03:24 +12:00
optimizer Fix inconsistent parameter names between prototype and declaration 2022-07-15 15:27:14 +12:00
parser Make STRING an unreserved_keyword. 2022-05-30 14:05:20 -04:00
partitioning Refactor and cleanup runtime partition prune code a little 2022-04-05 11:46:48 +02:00
port windows: msvc: Define STDIN/OUT/ERR_FILENO. 2022-07-18 17:22:35 -07:00
portability Update copyright for 2022 2022-01-07 19:04:57 -05:00
postmaster Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
regex Update copyright for 2022 2022-01-07 19:04:57 -05:00
replication Fix data inconsistency between publisher and subscriber. 2022-06-16 08:45:07 +05:30
rewrite Update copyright for 2022 2022-01-07 19:04:57 -05:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Add stxdinherit flag to pg_statistic_ext_data 2022-01-16 13:38:01 +01:00
storage Fix lock assertions in dshash.c. 2022-07-11 16:01:22 +12:00
tcop Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
tsearch Add missing 'extern' to function prototypes. 2022-05-12 12:39:33 -07:00
utils Fix missed corner cases for grantable permissions on GUCs. 2022-07-19 17:22:31 -04:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
fmgr.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
funcapi.h Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
getaddrinfo.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
getopt_long.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
Makefile Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
miscadmin.h Add a new shmem_request_hook hook. 2022-05-13 09:31:06 -04:00
pg_config.h.in Simplify configure test 2022-05-04 14:20:36 +02:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Fix old-fd issues using global barriers everywhere. 2022-05-07 16:47:29 +12:00
pg_getopt.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pg_trace.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgstat.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pgtar.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgtime.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
port.h Invent qsort_interruptible(). 2022-07-12 16:30:36 -04:00
postgres.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
rusagestub.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
windowapi.h Update copyright for 2022 2022-01-07 19:04:57 -05:00