diff options
author | Robert Haas <rhaas@postgresql.org> | 2014-02-17 09:33:31 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2014-02-17 09:33:31 -0500 |
commit | 5f173040e324f6c2eebb90d86cf1b0cdb5890f0a (patch) | |
tree | 9c3d313acb74c092bc2664b862720f340460bb80 /src/include/commands | |
parent | 540b4e5bc85f7e44842493a810b04a84881db20f (diff) | |
download | postgresql-5f173040e324f6c2eebb90d86cf1b0cdb5890f0a.tar.gz postgresql-5f173040e324f6c2eebb90d86cf1b0cdb5890f0a.zip |
Avoid repeated name lookups during table and index DDL.
If the name lookups come to different conclusions due to concurrent
activity, we might perform some parts of the DDL on a different table
than other parts. At least in the case of CREATE INDEX, this can be
used to cause the permissions checks to be performed against a
different table than the index creation, allowing for a privilege
escalation attack.
This changes the calling convention for DefineIndex, CreateTrigger,
transformIndexStmt, transformAlterTableStmt, CheckIndexCompatible
(in 9.2 and newer), and AlterTable (in 9.1 and older). In addition,
CheckRelationOwnership is removed in 9.2 and newer and the calling
convention is changed in older branches. A field has also been added
to the Constraint node (FkConstraint in 8.4). Third-party code calling
these functions or using the Constraint node will require updating.
Report by Andres Freund. Patch by Robert Haas and Andres Freund,
reviewed by Tom Lane.
Security: CVE-2014-0062
Diffstat (limited to 'src/include/commands')
-rw-r--r-- | src/include/commands/defrem.h | 4 | ||||
-rw-r--r-- | src/include/commands/tablecmds.h | 2 | ||||
-rw-r--r-- | src/include/commands/trigger.h | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 0b1b2b7b78c..5ec9374aad0 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -21,7 +21,8 @@ extern void RemoveObjects(DropStmt *stmt); /* commands/indexcmds.c */ -extern Oid DefineIndex(IndexStmt *stmt, +extern Oid DefineIndex(Oid relationId, + IndexStmt *stmt, Oid indexRelationId, bool is_alter_table, bool check_rights, @@ -36,7 +37,6 @@ extern char *makeObjectName(const char *name1, const char *name2, extern char *ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid); extern bool CheckIndexCompatible(Oid oldId, - RangeVar *heapRelation, char *accessMethodName, List *attributeList, List *exclusionOpNames); diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index f90fca541e2..5c0518ce13b 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -78,4 +78,6 @@ extern void AtEOSubXact_on_commit_actions(bool isCommit, extern void RangeVarCallbackOwnsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg); +extern void RangeVarCallbackOwnsRelation(const RangeVar *relation, + Oid relId, Oid oldRelId, void *noCatalogs); #endif /* TABLECMDS_H */ diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index 44d686c6838..18cb128ed4d 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -109,7 +109,7 @@ extern PGDLLIMPORT int SessionReplicationRole; #define TRIGGER_DISABLED 'D' extern Oid CreateTrigger(CreateTrigStmt *stmt, const char *queryString, - Oid constraintOid, Oid indexOid, + Oid relOid, Oid refRelOid, Oid constraintOid, Oid indexOid, bool isInternal); extern void RemoveTriggerById(Oid trigOid); |