aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/superuser.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2002-02-18 23:11:58 +0000
committerPeter Eisentraut <peter_e@gmx.net>2002-02-18 23:11:58 +0000
commit8adf56f77aa0cc8cf4af7a19f0d235fc56fbabc7 (patch)
treecab3054a1a1fba1fe1722bb75a1fc3c06eda964d /src/backend/utils/misc/superuser.c
parent5e035031265aef8608fd32a31897240a3aff3d8d (diff)
downloadpostgresql-8adf56f77aa0cc8cf4af7a19f0d235fc56fbabc7.tar.gz
postgresql-8adf56f77aa0cc8cf4af7a19f0d235fc56fbabc7.zip
Privileges on functions and procedural languages
Diffstat (limited to 'src/backend/utils/misc/superuser.c')
-rw-r--r--src/backend/utils/misc/superuser.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/utils/misc/superuser.c b/src/backend/utils/misc/superuser.c
index 2f092028480..f677d64fd3e 100644
--- a/src/backend/utils/misc/superuser.c
+++ b/src/backend/utils/misc/superuser.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.19 2001/09/08 15:24:00 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.20 2002/02/18 23:11:26 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,15 +31,22 @@
bool
superuser(void)
{
+ return superuser_arg(GetUserId());
+}
+
+
+bool
+superuser_arg(Oid userid)
+{
bool result = false;
HeapTuple utup;
/* Special escape path in case you deleted all your users. */
- if (!IsUnderPostmaster && GetUserId() == BOOTSTRAP_USESYSID)
+ if (!IsUnderPostmaster && userid == BOOTSTRAP_USESYSID)
return true;
utup = SearchSysCache(SHADOWSYSID,
- ObjectIdGetDatum(GetUserId()),
+ ObjectIdGetDatum(userid),
0, 0, 0);
if (HeapTupleIsValid(utup))
{
@@ -49,6 +56,7 @@ superuser(void)
return result;
}
+
/*
* The Postgres user running this command is the owner of the specified
* database.