diff options
author | Joe Conway <mail@joeconway.com> | 2022-04-02 13:24:38 -0400 |
---|---|---|
committer | Joe Conway <mail@joeconway.com> | 2022-04-02 13:24:38 -0400 |
commit | 9752436f049430428464e22dcf837e9c6fa4e513 (patch) | |
tree | 9ce8eb15160e8237f868f379f973c5706925a49d /contrib/basebackup_to_shell/basebackup_to_shell.c | |
parent | cfdd03f45e6afc632fbe70519250ec19167d6765 (diff) |
Use has_privs_for_roles for predefined role checks: round 2
Similar to commit 6198420ad, replace is_member_of_role with
has_privs_for_role for predefined role access checks in recently
committed basebackup code. In passing fix a double-word error
in a nearby comment.
Discussion: https://postgr.es/m/flat/CAGB+Vh4Zv_TvKt2tv3QNS6tUM_F_9icmuj0zjywwcgVi4PAhFA@mail.gmail.com
Diffstat (limited to 'contrib/basebackup_to_shell/basebackup_to_shell.c')
-rw-r--r-- | contrib/basebackup_to_shell/basebackup_to_shell.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/basebackup_to_shell/basebackup_to_shell.c b/contrib/basebackup_to_shell/basebackup_to_shell.c index d82cb6d13f6..f0ddef19870 100644 --- a/contrib/basebackup_to_shell/basebackup_to_shell.c +++ b/contrib/basebackup_to_shell/basebackup_to_shell.c @@ -90,7 +90,7 @@ _PG_init(void) } /* - * We choose to defer sanity sanity checking until shell_get_sink(), and so + * We choose to defer sanity checking until shell_get_sink(), and so * just pass the target detail through without doing anything. However, we do * permissions checks here, before any real work has been done. */ @@ -103,7 +103,7 @@ shell_check_detail(char *target, char *target_detail) StartTransactionCommand(); roleid = get_role_oid(shell_required_role, true); - if (!is_member_of_role(GetUserId(), roleid)) + if (!has_privs_of_role(GetUserId(), roleid)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to use basebackup_to_shell"))); |