summaryrefslogtreecommitdiff
path: root/src/backend/commands/proclang.c
diff options
context:
space:
mode:
authorTom Lane2012-05-31 03:47:57 +0000
committerTom Lane2012-05-31 03:47:57 +0000
commitad0009e7be27489f5acc0a36217d9ea8f3db2b14 (patch)
tree58c61395dce59e0f24c8850a8abe33d26358571a /src/backend/commands/proclang.c
parent33c6eaf78e692c0699e74a3883780d2edb68e4d7 (diff)
Force PL and range-type support functions to be owned by a superuser.
We allow non-superusers to create procedural languages (with restrictions) and range datatypes. Previously, the automatically-created support functions for these objects ended up owned by the creating user. This represents a rather considerable security hazard, because the owning user might be able to alter a support function's definition in such a way as to crash the server, inject trojan-horse SQL code, or even execute arbitrary C code directly. It appears that right now the only actually exploitable problem is the infinite-recursion bug fixed in the previous patch for CVE-2012-2655. However, it's not hard to imagine that future additions of more ALTER FUNCTION capability might unintentionally open up new hazards. To forestall future problems, cause these support functions to be owned by the bootstrap superuser, not the user creating the parent object.
Diffstat (limited to 'src/backend/commands/proclang.c')
-rw-r--r--src/backend/commands/proclang.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 41775fd8674..5d2e7dc1951 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -18,6 +18,7 @@
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/objectaccess.h"
+#include "catalog/pg_authid.h"
#include "catalog/pg_language.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_pltemplate.h"
@@ -124,6 +125,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
false, /* replace */
false, /* returnsSet */
LANGUAGE_HANDLEROID,
+ BOOTSTRAP_SUPERUSERID,
ClanguageId,
F_FMGR_C_VALIDATOR,
pltemplate->tmplhandler,
@@ -160,6 +162,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
false, /* replace */
false, /* returnsSet */
VOIDOID,
+ BOOTSTRAP_SUPERUSERID,
ClanguageId,
F_FMGR_C_VALIDATOR,
pltemplate->tmplinline,
@@ -199,6 +202,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
false, /* replace */
false, /* returnsSet */
VOIDOID,
+ BOOTSTRAP_SUPERUSERID,
ClanguageId,
F_FMGR_C_VALIDATOR,
pltemplate->tmplvalidator,