]> granicus.if.org Git - postgresql/commit
Avoid repeated name lookups during table and index DDL.
authorRobert Haas <rhaas@postgresql.org>
Mon, 17 Feb 2014 14:33:31 +0000 (09:33 -0500)
committerRobert Haas <rhaas@postgresql.org>
Mon, 17 Feb 2014 14:33:32 +0000 (09:33 -0500)
commite1e0a4d791292ebe9572451a6cf49fb0ccb320c7
tree1487eb31a138906ff2f30fa1d03be98188eb292a
parent30b1c40f98e5e4d0f3d8ec7673f3fbb8ae8ee43f
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
18 files changed:
src/backend/bootstrap/bootparse.y
src/backend/catalog/index.c
src/backend/catalog/pg_constraint.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/parser/parse_utilcmd.c
src/backend/tcop/utility.c
src/include/catalog/pg_constraint.h
src/include/commands/defrem.h
src/include/commands/tablecmds.h
src/include/commands/trigger.h
src/include/nodes/parsenodes.h
src/include/parser/parse_utilcmd.h
src/include/tcop/utility.h