Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
fe922de3
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fe922de3
编写于
4月 18, 2000
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Security fix for plperl.
上级
85736153
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
23 deletion
+21
-23
src/pl/plperl/Makefile.PL
src/pl/plperl/Makefile.PL
+1
-2
src/pl/plperl/plperl.c
src/pl/plperl/plperl.c
+20
-21
未找到文件。
src/pl/plperl/Makefile.PL
浏览文件 @
fe922de3
...
...
@@ -51,10 +51,9 @@ my $opcode = '';
}
my
$perllib
=
"
-L
$Config
{archlibexp}/CORE -lperl
";
my
$dynalib
=
"
$Config
{archlibexp}/auto/DynaLoader/DynaLoader.a
";
WriteMakefile
(
'
NAME
'
=>
'
plperl
',
dynamic_lib
=>
{
'
OTHERLDFLAGS
'
=>
"
$opcode
$perllib
$dynalib
"
}
,
dynamic_lib
=>
{
'
OTHERLDFLAGS
'
=>
"
$opcode
$perllib
"
}
,
INC
=>
'
-I$(SRCDIR)/include -I$(SRCDIR)/backend
',
XS
=>
{
'
SPI.xs
'
=>
'
SPI.c
'
},
OBJECT
=>
'
plperl.o eloglvl.o SPI.o
',
...
...
src/pl/plperl/plperl.c
浏览文件 @
fe922de3
...
...
@@ -219,7 +219,15 @@ static void
plperl_init_safe_interp
(
void
)
{
char
*
embedding
[]
=
{
""
,
"-e"
,
"use DynaLoader; require Safe; SPI::bootstrap()"
,
"0"
};
char
*
embedding
[
3
]
=
{
""
,
"-e"
,
/* no commas between the next 4 please. They are supposed to be one string
*/
"require Safe; SPI::bootstrap();"
"sub ::mksafefunc { my $x = new Safe; $x->permit_only(':default');"
"$x->share(qw[&elog &DEBUG &NOTICE &NOIND &ERROR]);"
" return $x->reval(qq[sub { $_[0] }]); }"
};
plperl_safe_interp
=
perl_alloc
();
if
(
!
plperl_safe_interp
)
...
...
@@ -302,16 +310,19 @@ plperl_call_handler(FmgrInfo *proinfo,
**********************************************************************/
static
SV
*
plperl_create_sub
(
SV
*
s
)
plperl_create_sub
(
char
*
s
)
{
dSP
;
SV
*
subref
=
NULL
;
int
count
;
ENTER
;
SAVETMPS
;
PUSHMARK
(
SP
);
perl_eval_sv
(
s
,
G_SCALAR
|
G_EVAL
|
G_KEEPERR
);
XPUSHs
(
sv_2mortal
(
newSVpv
(
s
,
0
)));
PUTBACK
;
count
=
perl_call_pv
(
"mksafefunc"
,
G_SCALAR
|
G_EVAL
|
G_KEEPERR
);
SPAGAIN
;
if
(
SvTRUE
(
GvSV
(
errgv
)))
...
...
@@ -323,6 +334,10 @@ plperl_create_sub(SV * s)
elog
(
ERROR
,
"creation of function failed : %s"
,
SvPV
(
GvSV
(
errgv
),
na
));
}
if
(
count
!=
1
)
{
elog
(
ERROR
,
"creation of function failed - no return from mksafefunc"
);
}
/*
* need to make a deep copy of the return. it comes off the stack as a
* temporary.
...
...
@@ -357,7 +372,6 @@ plperl_create_sub(SV * s)
*
**********************************************************************/
extern
void
boot_DynaLoader
_
((
CV
*
cv
));
extern
void
boot_Opcode
_
((
CV
*
cv
));
extern
void
boot_SPI
_
((
CV
*
cv
));
...
...
@@ -366,7 +380,6 @@ plperl_init_shared_libs(void)
{
char
*
file
=
__FILE__
;
newXS
(
"DynaLoader::bootstrap"
,
boot_DynaLoader
,
file
);
newXS
(
"Opcode::bootstrap"
,
boot_Opcode
,
file
);
newXS
(
"SPI::bootstrap"
,
boot_SPI
,
file
);
}
...
...
@@ -492,8 +505,6 @@ plperl_func_handler(FmgrInfo *proinfo,
HeapTuple
typeTup
;
Form_pg_proc
procStruct
;
Form_pg_type
typeStruct
;
SV
*
proc_internal_def
;
char
proc_internal_args
[
4096
];
char
*
proc_source
;
/************************************************************
...
...
@@ -550,7 +561,6 @@ plperl_func_handler(FmgrInfo *proinfo,
* of all procedure arguments
************************************************************/
prodesc
->
nargs
=
proinfo
->
fn_nargs
;
proc_internal_args
[
0
]
=
'\0'
;
for
(
i
=
0
;
i
<
proinfo
->
fn_nargs
;
i
++
)
{
typeTup
=
SearchSysCacheTuple
(
TYPEOID
,
...
...
@@ -584,23 +594,12 @@ plperl_func_handler(FmgrInfo *proinfo,
************************************************************/
proc_source
=
textout
(
&
(
procStruct
->
prosrc
));
/*
* the string has been split for readbility. please don't put
* commas between them. Hope everyone is ANSI
*/
proc_internal_def
=
newSVpvf
(
"$::x = new Safe;"
"$::x->permit_only(':default');"
"$::x->share(qw[&elog &DEBUG &NOTICE &NOIND &ERROR]);"
"use strict;"
"return $::x->reval( q[ sub { %s } ]);"
,
proc_source
);
pfree
(
proc_source
);
/************************************************************
* Create the procedure in the interpreter
************************************************************/
prodesc
->
reference
=
plperl_create_sub
(
proc_internal_def
);
prodesc
->
reference
=
plperl_create_sub
(
proc_source
);
pfree
(
proc_source
);
if
(
!
prodesc
->
reference
)
{
free
(
prodesc
->
proname
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录