Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc727f51

Browse files
committed
Refactor aclcheck functions
Instead of dozens of mostly-duplicate pg_foo_aclcheck() functions,write one common function object_aclcheck() that can handle almost allof them. We already have all the information we need, such as whichsystem catalog corresponds to which catalog table and which column isthe ACL column.There are a few pg_foo_aclcheck() that don't work via the genericfunction and have special APIs, so those stay as is.I also changed most pg_foo_aclmask() functions to static functions,since they are not used outside of aclchk.c.Reviewed-by: Corey Huinker <corey.huinker@gmail.com>Reviewed-by: Antonin Houska <ah@cybertec.at>Discussion:https://www.postgresql.org/message-id/flat/95c30f96-4060-2f48-98b5-a4392d3b6066@enterprisedb.com
1 parentafbfc02 commitc727f51

37 files changed

+319
-682
lines changed

‎contrib/dblink/dblink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,7 @@ get_connect_string(const char *servername)
28382838
fdw=GetForeignDataWrapper(fdwid);
28392839

28402840
/* Check permissions, user must have usage on the server. */
2841-
aclresult=pg_foreign_server_aclcheck(serverid,userid,ACL_USAGE);
2841+
aclresult=object_aclcheck(ForeignServerRelationId,serverid,userid,ACL_USAGE);
28422842
if (aclresult!=ACLCHECK_OK)
28432843
aclcheck_error(aclresult,OBJECT_FOREIGN_SERVER,foreign_server->servername);
28442844

‎src/backend/access/common/tupdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ BuildDescForRelation(List *schema)
821821
attname=entry->colname;
822822
typenameTypeIdAndMod(NULL,entry->typeName,&atttypid,&atttypmod);
823823

824-
aclresult=pg_type_aclcheck(atttypid,GetUserId(),ACL_USAGE);
824+
aclresult=object_aclcheck(TypeRelationId,atttypid,GetUserId(),ACL_USAGE);
825825
if (aclresult!=ACLCHECK_OK)
826826
aclcheck_error_type(aclresult,atttypid);
827827

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp