diff options
author | Magnus Hagander <magnus@hagander.net> | 2010-12-29 11:05:03 +0100 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2010-12-29 11:05:03 +0100 |
commit | 9b8aff8c192e2f313f90395d114c58a9ef84f97f (patch) | |
tree | a4a4f7a5c25d4bbdd85599471a206433de704f1d /src/backend/access/transam/xlog.c | |
parent | f2ba1e994c4d17dc3d4b8d48d3933c96d09127e1 (diff) | |
download | postgresql-9b8aff8c192e2f313f90395d114c58a9ef84f97f.tar.gz postgresql-9b8aff8c192e2f313f90395d114c58a9ef84f97f.zip |
Add REPLICATION privilege for ROLEs
This privilege is required to do Streaming Replication, instead of
superuser, making it possible to set up a SR slave that doesn't
have write permissions on the master.
Superuser privileges do NOT override this check, so in order to
use the default superuser account for replication it must be
explicitly granted the REPLICATION permissions. This is backwards
incompatible change, in the interest of higher default security.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index b49b933de3e..bf62138bf86 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -8301,10 +8301,10 @@ pg_start_backup(PG_FUNCTION_ARGS) struct stat stat_buf; FILE *fp; - if (!superuser()) + if (!superuser() && !is_authenticated_user_replication_role()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to run a backup"))); + errmsg("must be superuser or replication role to run a backup"))); if (RecoveryInProgress()) ereport(ERROR, @@ -8493,10 +8493,10 @@ pg_stop_backup(PG_FUNCTION_ARGS) int waits = 0; bool reported_waiting = false; - if (!superuser()) + if (!superuser() && !is_authenticated_user_replication_role()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("must be superuser to run a backup")))); + (errmsg("must be superuser or replication role to run a backup")))); if (RecoveryInProgress()) ereport(ERROR, |