From 8adf56f77aa0cc8cf4af7a19f0d235fc56fbabc7 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 18 Feb 2002 23:11:58 +0000 Subject: Privileges on functions and procedural languages --- src/backend/utils/misc/superuser.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/backend/utils/misc/superuser.c') 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 $ * *------------------------------------------------------------------------- */ @@ -30,16 +30,23 @@ */ 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. -- cgit v1.2.3