diff options
author | Stephen Frost <sfrost@snowman.net> | 2016-04-06 21:45:32 -0400 |
---|---|---|
committer | Stephen Frost <sfrost@snowman.net> | 2016-04-06 21:45:32 -0400 |
commit | 1574783b4ced0356fbc626af1a1a469faa6b41e1 (patch) | |
tree | 1b999ee5c4a940bf220ee491303eae73cffa637c /src/backend/utils/adt/misc.c | |
parent | 23f34fa4ba358671adab16773e79c17c92cbc870 (diff) | |
download | postgresql-1574783b4ced0356fbc626af1a1a469faa6b41e1.tar.gz postgresql-1574783b4ced0356fbc626af1a1a469faa6b41e1.zip |
Use GRANT system to manage access to sensitive functions
Now that pg_dump will properly dump out any ACL changes made to
functions which exist in pg_catalog, switch to using the GRANT system
to manage access to those functions.
This means removing 'if (!superuser()) ereport()' checks from the
functions themselves and then REVOKEing EXECUTE right from 'public' for
these functions in system_views.sql.
Reviews by Alexander Korotkov, Jose Luis Tallon
Diffstat (limited to 'src/backend/utils/adt/misc.c')
-rw-r--r-- | src/backend/utils/adt/misc.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 6f7c4078161..ebc7bb388a7 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -321,15 +321,13 @@ pg_terminate_backend(PG_FUNCTION_ARGS) /* * Signal to reload the database configuration + * + * Permission checking for this function is managed through the normal + * GRANT system. */ Datum pg_reload_conf(PG_FUNCTION_ARGS) { - if (!superuser()) - ereport(ERROR, - (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("must be superuser to signal the postmaster")))); - if (kill(PostmasterPid, SIGHUP)) { ereport(WARNING, @@ -343,15 +341,13 @@ pg_reload_conf(PG_FUNCTION_ARGS) /* * Rotate log file + * + * Permission checking for this function is managed through the normal + * GRANT system. */ Datum pg_rotate_logfile(PG_FUNCTION_ARGS) { - if (!superuser()) - ereport(ERROR, - (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("must be superuser to rotate log files")))); - if (!Logging_collector) { ereport(WARNING, |