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
c1003339
Commit
c1003339
authored
Aug 07, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix permission checking for temp-table namespace.
parent
dfef56a9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
33 deletions
+31
-33
src/backend/catalog/aclchk.c
src/backend/catalog/aclchk.c
+8
-1
src/backend/commands/indexcmds.c
src/backend/commands/indexcmds.c
+3
-3
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+3
-3
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+7
-11
src/backend/tcop/utility.c
src/backend/tcop/utility.c
+10
-15
No files found.
src/backend/catalog/aclchk.c
View file @
c1003339
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.7
3 2002/08/05 03:29:16
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.7
4 2002/08/07 21:45:01
tgl Exp $
*
* NOTES
* See acl.h.
...
...
@@ -1163,6 +1163,13 @@ pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode)
bool
isNull
;
Acl
*
acl
;
/*
* If we have been assigned this namespace as a temp namespace,
* assume we have all grantable privileges on it.
*/
if
(
isTempNamespace
(
nsp_oid
))
return
ACLCHECK_OK
;
/* Superusers bypass all permission checking. */
if
(
superuser_arg
(
userid
))
return
ACLCHECK_OK
;
...
...
src/backend/commands/indexcmds.c
View file @
c1003339
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.8
0 2002/08/02 18:15:06
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.8
1 2002/08/07 21:45:01
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -119,9 +119,9 @@ DefineIndex(RangeVar *heapRelation,
* Verify we (still) have CREATE rights in the rel's namespace.
* (Presumably we did when the rel was created, but maybe not anymore.)
* Skip check if bootstrapping, since permissions machinery may not
* be working yet
; also, always allow if it's a temp table
.
* be working yet.
*/
if
(
!
IsBootstrapProcessingMode
()
&&
!
isTempNamespace
(
namespaceId
)
)
if
(
!
IsBootstrapProcessingMode
())
{
AclResult
aclresult
;
...
...
src/backend/commands/tablecmds.c
View file @
c1003339
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.2
7 2002/08/05 03:29:17
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.2
8 2002/08/07 21:45:01
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -115,11 +115,11 @@ DefineRelation(CreateStmt *stmt, char relkind)
* Look up the namespace in which we are supposed to create the
* relation. Check we have permission to create there.
* Skip check if bootstrapping, since permissions machinery may not
* be working yet
; also, always allow if it's a temp table
.
* be working yet.
*/
namespaceId
=
RangeVarGetCreationNamespace
(
stmt
->
relation
);
if
(
!
IsBootstrapProcessingMode
()
&&
!
isTempNamespace
(
namespaceId
)
)
if
(
!
IsBootstrapProcessingMode
())
{
AclResult
aclresult
;
...
...
src/backend/executor/execMain.c
View file @
c1003339
...
...
@@ -27,7 +27,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.17
2 2002/08/04 05:04:39 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.17
3 2002/08/07 21:45:02 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -696,6 +696,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
{
char
*
intoName
;
Oid
namespaceId
;
AclResult
aclresult
;
Oid
intoRelationId
;
TupleDesc
tupdesc
;
...
...
@@ -705,16 +706,11 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
intoName
=
parseTree
->
into
->
relname
;
namespaceId
=
RangeVarGetCreationNamespace
(
parseTree
->
into
);
if
(
!
isTempNamespace
(
namespaceId
))
{
AclResult
aclresult
;
aclresult
=
pg_namespace_aclcheck
(
namespaceId
,
GetUserId
(),
ACL_CREATE
);
if
(
aclresult
!=
ACLCHECK_OK
)
aclcheck_error
(
aclresult
,
get_namespace_name
(
namespaceId
));
}
aclresult
=
pg_namespace_aclcheck
(
namespaceId
,
GetUserId
(),
ACL_CREATE
);
if
(
aclresult
!=
ACLCHECK_OK
)
aclcheck_error
(
aclresult
,
get_namespace_name
(
namespaceId
));
/*
* new "INTO" table is created WITH OIDS
...
...
src/backend/tcop/utility.c
View file @
c1003339
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.16
8 2002/08/04 04:31:44 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.16
9 2002/08/07 21:45:02 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -399,22 +399,17 @@ ProcessUtility(Node *parsetree,
/*
* RENAME TABLE requires that we (still) hold CREATE
* rights on the containing namespace, as well as
* ownership of the table. But skip check for
* temp tables.
* ownership of the table.
*/
Oid
namespaceId
=
get_rel_namespace
(
relid
);
if
(
!
isTempNamespace
(
namespaceId
))
{
AclResult
aclresult
;
aclresult
=
pg_namespace_aclcheck
(
namespaceId
,
GetUserId
(),
ACL_CREATE
);
if
(
aclresult
!=
ACLCHECK_OK
)
aclcheck_error
(
aclresult
,
get_namespace_name
(
namespaceId
));
}
AclResult
aclresult
;
aclresult
=
pg_namespace_aclcheck
(
namespaceId
,
GetUserId
(),
ACL_CREATE
);
if
(
aclresult
!=
ACLCHECK_OK
)
aclcheck_error
(
aclresult
,
get_namespace_name
(
namespaceId
));
renamerel
(
relid
,
stmt
->
newname
);
break
;
...
...
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