Commit 7816c7cb authored by Bruce Momjian's avatar Bruce Momjian

More cleanup of userid to be AclId rather than Oid.

parent caaf9410
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.98 2002/12/04 05:18:33 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.99 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -68,7 +68,7 @@ static void recreate_indexattr(Oid OIDOldHeap, List *indexes); ...@@ -68,7 +68,7 @@ static void recreate_indexattr(Oid OIDOldHeap, List *indexes);
static void swap_relfilenodes(Oid r1, Oid r2); static void swap_relfilenodes(Oid r1, Oid r2);
static void cluster_rel(relToCluster *rv); static void cluster_rel(relToCluster *rv);
static bool check_cluster_ownership(Oid relOid); static bool check_cluster_ownership(Oid relOid);
static List *get_tables_to_cluster(Oid owner); static List *get_tables_to_cluster(AclId owner);
static MemoryContext cluster_context = NULL; static MemoryContext cluster_context = NULL;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.108 2002/12/02 05:20:47 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.109 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -63,7 +63,7 @@ createdb(const CreatedbStmt *stmt) ...@@ -63,7 +63,7 @@ createdb(const CreatedbStmt *stmt)
char src_loc[MAXPGPATH]; char src_loc[MAXPGPATH];
char buf[2 * MAXPGPATH + 100]; char buf[2 * MAXPGPATH + 100];
Oid src_dboid; Oid src_dboid;
int4 src_owner; AclId src_owner;
int src_encoding; int src_encoding;
bool src_istemplate; bool src_istemplate;
Oid src_lastsysoid; Oid src_lastsysoid;
...@@ -76,7 +76,7 @@ createdb(const CreatedbStmt *stmt) ...@@ -76,7 +76,7 @@ createdb(const CreatedbStmt *stmt)
Datum new_record[Natts_pg_database]; Datum new_record[Natts_pg_database];
char new_record_nulls[Natts_pg_database]; char new_record_nulls[Natts_pg_database];
Oid dboid; Oid dboid;
int32 datdba; AclId datdba;
List *option; List *option;
DefElem *downer = NULL; DefElem *downer = NULL;
DefElem *dpath = NULL; DefElem *dpath = NULL;
...@@ -157,7 +157,7 @@ createdb(const CreatedbStmt *stmt) ...@@ -157,7 +157,7 @@ createdb(const CreatedbStmt *stmt)
else else
datdba = GetUserId(); datdba = GetUserId();
if (datdba == (int32) GetUserId()) if (datdba == GetUserId())
{ {
/* creating database for self: can be superuser or createdb */ /* creating database for self: can be superuser or createdb */
if (!superuser() && !have_createdb_privilege()) if (!superuser() && !have_createdb_privilege())
...@@ -670,7 +670,7 @@ have_createdb_privilege(void) ...@@ -670,7 +670,7 @@ have_createdb_privilege(void)
bool retval; bool retval;
utup = SearchSysCache(SHADOWSYSID, utup = SearchSysCache(SHADOWSYSID,
ObjectIdGetDatum(GetUserId()), Int32GetDatum(GetUserId()),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(utup)) if (!HeapTupleIsValid(utup))
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/schemacmds.c,v 1.6 2002/09/04 20:31:15 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/schemacmds.c,v 1.7 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -41,8 +41,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) ...@@ -41,8 +41,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
List *parsetree_list; List *parsetree_list;
List *parsetree_item; List *parsetree_item;
const char *owner_name; const char *owner_name;
Oid owner_userid; AclId owner_userid;
Oid saved_userid; AclId saved_userid;
AclResult aclresult; AclResult aclresult;
saved_userid = GetUserId(); saved_userid = GetUserId();
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.114 2002/12/02 05:20:47 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.115 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -984,7 +984,7 @@ DropUser(DropUserStmt *stmt) ...@@ -984,7 +984,7 @@ DropUser(DropUserStmt *stmt)
TupleDesc pg_dsc; TupleDesc pg_dsc;
ScanKeyData scankey; ScanKeyData scankey;
HeapScanDesc scan; HeapScanDesc scan;
int32 usesysid; AclId usesysid;
tuple = SearchSysCache(SHADOWNAME, tuple = SearchSysCache(SHADOWNAME,
PointerGetDatum(user), PointerGetDatum(user),
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.71 2002/09/04 20:31:17 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.72 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -526,7 +526,7 @@ show_server_encoding(void) ...@@ -526,7 +526,7 @@ show_server_encoding(void)
const char * const char *
assign_session_authorization(const char *value, bool doit, bool interactive) assign_session_authorization(const char *value, bool doit, bool interactive)
{ {
Oid usesysid; AclId usesysid;
char *endptr; char *endptr;
char *result; char *result;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.188 2002/11/29 19:03:01 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.189 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -346,7 +346,7 @@ static void ...@@ -346,7 +346,7 @@ static void
ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation) ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
{ {
Oid relOid; Oid relOid;
Oid userid; AclId userid;
AclResult aclcheck_result; AclResult aclcheck_result;
/* /*
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.80 2002/09/11 14:48:54 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.81 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "utils/syscache.h" #include "utils/syscache.h"
static void setRuleCheckAsUser(Query *qry, Oid userid); static void setRuleCheckAsUser(Query *qry, AclId userid);
static bool setRuleCheckAsUser_walker(Node *node, Oid *context); static bool setRuleCheckAsUser_walker(Node *node, Oid *context);
...@@ -445,7 +445,7 @@ DefineQueryRewrite(RuleStmt *stmt) ...@@ -445,7 +445,7 @@ DefineQueryRewrite(RuleStmt *stmt)
* them always. * them always.
*/ */
static void static void
setRuleCheckAsUser(Query *qry, Oid userid) setRuleCheckAsUser(Query *qry, AclId userid)
{ {
List *l; List *l;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.83 2002/11/13 00:39:47 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.84 2002/12/05 04:04:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -703,7 +703,7 @@ has_table_privilege_name(PG_FUNCTION_ARGS) ...@@ -703,7 +703,7 @@ has_table_privilege_name(PG_FUNCTION_ARGS)
{ {
text *tablename = PG_GETARG_TEXT_P(0); text *tablename = PG_GETARG_TEXT_P(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
Oid tableoid; Oid tableoid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -751,7 +751,7 @@ has_table_privilege_id(PG_FUNCTION_ARGS) ...@@ -751,7 +751,7 @@ has_table_privilege_id(PG_FUNCTION_ARGS)
{ {
Oid tableoid = PG_GETARG_OID(0); Oid tableoid = PG_GETARG_OID(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -913,7 +913,7 @@ has_database_privilege_name(PG_FUNCTION_ARGS) ...@@ -913,7 +913,7 @@ has_database_privilege_name(PG_FUNCTION_ARGS)
{ {
text *databasename = PG_GETARG_TEXT_P(0); text *databasename = PG_GETARG_TEXT_P(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
Oid databaseoid; Oid databaseoid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -961,7 +961,7 @@ has_database_privilege_id(PG_FUNCTION_ARGS) ...@@ -961,7 +961,7 @@ has_database_privilege_id(PG_FUNCTION_ARGS)
{ {
Oid databaseoid = PG_GETARG_OID(0); Oid databaseoid = PG_GETARG_OID(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -1116,7 +1116,7 @@ has_function_privilege_name(PG_FUNCTION_ARGS) ...@@ -1116,7 +1116,7 @@ has_function_privilege_name(PG_FUNCTION_ARGS)
{ {
text *functionname = PG_GETARG_TEXT_P(0); text *functionname = PG_GETARG_TEXT_P(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
Oid functionoid; Oid functionoid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -1164,7 +1164,7 @@ has_function_privilege_id(PG_FUNCTION_ARGS) ...@@ -1164,7 +1164,7 @@ has_function_privilege_id(PG_FUNCTION_ARGS)
{ {
Oid functionoid = PG_GETARG_OID(0); Oid functionoid = PG_GETARG_OID(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -1315,7 +1315,7 @@ has_language_privilege_name(PG_FUNCTION_ARGS) ...@@ -1315,7 +1315,7 @@ has_language_privilege_name(PG_FUNCTION_ARGS)
{ {
text *languagename = PG_GETARG_TEXT_P(0); text *languagename = PG_GETARG_TEXT_P(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
Oid languageoid; Oid languageoid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -1363,7 +1363,7 @@ has_language_privilege_id(PG_FUNCTION_ARGS) ...@@ -1363,7 +1363,7 @@ has_language_privilege_id(PG_FUNCTION_ARGS)
{ {
Oid languageoid = PG_GETARG_OID(0); Oid languageoid = PG_GETARG_OID(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -1514,7 +1514,7 @@ has_schema_privilege_name(PG_FUNCTION_ARGS) ...@@ -1514,7 +1514,7 @@ has_schema_privilege_name(PG_FUNCTION_ARGS)
{ {
text *schemaname = PG_GETARG_TEXT_P(0); text *schemaname = PG_GETARG_TEXT_P(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
Oid schemaoid; Oid schemaoid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
...@@ -1562,7 +1562,7 @@ has_schema_privilege_id(PG_FUNCTION_ARGS) ...@@ -1562,7 +1562,7 @@ has_schema_privilege_id(PG_FUNCTION_ARGS)
{ {
Oid schemaoid = PG_GETARG_OID(0); Oid schemaoid = PG_GETARG_OID(0);
text *priv_type_text = PG_GETARG_TEXT_P(1); text *priv_type_text = PG_GETARG_TEXT_P(1);
int32 usesysid; AclId usesysid;
AclMode mode; AclMode mode;
AclResult aclresult; AclResult aclresult;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* *
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.44 2002/11/29 21:39:11 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.45 2002/12/05 04:04:43 momjian Exp $
* *
* ---------- * ----------
*/ */
...@@ -171,7 +171,7 @@ RI_FKey_check(PG_FUNCTION_ARGS) ...@@ -171,7 +171,7 @@ RI_FKey_check(PG_FUNCTION_ARGS)
bool isnull; bool isnull;
int i; int i;
int match_type; int match_type;
Oid save_uid; AclId save_uid;
save_uid = GetUserId(); save_uid = GetUserId();
...@@ -546,7 +546,7 @@ ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type, ...@@ -546,7 +546,7 @@ ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type,
Datum check_values[RI_MAX_NUMKEYS]; Datum check_values[RI_MAX_NUMKEYS];
char check_nulls[RI_MAX_NUMKEYS + 1]; char check_nulls[RI_MAX_NUMKEYS + 1];
int i; int i;
Oid save_uid; AclId save_uid;
bool result; bool result;
save_uid = GetUserId(); save_uid = GetUserId();
...@@ -712,7 +712,7 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS) ...@@ -712,7 +712,7 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
bool isnull; bool isnull;
int i; int i;
int match_type; int match_type;
Oid save_uid; AclId save_uid;
save_uid = GetUserId(); save_uid = GetUserId();
...@@ -942,7 +942,7 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS) ...@@ -942,7 +942,7 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
bool isnull; bool isnull;
int i; int i;
int match_type; int match_type;
Oid save_uid; AclId save_uid;
save_uid = GetUserId(); save_uid = GetUserId();
...@@ -1179,8 +1179,8 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS) ...@@ -1179,8 +1179,8 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
char del_nulls[RI_MAX_NUMKEYS + 1]; char del_nulls[RI_MAX_NUMKEYS + 1];
bool isnull; bool isnull;
int i; int i;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
...@@ -1387,8 +1387,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS) ...@@ -1387,8 +1387,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
bool isnull; bool isnull;
int i; int i;
int j; int j;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
...@@ -1631,8 +1631,8 @@ RI_FKey_restrict_del(PG_FUNCTION_ARGS) ...@@ -1631,8 +1631,8 @@ RI_FKey_restrict_del(PG_FUNCTION_ARGS)
char del_nulls[RI_MAX_NUMKEYS + 1]; char del_nulls[RI_MAX_NUMKEYS + 1];
bool isnull; bool isnull;
int i; int i;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
...@@ -1854,8 +1854,8 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS) ...@@ -1854,8 +1854,8 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS)
char upd_nulls[RI_MAX_NUMKEYS + 1]; char upd_nulls[RI_MAX_NUMKEYS + 1];
bool isnull; bool isnull;
int i; int i;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
...@@ -2082,8 +2082,8 @@ RI_FKey_setnull_del(PG_FUNCTION_ARGS) ...@@ -2082,8 +2082,8 @@ RI_FKey_setnull_del(PG_FUNCTION_ARGS)
char upd_nulls[RI_MAX_NUMKEYS + 1]; char upd_nulls[RI_MAX_NUMKEYS + 1];
bool isnull; bool isnull;
int i; int i;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
...@@ -2301,8 +2301,8 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS) ...@@ -2301,8 +2301,8 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS)
int i; int i;
int match_type; int match_type;
bool use_cached_query; bool use_cached_query;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
...@@ -2566,8 +2566,8 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS) ...@@ -2566,8 +2566,8 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS)
char upd_nulls[RI_MAX_NUMKEYS + 1]; char upd_nulls[RI_MAX_NUMKEYS + 1];
bool isnull; bool isnull;
int i; int i;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
...@@ -2828,8 +2828,8 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS) ...@@ -2828,8 +2828,8 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
bool isnull; bool isnull;
int i; int i;
int match_type; int match_type;
Oid save_uid; AclId save_uid;
Oid fk_owner; AclId fk_owner;
ReferentialIntegritySnapshotOverride = true; ReferentialIntegritySnapshotOverride = true;
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.87 2002/12/01 21:05:14 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.88 2002/12/05 04:04:44 momjian Exp $
* *
* NOTES * NOTES
* Eventually, the index information should go through here, too. * Eventually, the index information should go through here, too.
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "miscadmin.h"
#include "access/tupmacs.h" #include "access/tupmacs.h"
#include "catalog/pg_amop.h" #include "catalog/pg_amop.h"
...@@ -1529,7 +1530,7 @@ get_namespace_name(Oid nspid) ...@@ -1529,7 +1530,7 @@ get_namespace_name(Oid nspid)
* someday. It'd be reasonable to return zero on failure if we were * someday. It'd be reasonable to return zero on failure if we were
* using Oid ... * using Oid ...
*/ */
int32 AclId
get_usesysid(const char *username) get_usesysid(const char *username)
{ {
int32 result; int32 result;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.66 2002/11/13 00:39:47 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.67 2002/12/05 04:04:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -633,7 +633,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) ...@@ -633,7 +633,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS)
struct fmgr_security_definer_cache struct fmgr_security_definer_cache
{ {
FmgrInfo flinfo; FmgrInfo flinfo;
Oid userid; AclId userid;
}; };
/* /*
...@@ -650,7 +650,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) ...@@ -650,7 +650,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
Datum result; Datum result;
FmgrInfo *save_flinfo; FmgrInfo *save_flinfo;
struct fmgr_security_definer_cache *fcache; struct fmgr_security_definer_cache *fcache;
Oid save_userid; AclId save_userid;
HeapTuple tuple; HeapTuple tuple;
if (!fcinfo->flinfo->fn_extra) if (!fcinfo->flinfo->fn_extra)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.97 2002/11/08 20:23:57 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.98 2002/12/05 04:04:46 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -484,27 +484,27 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir) ...@@ -484,27 +484,27 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir)
* restore the current user id if you need to change it. * restore the current user id if you need to change it.
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
static Oid AuthenticatedUserId = InvalidOid; static AclId AuthenticatedUserId = 0;
static Oid SessionUserId = InvalidOid; static AclId SessionUserId = 0;
static Oid CurrentUserId = InvalidOid; static AclId CurrentUserId = 0;
static bool AuthenticatedUserIsSuperuser = false; static bool AuthenticatedUserIsSuperuser = false;
/* /*
* This function is relevant for all privilege checks. * This function is relevant for all privilege checks.
*/ */
Oid AclId
GetUserId(void) GetUserId(void)
{ {
AssertState(OidIsValid(CurrentUserId)); AssertState(AclIdIsValid(CurrentUserId));
return CurrentUserId; return CurrentUserId;
} }
void void
SetUserId(Oid newid) SetUserId(AclId newid)
{ {
AssertArg(OidIsValid(newid)); AssertArg(AclIdIsValid(newid));
CurrentUserId = newid; CurrentUserId = newid;
} }
...@@ -512,21 +512,21 @@ SetUserId(Oid newid) ...@@ -512,21 +512,21 @@ SetUserId(Oid newid)
/* /*
* This value is only relevant for informational purposes. * This value is only relevant for informational purposes.
*/ */
Oid AclId
GetSessionUserId(void) GetSessionUserId(void)
{ {
AssertState(OidIsValid(SessionUserId)); AssertState(AclIdIsValid(SessionUserId));
return SessionUserId; return SessionUserId;
} }
void void
SetSessionUserId(Oid newid) SetSessionUserId(AclId newid)
{ {
AssertArg(OidIsValid(newid)); AssertArg(AclIdIsValid(newid));
SessionUserId = newid; SessionUserId = newid;
/* Current user defaults to session user. */ /* Current user defaults to session user. */
if (!OidIsValid(CurrentUserId)) if (!AclIdIsValid(CurrentUserId))
CurrentUserId = newid; CurrentUserId = newid;
} }
...@@ -537,7 +537,7 @@ InitializeSessionUserId(const char *username) ...@@ -537,7 +537,7 @@ InitializeSessionUserId(const char *username)
HeapTuple userTup; HeapTuple userTup;
Datum datum; Datum datum;
bool isnull; bool isnull;
Oid usesysid; AclId usesysid;
/* /*
* Don't do scans if we're bootstrapping, none of the system catalogs * Don't do scans if we're bootstrapping, none of the system catalogs
...@@ -605,10 +605,10 @@ InitializeSessionUserIdStandalone(void) ...@@ -605,10 +605,10 @@ InitializeSessionUserIdStandalone(void)
* Only a superuser may set auth ID to something other than himself. * Only a superuser may set auth ID to something other than himself.
*/ */
void void
SetSessionAuthorization(Oid userid) SetSessionAuthorization(AclId userid)
{ {
/* Must have authenticated already, else can't make permission check */ /* Must have authenticated already, else can't make permission check */
AssertState(OidIsValid(AuthenticatedUserId)); AssertState(AclIdIsValid(AuthenticatedUserId));
if (userid != AuthenticatedUserId && if (userid != AuthenticatedUserId &&
!AuthenticatedUserIsSuperuser) !AuthenticatedUserIsSuperuser)
...@@ -623,7 +623,7 @@ SetSessionAuthorization(Oid userid) ...@@ -623,7 +623,7 @@ SetSessionAuthorization(Oid userid)
* Get user name from user id * Get user name from user id
*/ */
char * char *
GetUserNameFromId(Oid userid) GetUserNameFromId(AclId userid)
{ {
HeapTuple tuple; HeapTuple tuple;
char *result; char *result;
...@@ -632,7 +632,7 @@ GetUserNameFromId(Oid userid) ...@@ -632,7 +632,7 @@ GetUserNameFromId(Oid userid)
ObjectIdGetDatum(userid), ObjectIdGetDatum(userid),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "invalid user id %u", (unsigned) userid); elog(ERROR, "invalid user id %d", userid);
result = pstrdup(NameStr(((Form_pg_shadow) GETSTRUCT(tuple))->usename)); result = pstrdup(NameStr(((Form_pg_shadow) GETSTRUCT(tuple))->usename));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.24 2002/08/09 16:45:14 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.25 2002/12/05 04:04:47 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -39,7 +39,7 @@ superuser(void) ...@@ -39,7 +39,7 @@ superuser(void)
bool bool
superuser_arg(Oid userid) superuser_arg(AclId userid)
{ {
bool result = false; bool result = false;
HeapTuple utup; HeapTuple utup;
...@@ -49,7 +49,7 @@ superuser_arg(Oid userid) ...@@ -49,7 +49,7 @@ superuser_arg(Oid userid)
return true; return true;
utup = SearchSysCache(SHADOWSYSID, utup = SearchSysCache(SHADOWSYSID,
ObjectIdGetDatum(userid), Int32GetDatum(userid),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(utup)) if (HeapTupleIsValid(utup))
{ {
...@@ -67,7 +67,7 @@ superuser_arg(Oid userid) ...@@ -67,7 +67,7 @@ superuser_arg(Oid userid)
bool bool
is_dbadmin(Oid dbid) is_dbadmin(Oid dbid)
{ {
Oid dba; AclId dba;
dba = get_database_owner(dbid); dba = get_database_owner(dbid);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: c.h,v 1.132 2002/11/13 00:37:06 momjian Exp $ * $Id: c.h,v 1.133 2002/12/05 04:04:48 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -462,6 +462,8 @@ typedef NameData *Name; ...@@ -462,6 +462,8 @@ typedef NameData *Name;
#define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid)) #define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid))
#define AclIdIsValid(aclId) ((bool) ((aclId) != 0))
#define RegProcedureIsValid(p) OidIsValid(p) #define RegProcedureIsValid(p) OidIsValid(p)
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: miscadmin.h,v 1.112 2002/12/04 05:18:34 momjian Exp $ * $Id: miscadmin.h,v 1.113 2002/12/05 04:04:50 momjian Exp $
* *
* NOTES * NOTES
* some of the information in this file should be moved to * some of the information in this file should be moved to
...@@ -200,21 +200,20 @@ extern char *ExpandDatabasePath(const char *path); ...@@ -200,21 +200,20 @@ extern char *ExpandDatabasePath(const char *path);
extern void SetDatabaseName(const char *name); extern void SetDatabaseName(const char *name);
extern void SetDatabasePath(const char *path); extern void SetDatabasePath(const char *path);
extern char *GetUserNameFromId(Oid userid);
/* /*
* AclId system identifier for the user, group, etc. * AclId system identifier for the user, group, etc.
* XXX Perhaps replace this type by OID?
*/ */
typedef uint32 AclId; typedef int32 AclId;
extern char *GetUserNameFromId(AclId userid);
extern AclId GetUserId(void); extern AclId GetUserId(void);
extern void SetUserId(Oid userid); extern void SetUserId(AclId userid);
extern Oid GetSessionUserId(void); extern AclId GetSessionUserId(void);
extern void SetSessionUserId(Oid userid); extern void SetSessionUserId(AclId userid);
extern void InitializeSessionUserId(const char *username); extern void InitializeSessionUserId(const char *username);
extern void InitializeSessionUserIdStandalone(void); extern void InitializeSessionUserIdStandalone(void);
extern void SetSessionAuthorization(Oid userid); extern void SetSessionAuthorization(AclId userid);
extern void SetDataDir(const char *dir); extern void SetDataDir(const char *dir);
...@@ -229,7 +228,7 @@ extern char *convertstr(unsigned char *buff, int len, int dest); ...@@ -229,7 +228,7 @@ extern char *convertstr(unsigned char *buff, int len, int dest);
/* in utils/misc/superuser.c */ /* in utils/misc/superuser.c */
extern bool superuser(void); /* current user is superuser */ extern bool superuser(void); /* current user is superuser */
extern bool superuser_arg(Oid userid); /* given user is superuser */ extern bool superuser_arg(AclId userid); /* given user is superuser */
extern bool is_dbadmin(Oid dbid); /* current user is owner of extern bool is_dbadmin(Oid dbid); /* current user is owner of
* database */ * database */
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
* *
* Copyright (c) 2001, PostgreSQL Global Development Group * Copyright (c) 2001, PostgreSQL Global Development Group
* *
* $Id: pgstat.h,v 1.10 2001/11/05 17:46:31 momjian Exp $ * $Id: pgstat.h,v 1.11 2002/12/05 04:04:51 momjian Exp $
* ---------- * ----------
*/ */
#ifndef PGSTAT_H #ifndef PGSTAT_H
#define PGSTAT_H #define PGSTAT_H
#include "miscadmin.h"
/* ---------- /* ----------
* Paths for the statistics files. The %s is replaced with the * Paths for the statistics files. The %s is replaced with the
* installations $PGDATA. * installations $PGDATA.
...@@ -170,7 +172,7 @@ typedef struct PgStat_MsgHdr ...@@ -170,7 +172,7 @@ typedef struct PgStat_MsgHdr
int m_backendid; int m_backendid;
int m_procpid; int m_procpid;
Oid m_databaseid; Oid m_databaseid;
Oid m_userid; AclId m_userid;
} PgStat_MsgHdr; } PgStat_MsgHdr;
/* ---------- /* ----------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: acl.h,v 1.48 2002/12/04 05:18:38 momjian Exp $ * $Id: acl.h,v 1.49 2002/12/05 04:04:51 momjian Exp $
* *
* NOTES * NOTES
* For backward-compatibility purposes we have to allow there * For backward-compatibility purposes we have to allow there
...@@ -190,11 +190,11 @@ extern void ExecuteGrantStmt(GrantStmt *stmt); ...@@ -190,11 +190,11 @@ extern void ExecuteGrantStmt(GrantStmt *stmt);
extern AclId get_grosysid(char *groname); extern AclId get_grosysid(char *groname);
extern char *get_groname(AclId grosysid); extern char *get_groname(AclId grosysid);
extern AclResult pg_class_aclcheck(Oid table_oid, Oid userid, AclMode mode); extern AclResult pg_class_aclcheck(Oid table_oid, AclId userid, AclMode mode);
extern AclResult pg_database_aclcheck(Oid db_oid, Oid userid, AclMode mode); extern AclResult pg_database_aclcheck(Oid db_oid, AclId userid, AclMode mode);
extern AclResult pg_proc_aclcheck(Oid proc_oid, Oid userid, AclMode mode); extern AclResult pg_proc_aclcheck(Oid proc_oid, AclId userid, AclMode mode);
extern AclResult pg_language_aclcheck(Oid lang_oid, Oid userid, AclMode mode); extern AclResult pg_language_aclcheck(Oid lang_oid, AclId userid, AclMode mode);
extern AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode); extern AclResult pg_namespace_aclcheck(Oid nsp_oid, AclId userid, AclMode mode);
extern void aclcheck_error(AclResult errcode, const char *objectname); extern void aclcheck_error(AclResult errcode, const char *objectname);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment