mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 00:03:09 -04:00
Make currtid() functions require SELECT privileges on the target table.
While it's not clear that TID linkage info is of any great use to a nefarious user, it's certainly unexpected that these functions wouldn't insist on read privileges.
This commit is contained in:
parent
56f3fb3ba1
commit
741e952b54
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.57 2007/01/05 22:19:42 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.58 2007/08/27 00:57:36 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* input routine largely stolen from boxin().
|
* input routine largely stolen from boxin().
|
||||||
@ -24,7 +24,9 @@
|
|||||||
#include "catalog/namespace.h"
|
#include "catalog/namespace.h"
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
#include "libpq/pqformat.h"
|
#include "libpq/pqformat.h"
|
||||||
|
#include "miscadmin.h"
|
||||||
#include "parser/parsetree.h"
|
#include "parser/parsetree.h"
|
||||||
|
#include "utils/acl.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
|
|
||||||
|
|
||||||
@ -326,6 +328,7 @@ currtid_byreloid(PG_FUNCTION_ARGS)
|
|||||||
ItemPointer tid = PG_GETARG_ITEMPOINTER(1);
|
ItemPointer tid = PG_GETARG_ITEMPOINTER(1);
|
||||||
ItemPointer result;
|
ItemPointer result;
|
||||||
Relation rel;
|
Relation rel;
|
||||||
|
AclResult aclresult;
|
||||||
|
|
||||||
result = (ItemPointer) palloc(sizeof(ItemPointerData));
|
result = (ItemPointer) palloc(sizeof(ItemPointerData));
|
||||||
if (!reloid)
|
if (!reloid)
|
||||||
@ -335,6 +338,13 @@ currtid_byreloid(PG_FUNCTION_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rel = heap_open(reloid, AccessShareLock);
|
rel = heap_open(reloid, AccessShareLock);
|
||||||
|
|
||||||
|
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
|
||||||
|
ACL_SELECT);
|
||||||
|
if (aclresult != ACLCHECK_OK)
|
||||||
|
aclcheck_error(aclresult, ACL_KIND_CLASS,
|
||||||
|
RelationGetRelationName(rel));
|
||||||
|
|
||||||
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
||||||
return currtid_for_view(rel, tid);
|
return currtid_for_view(rel, tid);
|
||||||
|
|
||||||
@ -354,9 +364,17 @@ currtid_byrelname(PG_FUNCTION_ARGS)
|
|||||||
ItemPointer result;
|
ItemPointer result;
|
||||||
RangeVar *relrv;
|
RangeVar *relrv;
|
||||||
Relation rel;
|
Relation rel;
|
||||||
|
AclResult aclresult;
|
||||||
|
|
||||||
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
|
||||||
rel = heap_openrv(relrv, AccessShareLock);
|
rel = heap_openrv(relrv, AccessShareLock);
|
||||||
|
|
||||||
|
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
|
||||||
|
ACL_SELECT);
|
||||||
|
if (aclresult != ACLCHECK_OK)
|
||||||
|
aclcheck_error(aclresult, ACL_KIND_CLASS,
|
||||||
|
RelationGetRelationName(rel));
|
||||||
|
|
||||||
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
||||||
return currtid_for_view(rel, tid);
|
return currtid_for_view(rel, tid);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user