Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
7816c7cb
Commit
7816c7cb
authored
Dec 05, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cleanup of userid to be AclId rather than Oid.
parent
caaf9410
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
101 additions
and
97 deletions
+101
-97
src/backend/commands/cluster.c
src/backend/commands/cluster.c
+2
-2
src/backend/commands/dbcommands.c
src/backend/commands/dbcommands.c
+5
-5
src/backend/commands/schemacmds.c
src/backend/commands/schemacmds.c
+3
-3
src/backend/commands/user.c
src/backend/commands/user.c
+2
-2
src/backend/commands/variable.c
src/backend/commands/variable.c
+2
-2
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+2
-2
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteDefine.c
+3
-3
src/backend/utils/adt/acl.c
src/backend/utils/adt/acl.c
+11
-11
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ri_triggers.c
+21
-21
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/lsyscache.c
+3
-2
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/fmgr.c
+3
-3
src/backend/utils/init/miscinit.c
src/backend/utils/init/miscinit.c
+18
-18
src/backend/utils/misc/superuser.c
src/backend/utils/misc/superuser.c
+4
-4
src/include/c.h
src/include/c.h
+3
-1
src/include/miscadmin.h
src/include/miscadmin.h
+9
-10
src/include/pgstat.h
src/include/pgstat.h
+4
-2
src/include/utils/acl.h
src/include/utils/acl.h
+6
-6
No files found.
src/backend/commands/cluster.c
View file @
7816c7cb
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.9
8 2002/12/04 05:18:33
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.9
9 2002/12/05 04:04:42
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -68,7 +68,7 @@ static void recreate_indexattr(Oid OIDOldHeap, List *indexes);
static
void
swap_relfilenodes
(
Oid
r1
,
Oid
r2
);
static
void
cluster_rel
(
relToCluster
*
rv
);
static
bool
check_cluster_ownership
(
Oid
relOid
);
static
List
*
get_tables_to_cluster
(
Oi
d
owner
);
static
List
*
get_tables_to_cluster
(
AclI
d
owner
);
static
MemoryContext
cluster_context
=
NULL
;
...
...
src/backend/commands/dbcommands.c
View file @
7816c7cb
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.10
8 2002/12/02 05:20:47 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.10
9 2002/12/05 04:04:42 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -63,7 +63,7 @@ createdb(const CreatedbStmt *stmt)
char
src_loc
[
MAXPGPATH
];
char
buf
[
2
*
MAXPGPATH
+
100
];
Oid
src_dboid
;
int4
src_owner
;
AclId
src_owner
;
int
src_encoding
;
bool
src_istemplate
;
Oid
src_lastsysoid
;
...
...
@@ -76,7 +76,7 @@ createdb(const CreatedbStmt *stmt)
Datum
new_record
[
Natts_pg_database
];
char
new_record_nulls
[
Natts_pg_database
];
Oid
dboid
;
int32
datdba
;
AclId
datdba
;
List
*
option
;
DefElem
*
downer
=
NULL
;
DefElem
*
dpath
=
NULL
;
...
...
@@ -157,7 +157,7 @@ createdb(const CreatedbStmt *stmt)
else
datdba
=
GetUserId
();
if
(
datdba
==
(
int32
)
GetUserId
())
if
(
datdba
==
GetUserId
())
{
/* creating database for self: can be superuser or createdb */
if
(
!
superuser
()
&&
!
have_createdb_privilege
())
...
...
@@ -670,7 +670,7 @@ have_createdb_privilege(void)
bool
retval
;
utup
=
SearchSysCache
(
SHADOWSYSID
,
ObjectId
GetDatum
(
GetUserId
()),
Int32
GetDatum
(
GetUserId
()),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
utup
))
...
...
src/backend/commands/schemacmds.c
View file @
7816c7cb
...
...
@@ -8,7 +8,7 @@
*
*
* 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)
List
*
parsetree_list
;
List
*
parsetree_item
;
const
char
*
owner_name
;
Oid
owner_userid
;
Oid
saved_userid
;
AclId
owner_userid
;
AclId
saved_userid
;
AclResult
aclresult
;
saved_userid
=
GetUserId
();
...
...
src/backend/commands/user.c
View file @
7816c7cb
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.11
4 2002/12/02 05:20:47 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.11
5 2002/12/05 04:04:42 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -984,7 +984,7 @@ DropUser(DropUserStmt *stmt)
TupleDesc
pg_dsc
;
ScanKeyData
scankey
;
HeapScanDesc
scan
;
int32
usesysid
;
AclId
usesysid
;
tuple
=
SearchSysCache
(
SHADOWNAME
,
PointerGetDatum
(
user
),
...
...
src/backend/commands/variable.c
View file @
7816c7cb
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.7
1 2002/09/04 20:31:17
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.7
2 2002/12/05 04:04:42
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -526,7 +526,7 @@ show_server_encoding(void)
const
char
*
assign_session_authorization
(
const
char
*
value
,
bool
doit
,
bool
interactive
)
{
Oid
usesysid
;
AclId
usesysid
;
char
*
endptr
;
char
*
result
;
...
...
src/backend/executor/execMain.c
View file @
7816c7cb
...
...
@@ -27,7 +27,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.18
8 2002/11/29 19:03:01 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.18
9 2002/12/05 04:04:42 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -346,7 +346,7 @@ static void
ExecCheckRTEPerms
(
RangeTblEntry
*
rte
,
CmdType
operation
)
{
Oid
relOid
;
Oid
userid
;
AclId
userid
;
AclResult
aclcheck_result
;
/*
...
...
src/backend/rewrite/rewriteDefine.c
View file @
7816c7cb
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.8
0 2002/09/11 14:48:54 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.8
1 2002/12/05 04:04:42 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -32,7 +32,7 @@
#include "utils/syscache.h"
static
void
setRuleCheckAsUser
(
Query
*
qry
,
Oi
d
userid
);
static
void
setRuleCheckAsUser
(
Query
*
qry
,
AclI
d
userid
);
static
bool
setRuleCheckAsUser_walker
(
Node
*
node
,
Oid
*
context
);
...
...
@@ -445,7 +445,7 @@ DefineQueryRewrite(RuleStmt *stmt)
* them always.
*/
static
void
setRuleCheckAsUser
(
Query
*
qry
,
Oi
d
userid
)
setRuleCheckAsUser
(
Query
*
qry
,
AclI
d
userid
)
{
List
*
l
;
...
...
src/backend/utils/adt/acl.c
View file @
7816c7cb
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.8
3 2002/11/13 00:39:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.8
4 2002/12/05 04:04:42
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -703,7 +703,7 @@ has_table_privilege_name(PG_FUNCTION_ARGS)
{
text
*
tablename
=
PG_GETARG_TEXT_P
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
Oid
tableoid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -751,7 +751,7 @@ has_table_privilege_id(PG_FUNCTION_ARGS)
{
Oid
tableoid
=
PG_GETARG_OID
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -913,7 +913,7 @@ has_database_privilege_name(PG_FUNCTION_ARGS)
{
text
*
databasename
=
PG_GETARG_TEXT_P
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
Oid
databaseoid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -961,7 +961,7 @@ has_database_privilege_id(PG_FUNCTION_ARGS)
{
Oid
databaseoid
=
PG_GETARG_OID
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -1116,7 +1116,7 @@ has_function_privilege_name(PG_FUNCTION_ARGS)
{
text
*
functionname
=
PG_GETARG_TEXT_P
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
Oid
functionoid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -1164,7 +1164,7 @@ has_function_privilege_id(PG_FUNCTION_ARGS)
{
Oid
functionoid
=
PG_GETARG_OID
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -1315,7 +1315,7 @@ has_language_privilege_name(PG_FUNCTION_ARGS)
{
text
*
languagename
=
PG_GETARG_TEXT_P
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
Oid
languageoid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -1363,7 +1363,7 @@ has_language_privilege_id(PG_FUNCTION_ARGS)
{
Oid
languageoid
=
PG_GETARG_OID
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -1514,7 +1514,7 @@ has_schema_privilege_name(PG_FUNCTION_ARGS)
{
text
*
schemaname
=
PG_GETARG_TEXT_P
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
Oid
schemaoid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
@@ -1562,7 +1562,7 @@ has_schema_privilege_id(PG_FUNCTION_ARGS)
{
Oid
schemaoid
=
PG_GETARG_OID
(
0
);
text
*
priv_type_text
=
PG_GETARG_TEXT_P
(
1
);
int32
usesysid
;
AclId
usesysid
;
AclMode
mode
;
AclResult
aclresult
;
...
...
src/backend/utils/adt/ri_triggers.c
View file @
7816c7cb
...
...
@@ -17,7 +17,7 @@
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.4
4 2002/11/29 21:39:11 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.4
5 2002/12/05 04:04:43 momjian
Exp $
*
* ----------
*/
...
...
@@ -171,7 +171,7 @@ RI_FKey_check(PG_FUNCTION_ARGS)
bool
isnull
;
int
i
;
int
match_type
;
Oid
save_uid
;
AclId
save_uid
;
save_uid
=
GetUserId
();
...
...
@@ -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
];
char
check_nulls
[
RI_MAX_NUMKEYS
+
1
];
int
i
;
Oid
save_uid
;
AclId
save_uid
;
bool
result
;
save_uid
=
GetUserId
();
...
...
@@ -712,7 +712,7 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
bool
isnull
;
int
i
;
int
match_type
;
Oid
save_uid
;
AclId
save_uid
;
save_uid
=
GetUserId
();
...
...
@@ -942,7 +942,7 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
bool
isnull
;
int
i
;
int
match_type
;
Oid
save_uid
;
AclId
save_uid
;
save_uid
=
GetUserId
();
...
...
@@ -1179,8 +1179,8 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
char
del_nulls
[
RI_MAX_NUMKEYS
+
1
];
bool
isnull
;
int
i
;
Oid
save_uid
;
Oid
fk_owner
;
AclId
save_uid
;
AclId
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
@@ -1387,8 +1387,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
bool
isnull
;
int
i
;
int
j
;
Oid
save_uid
;
Oid
fk_owner
;
AclId
save_uid
;
AclId
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
@@ -1631,8 +1631,8 @@ RI_FKey_restrict_del(PG_FUNCTION_ARGS)
char
del_nulls
[
RI_MAX_NUMKEYS
+
1
];
bool
isnull
;
int
i
;
Oid
save_uid
;
Oid
fk_owner
;
AclId
save_uid
;
AclId
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
@@ -1854,8 +1854,8 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS)
char
upd_nulls
[
RI_MAX_NUMKEYS
+
1
];
bool
isnull
;
int
i
;
Oid
save_uid
;
Oid
fk_owner
;
AclId
save_uid
;
AclId
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
@@ -2082,8 +2082,8 @@ RI_FKey_setnull_del(PG_FUNCTION_ARGS)
char
upd_nulls
[
RI_MAX_NUMKEYS
+
1
];
bool
isnull
;
int
i
;
Oid
save_uid
;
Oid
fk_owner
;
AclId
save_uid
;
AclId
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
@@ -2301,8 +2301,8 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS)
int
i
;
int
match_type
;
bool
use_cached_query
;
Oid
save_uid
;
Oid
fk_owner
;
AclId
save_uid
;
AclId
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
@@ -2566,8 +2566,8 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS)
char
upd_nulls
[
RI_MAX_NUMKEYS
+
1
];
bool
isnull
;
int
i
;
Oid
save_uid
;
Oi
d
fk_owner
;
AclId
save_uid
;
AclI
d
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
@@ -2828,8 +2828,8 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
bool
isnull
;
int
i
;
int
match_type
;
Oid
save_uid
;
Oid
fk_owner
;
AclId
save_uid
;
AclId
fk_owner
;
ReferentialIntegritySnapshotOverride
=
true
;
...
...
src/backend/utils/cache/lsyscache.c
View file @
7816c7cb
...
...
@@ -7,13 +7,14 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.8
7 2002/12/01 21:05:14 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.8
8 2002/12/05 04:04:44 momjian
Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "miscadmin.h"
#include "access/tupmacs.h"
#include "catalog/pg_amop.h"
...
...
@@ -1529,7 +1530,7 @@ get_namespace_name(Oid nspid)
* someday. It'd be reasonable to return zero on failure if we were
* using Oid ...
*/
int32
AclId
get_usesysid
(
const
char
*
username
)
{
int32
result
;
...
...
src/backend/utils/fmgr/fmgr.c
View file @
7816c7cb
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.6
6 2002/11/13 00:39:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.6
7 2002/12/05 04:04:44
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -633,7 +633,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS)
struct
fmgr_security_definer_cache
{
FmgrInfo
flinfo
;
Oid
userid
;
AclId
userid
;
};
/*
...
...
@@ -650,7 +650,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
Datum
result
;
FmgrInfo
*
save_flinfo
;
struct
fmgr_security_definer_cache
*
fcache
;
Oid
save_userid
;
AclId
save_userid
;
HeapTuple
tuple
;
if
(
!
fcinfo
->
flinfo
->
fn_extra
)
...
...
src/backend/utils/init/miscinit.c
View file @
7816c7cb
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.9
7 2002/11/08 20:23:57
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.9
8 2002/12/05 04:04:46
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -484,27 +484,27 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir)
* restore the current user id if you need to change it.
* ----------------------------------------------------------------
*/
static
Oid
AuthenticatedUserId
=
InvalidOid
;
static
Oid
SessionUserId
=
InvalidOid
;
static
Oid
CurrentUserId
=
InvalidOid
;
static
AclId
AuthenticatedUserId
=
0
;
static
AclId
SessionUserId
=
0
;
static
AclId
CurrentUserId
=
0
;
static
bool
AuthenticatedUserIsSuperuser
=
false
;
/*
* This function is relevant for all privilege checks.
*/
Oi
d
AclI
d
GetUserId
(
void
)
{
AssertState
(
Oi
dIsValid
(
CurrentUserId
));
AssertState
(
AclI
dIsValid
(
CurrentUserId
));
return
CurrentUserId
;
}
void
SetUserId
(
Oi
d
newid
)
SetUserId
(
AclI
d
newid
)
{
AssertArg
(
Oi
dIsValid
(
newid
));
AssertArg
(
AclI
dIsValid
(
newid
));
CurrentUserId
=
newid
;
}
...
...
@@ -512,21 +512,21 @@ SetUserId(Oid newid)
/*
* This value is only relevant for informational purposes.
*/
Oi
d
AclI
d
GetSessionUserId
(
void
)
{
AssertState
(
Oi
dIsValid
(
SessionUserId
));
AssertState
(
AclI
dIsValid
(
SessionUserId
));
return
SessionUserId
;
}
void
SetSessionUserId
(
Oi
d
newid
)
SetSessionUserId
(
AclI
d
newid
)
{
AssertArg
(
Oi
dIsValid
(
newid
));
AssertArg
(
AclI
dIsValid
(
newid
));
SessionUserId
=
newid
;
/* Current user defaults to session user. */
if
(
!
Oi
dIsValid
(
CurrentUserId
))
if
(
!
AclI
dIsValid
(
CurrentUserId
))
CurrentUserId
=
newid
;
}
...
...
@@ -537,7 +537,7 @@ InitializeSessionUserId(const char *username)
HeapTuple
userTup
;
Datum
datum
;
bool
isnull
;
Oid
usesysid
;
AclId
usesysid
;
/*
* Don't do scans if we're bootstrapping, none of the system catalogs
...
...
@@ -605,10 +605,10 @@ InitializeSessionUserIdStandalone(void)
* Only a superuser may set auth ID to something other than himself.
*/
void
SetSessionAuthorization
(
Oi
d
userid
)
SetSessionAuthorization
(
AclI
d
userid
)
{
/* Must have authenticated already, else can't make permission check */
AssertState
(
Oi
dIsValid
(
AuthenticatedUserId
));
AssertState
(
AclI
dIsValid
(
AuthenticatedUserId
));
if
(
userid
!=
AuthenticatedUserId
&&
!
AuthenticatedUserIsSuperuser
)
...
...
@@ -623,7 +623,7 @@ SetSessionAuthorization(Oid userid)
* Get user name from user id
*/
char
*
GetUserNameFromId
(
Oi
d
userid
)
GetUserNameFromId
(
AclI
d
userid
)
{
HeapTuple
tuple
;
char
*
result
;
...
...
@@ -632,7 +632,7 @@ GetUserNameFromId(Oid userid)
ObjectIdGetDatum
(
userid
),
0
,
0
,
0
);
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
));
...
...
src/backend/utils/misc/superuser.c
View file @
7816c7cb
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.2
4 2002/08/09 16:45:14 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.2
5 2002/12/05 04:04:47 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -39,7 +39,7 @@ superuser(void)
bool
superuser_arg
(
Oi
d
userid
)
superuser_arg
(
AclI
d
userid
)
{
bool
result
=
false
;
HeapTuple
utup
;
...
...
@@ -49,7 +49,7 @@ superuser_arg(Oid userid)
return
true
;
utup
=
SearchSysCache
(
SHADOWSYSID
,
ObjectId
GetDatum
(
userid
),
Int32
GetDatum
(
userid
),
0
,
0
,
0
);
if
(
HeapTupleIsValid
(
utup
))
{
...
...
@@ -67,7 +67,7 @@ superuser_arg(Oid userid)
bool
is_dbadmin
(
Oid
dbid
)
{
Oid
dba
;
AclId
dba
;
dba
=
get_database_owner
(
dbid
);
...
...
src/include/c.h
View file @
7816c7cb
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.13
2 2002/11/13 00:37:06
momjian Exp $
* $Id: c.h,v 1.13
3 2002/12/05 04:04:48
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -462,6 +462,8 @@ typedef NameData *Name;
#define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid))
#define AclIdIsValid(aclId) ((bool) ((aclId) != 0))
#define RegProcedureIsValid(p) OidIsValid(p)
...
...
src/include/miscadmin.h
View file @
7816c7cb
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: miscadmin.h,v 1.11
2 2002/12/04 05:18:34
momjian Exp $
* $Id: miscadmin.h,v 1.11
3 2002/12/05 04:04:50
momjian Exp $
*
* NOTES
* some of the information in this file should be moved to
...
...
@@ -200,21 +200,20 @@ extern char *ExpandDatabasePath(const char *path);
extern
void
SetDatabaseName
(
const
char
*
name
);
extern
void
SetDatabasePath
(
const
char
*
path
);
extern
char
*
GetUserNameFromId
(
Oid
userid
);
/*
* 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
void
SetUserId
(
Oi
d
userid
);
extern
Oid
GetSessionUserId
(
void
);
extern
void
SetSessionUserId
(
Oi
d
userid
);
extern
void
SetUserId
(
AclI
d
userid
);
extern
AclId
GetSessionUserId
(
void
);
extern
void
SetSessionUserId
(
AclI
d
userid
);
extern
void
InitializeSessionUserId
(
const
char
*
username
);
extern
void
InitializeSessionUserIdStandalone
(
void
);
extern
void
SetSessionAuthorization
(
Oi
d
userid
);
extern
void
SetSessionAuthorization
(
AclI
d
userid
);
extern
void
SetDataDir
(
const
char
*
dir
);
...
...
@@ -229,7 +228,7 @@ extern char *convertstr(unsigned char *buff, int len, int dest);
/* in utils/misc/superuser.c */
extern
bool
superuser
(
void
);
/* current user is superuser */
extern
bool
superuser_arg
(
Oi
d
userid
);
/* given user is superuser */
extern
bool
superuser_arg
(
AclI
d
userid
);
/* given user is superuser */
extern
bool
is_dbadmin
(
Oid
dbid
);
/* current user is owner of
* database */
...
...
src/include/pgstat.h
View file @
7816c7cb
...
...
@@ -5,12 +5,14 @@
*
* Copyright (c) 2001, PostgreSQL Global Development Group
*
* $Id: pgstat.h,v 1.1
0 2001/11/05 17:46:3
1 momjian Exp $
* $Id: pgstat.h,v 1.1
1 2002/12/05 04:04:5
1 momjian Exp $
* ----------
*/
#ifndef PGSTAT_H
#define PGSTAT_H
#include "miscadmin.h"
/* ----------
* Paths for the statistics files. The %s is replaced with the
* installations $PGDATA.
...
...
@@ -170,7 +172,7 @@ typedef struct PgStat_MsgHdr
int
m_backendid
;
int
m_procpid
;
Oid
m_databaseid
;
Oid
m_userid
;
AclId
m_userid
;
}
PgStat_MsgHdr
;
/* ----------
...
...
src/include/utils/acl.h
View file @
7816c7cb
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: acl.h,v 1.4
8 2002/12/04 05:18:38
momjian Exp $
* $Id: acl.h,v 1.4
9 2002/12/05 04:04:51
momjian Exp $
*
* NOTES
* For backward-compatibility purposes we have to allow there
...
...
@@ -190,11 +190,11 @@ extern void ExecuteGrantStmt(GrantStmt *stmt);
extern
AclId
get_grosysid
(
char
*
groname
);
extern
char
*
get_groname
(
AclId
grosysid
);
extern
AclResult
pg_class_aclcheck
(
Oid
table_oid
,
Oi
d
userid
,
AclMode
mode
);
extern
AclResult
pg_database_aclcheck
(
Oid
db_oid
,
Oi
d
userid
,
AclMode
mode
);
extern
AclResult
pg_proc_aclcheck
(
Oid
proc_oid
,
Oi
d
userid
,
AclMode
mode
);
extern
AclResult
pg_language_aclcheck
(
Oid
lang_oid
,
Oi
d
userid
,
AclMode
mode
);
extern
AclResult
pg_namespace_aclcheck
(
Oid
nsp_oid
,
Oi
d
userid
,
AclMode
mode
);
extern
AclResult
pg_class_aclcheck
(
Oid
table_oid
,
AclI
d
userid
,
AclMode
mode
);
extern
AclResult
pg_database_aclcheck
(
Oid
db_oid
,
AclI
d
userid
,
AclMode
mode
);
extern
AclResult
pg_proc_aclcheck
(
Oid
proc_oid
,
AclI
d
userid
,
AclMode
mode
);
extern
AclResult
pg_language_aclcheck
(
Oid
lang_oid
,
AclI
d
userid
,
AclMode
mode
);
extern
AclResult
pg_namespace_aclcheck
(
Oid
nsp_oid
,
AclI
d
userid
,
AclMode
mode
);
extern
void
aclcheck_error
(
AclResult
errcode
,
const
char
*
objectname
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment