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
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
postmaster Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
regex
replication Fix data inconsistency between publisher and subscriber. 2022-06-16 08:45:07 +05:30
rewrite
snowball
statistics
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
c.h
fmgr.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
funcapi.h
getaddrinfo.h
getopt_long.h
Makefile
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
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
pgstat.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pgtar.h
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
postgres_ext.h
postgres_fe.h
rusagestub.h
windowapi.h