Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 741e952

Browse files
committed
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.
1 parent 56f3fb3 commit 741e952

File tree

1 file changed

+19
-1
lines changed
  • src/backend/utils/adt

1 file changed

+19
-1
lines changed

src/backend/utils/adt/tid.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.57 2007/01/05 22:19:42 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.58 2007/08/27 00:57:36 tgl Exp $
1212
*
1313
* NOTES
1414
* input routine largely stolen from boxin().
@@ -24,7 +24,9 @@
2424
#include "catalog/namespace.h"
2525
#include "catalog/pg_type.h"
2626
#include "libpq/pqformat.h"
27+
#include "miscadmin.h"
2728
#include "parser/parsetree.h"
29+
#include "utils/acl.h"
2830
#include "utils/builtins.h"
2931

3032

@@ -326,6 +328,7 @@ currtid_byreloid(PG_FUNCTION_ARGS)
326328
ItemPointer tid = PG_GETARG_ITEMPOINTER(1);
327329
ItemPointer result;
328330
Relation rel;
331+
AclResult aclresult;
329332

330333
result = (ItemPointer) palloc(sizeof(ItemPointerData));
331334
if (!reloid)
@@ -335,6 +338,13 @@ currtid_byreloid(PG_FUNCTION_ARGS)
335338
}
336339

337340
rel = heap_open(reloid, AccessShareLock);
341+
342+
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
343+
ACL_SELECT);
344+
if (aclresult != ACLCHECK_OK)
345+
aclcheck_error(aclresult, ACL_KIND_CLASS,
346+
RelationGetRelationName(rel));
347+
338348
if (rel->rd_rel->relkind == RELKIND_VIEW)
339349
return currtid_for_view(rel, tid);
340350

@@ -354,9 +364,17 @@ currtid_byrelname(PG_FUNCTION_ARGS)
354364
ItemPointer result;
355365
RangeVar *relrv;
356366
Relation rel;
367+
AclResult aclresult;
357368

358369
relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname));
359370
rel = heap_openrv(relrv, AccessShareLock);
371+
372+
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
373+
ACL_SELECT);
374+
if (aclresult != ACLCHECK_OK)
375+
aclcheck_error(aclresult, ACL_KIND_CLASS,
376+
RelationGetRelationName(rel));
377+
360378
if (rel->rd_rel->relkind == RELKIND_VIEW)
361379
return currtid_for_view(rel, tid);
362380

0 commit comments

Comments
 (0)