aboutsummaryrefslogtreecommitdiff
path: root/contrib/sepgsql/hooks.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-04-04 13:25:42 -0400
committerRobert Haas <rhaas@postgresql.org>2011-04-04 13:25:42 -0400
commit595a441ae999fb155a381fa4bcceadf40f041a33 (patch)
tree909c31644c86574d83243361ca2063482ff787a5 /contrib/sepgsql/hooks.c
parenta0e50e698beb89a8ec203303581e464a5f69fc41 (diff)
downloadpostgresql-595a441ae999fb155a381fa4bcceadf40f041a33.tar.gz
postgresql-595a441ae999fb155a381fa4bcceadf40f041a33.zip
Add missing check on invocation of trusted procedures.
KaiGai Kohei
Diffstat (limited to 'contrib/sepgsql/hooks.c')
-rw-r--r--contrib/sepgsql/hooks.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c
index 83a505ec18d..27e85d25b1d 100644
--- a/contrib/sepgsql/hooks.c
+++ b/contrib/sepgsql/hooks.c
@@ -251,6 +251,7 @@ sepgsql_fmgr_hook(FmgrHookEventType event,
if (!stack)
{
MemoryContext oldcxt;
+ const char *cur_label = sepgsql_get_client_label();
oldcxt = MemoryContextSwitchTo(flinfo->fn_mcxt);
stack = palloc(sizeof(*stack));
@@ -260,6 +261,19 @@ sepgsql_fmgr_hook(FmgrHookEventType event,
MemoryContextSwitchTo(oldcxt);
+ if (strcmp(cur_label, stack->new_label) != 0)
+ {
+ /*
+ * process:transition permission between old and new
+ * label, when user tries to switch security label of
+ * the client on execution of trusted procedure.
+ */
+ sepgsql_check_perms(cur_label, stack->new_label,
+ SEPG_CLASS_PROCESS,
+ SEPG_PROCESS__TRANSITION,
+ NULL, true);
+ }
+
*private = PointerGetDatum(stack);
}
Assert(!stack->old_label);