mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user