Skip to content

Commit f4122a8

Browse files
committed
Add a hook in ExecCheckRTPerms().
This hook allows a loadable module to gain control when table permissions are checked. It is expected to be used by an eventual SE-PostgreSQL implementation, but there are other possible applications as well. A sample contrib module can be found in the archives at: http://archives.postgresql.org/pgsql-hackers/2010-05/msg01095.php Robert Haas and Stephen Frost
1 parent b40466c commit f4122a8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/backend/executor/execMain.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.349 2010/04/28 16:10:42 heikki Exp $
29+
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.350 2010/07/09 14:06:01 rhaas Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -63,6 +63,9 @@ ExecutorStart_hook_type ExecutorStart_hook = NULL;
6363
ExecutorRun_hook_type ExecutorRun_hook = NULL;
6464
ExecutorEnd_hook_type ExecutorEnd_hook = NULL;
6565

66+
/* Hook for plugin to get control in ExecCheckRTPerms() */
67+
ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook = NULL;
68+
6669
/* decls for local routines only used within this module */
6770
static void InitPlan(QueryDesc *queryDesc, int eflags);
6871
static void ExecEndPlan(PlanState *planstate, EState *estate);
@@ -416,6 +419,9 @@ ExecCheckRTPerms(List *rangeTable)
416419
{
417420
ExecCheckRTEPerms((RangeTblEntry *) lfirst(l));
418421
}
422+
423+
if (ExecutorCheckPerms_hook)
424+
(*ExecutorCheckPerms_hook)(rangeTable);
419425
}
420426

421427
/*

src/include/executor/executor.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.168 2010/02/26 02:01:24 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.169 2010/07/09 14:06:01 rhaas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -74,6 +74,10 @@ extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook;
7474
typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc);
7575
extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook;
7676

77+
/* Hook for plugins to get control in ExecCheckRTPerms() */
78+
typedef void (*ExecutorCheckPerms_hook_type) (List *);
79+
extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook;
80+
7781

7882
/*
7983
* prototypes from functions in execAmi.c

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy