]> 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:33 +0000 (09:33 -0500)
commit820ab11fbfd508fc75a39c43ad2c1b3e79c4982b
treeda6ccc56e89c3f83bb5ca76eb53a68fedf00bfc5
parentc38c3080cb43e78bd1d082ad1ec3ad2af89c2601
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