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
7415e083
Commit
7415e083
authored
Dec 01, 2005
by
Alvaro Herrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor some bits in aclchk.c in order to reduce code duplication.
parent
164442fe
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
310 additions
and
413 deletions
+310
-413
src/backend/catalog/aclchk.c
src/backend/catalog/aclchk.c
+271
-397
src/backend/catalog/pg_shdepend.c
src/backend/catalog/pg_shdepend.c
+17
-12
src/include/utils/acl.h
src/include/utils/acl.h
+22
-4
No files found.
src/backend/catalog/aclchk.c
View file @
7415e083
This diff is collapsed.
Click to expand it.
src/backend/catalog/pg_shdepend.c
View file @
7415e083
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.
5 2005/11/22 18:17:08 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.
6 2005/12/01 02:03:00 alvherre
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1122,6 +1122,7 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
...
@@ -1122,6 +1122,7 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
{
{
ObjectAddress
obj
;
ObjectAddress
obj
;
GrantObjectType
objtype
;
GrantObjectType
objtype
;
InternalGrant
istmt
;
/* Shouldn't happen */
/* Shouldn't happen */
case
SHARED_DEPENDENCY_PIN
:
case
SHARED_DEPENDENCY_PIN
:
...
@@ -1132,22 +1133,22 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
...
@@ -1132,22 +1133,22 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
switch
(
sdepForm
->
classid
)
switch
(
sdepForm
->
classid
)
{
{
case
RelationRelationId
:
case
RelationRelationId
:
objtype
=
ACL_OBJECT_RELATION
;
istmt
.
objtype
=
ACL_OBJECT_RELATION
;
break
;
break
;
case
DatabaseRelationId
:
case
DatabaseRelationId
:
objtype
=
ACL_OBJECT_DATABASE
;
istmt
.
objtype
=
ACL_OBJECT_DATABASE
;
break
;
break
;
case
ProcedureRelationId
:
case
ProcedureRelationId
:
objtype
=
ACL_OBJECT_FUNCTION
;
istmt
.
objtype
=
ACL_OBJECT_FUNCTION
;
break
;
break
;
case
LanguageRelationId
:
case
LanguageRelationId
:
objtype
=
ACL_OBJECT_LANGUAGE
;
istmt
.
objtype
=
ACL_OBJECT_LANGUAGE
;
break
;
break
;
case
NamespaceRelationId
:
case
NamespaceRelationId
:
objtype
=
ACL_OBJECT_NAMESPACE
;
istmt
.
objtype
=
ACL_OBJECT_NAMESPACE
;
break
;
break
;
case
TableSpaceRelationId
:
case
TableSpaceRelationId
:
objtype
=
ACL_OBJECT_TABLESPACE
;
istmt
.
objtype
=
ACL_OBJECT_TABLESPACE
;
break
;
break
;
default:
default:
elog
(
ERROR
,
"unexpected object type %d"
,
elog
(
ERROR
,
"unexpected object type %d"
,
...
@@ -1156,11 +1157,15 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
...
@@ -1156,11 +1157,15 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
objtype
=
(
GrantObjectType
)
0
;
objtype
=
(
GrantObjectType
)
0
;
break
;
break
;
}
}
istmt
.
is_grant
=
false
;
ExecGrantStmt_oids
(
false
,
objtype
,
istmt
.
objects
=
list_make1_oid
(
sdepForm
->
objid
);
list_make1_oid
(
sdepForm
->
objid
),
true
,
istmt
.
all_privs
=
true
;
ACL_NO_RIGHTS
,
list_make1_oid
(
roleid
),
istmt
.
privileges
=
ACL_NO_RIGHTS
;
false
,
DROP_CASCADE
);
istmt
.
grantees
=
list_make1_oid
(
roleid
);
istmt
.
grant_option
=
false
;
istmt
.
behavior
=
DROP_CASCADE
;
ExecGrantStmt_oids
(
&
istmt
);
break
;
break
;
case
SHARED_DEPENDENCY_OWNER
:
case
SHARED_DEPENDENCY_OWNER
:
...
...
src/include/utils/acl.h
View file @
7415e083
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.9
0 2005/11/22 18:17:31 momjian
Exp $
* $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.9
1 2005/12/01 02:03:01 alvherre
Exp $
*
*
* NOTES
* NOTES
* An ACL array is simply an array of AclItems, representing the union
* An ACL array is simply an array of AclItems, representing the union
...
@@ -181,6 +181,26 @@ typedef enum AclObjectKind
...
@@ -181,6 +181,26 @@ typedef enum AclObjectKind
MAX_ACL_KIND
/* MUST BE LAST */
MAX_ACL_KIND
/* MUST BE LAST */
}
AclObjectKind
;
}
AclObjectKind
;
/*
* The information about one Grant/Revoke statement, in internal format: object
* and grantees names have been turned into Oids, the privilege list is an
* AclMode bitmask. If 'privileges' is ACL_NO_RIGHTS (the 0 value) and
* all_privs is true, it will be internally turned into the right kind of
* ACL_ALL_RIGHTS_*, depending on the object type (NB - this will modify the
* InternalGrant struct!)
*/
typedef
struct
{
bool
is_grant
;
GrantObjectType
objtype
;
List
*
objects
;
bool
all_privs
;
AclMode
privileges
;
List
*
grantees
;
bool
grant_option
;
DropBehavior
behavior
;
}
InternalGrant
;
/*
/*
* routines used internally
* routines used internally
*/
*/
...
@@ -221,9 +241,7 @@ extern Datum hash_aclitem(PG_FUNCTION_ARGS);
...
@@ -221,9 +241,7 @@ extern Datum hash_aclitem(PG_FUNCTION_ARGS);
* prototypes for functions in aclchk.c
* prototypes for functions in aclchk.c
*/
*/
extern
void
ExecuteGrantStmt
(
GrantStmt
*
stmt
);
extern
void
ExecuteGrantStmt
(
GrantStmt
*
stmt
);
extern
void
ExecGrantStmt_oids
(
bool
is_grant
,
GrantObjectType
objtype
,
extern
void
ExecGrantStmt_oids
(
InternalGrant
*
istmt
);
List
*
objects
,
bool
all_privs
,
AclMode
privileges
,
List
*
grantees
,
bool
grant_option
,
DropBehavior
behavior
);
extern
AclMode
pg_class_aclmask
(
Oid
table_oid
,
Oid
roleid
,
extern
AclMode
pg_class_aclmask
(
Oid
table_oid
,
Oid
roleid
,
AclMode
mask
,
AclMaskHow
how
);
AclMode
mask
,
AclMaskHow
how
);
...
...
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