Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a41e46b

Browse filesBrowse files
committed
Require SELECT privilege on a table to do dblink_get_pkey(). This is
not all that exciting when the system catalogs are readable by all, but some people try to lock them down, and would not like this sort of end run ...
1 parent cc26599 commit a41e46b
Copy full SHA for a41e46b

File tree

Expand file treeCollapse file tree

1 file changed

+11
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-2
lines changed

‎contrib/dblink/dblink.c

Copy file name to clipboardExpand all lines: contrib/dblink/dblink.c
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Darko Prenosil <Darko.Prenosil@finteh.hr>
99
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
1010
*
11-
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.64 2007/07/08 17:12:38 joe Exp $
11+
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.65 2007/08/27 01:24:50 tgl Exp $
1212
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
1313
* ALL RIGHTS RESERVED;
1414
*
@@ -51,6 +51,7 @@
5151
#include "nodes/pg_list.h"
5252
#include "parser/parse_type.h"
5353
#include "tcop/tcopprot.h"
54+
#include "utils/acl.h"
5455
#include "utils/array.h"
5556
#include "utils/builtins.h"
5657
#include "utils/dynahash.h"
@@ -1686,9 +1687,17 @@ get_pkey_attnames(Oid relid, int16 *numatts)
16861687
char **result = NULL;
16871688
Relation rel;
16881689
TupleDesc tupdesc;
1690+
AclResult aclresult;
16891691

1690-
/* open relation using relid, get tupdesc */
1692+
/* open relation using relid, check permissions, get tupdesc */
16911693
rel = relation_open(relid, AccessShareLock);
1694+
1695+
aclresult = pg_class_aclcheck(RelationGetRelid(rel), GetUserId(),
1696+
ACL_SELECT);
1697+
if (aclresult != ACLCHECK_OK)
1698+
aclcheck_error(aclresult, ACL_KIND_CLASS,
1699+
RelationGetRelationName(rel));
1700+
16921701
tupdesc = rel->rd_att;
16931702

16941703
/* initialize numatts to 0 in case no primary key exists */

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.