mirror of
https://github.com/postgres/postgres.git
synced 2026-06-08 16:26:30 -04:00
fundamentally insecure. Instead apply an opmask to the whole interpreter that imposes restrictions on unsafe operations. These restrictions are much harder to subvert than is Safe.pm, since there is no container to be broken out of. Backported to release 7.4. In releases 7.4, 8.0 and 8.1 this also includes the necessary backporting of the two interpreters model for plperl and plperlu adopted in release 8.2. In versions 8.0 and up, the use of Perl's POSIX module to undo its locale mangling on Windows has become insecure with these changes, so it is replaced by our own routine, which is also faster. Nice side effects of the changes include that it is now possible to use perl's "strict" pragma in a natural way in plperl, and that perl's $a and $b variables now work as expected in sort routines, and that function compilation is significantly faster. Tim Bunce and Andrew Dunstan, with reviews from Alex Hunsaker and Alexey Klyukin. Security: CVE-2010-1169
100 lines
2.8 KiB
Makefile
100 lines
2.8 KiB
Makefile
# Makefile for PL/Perl
|
|
# $PostgreSQL: pgsql/src/pl/plperl/GNUmakefile,v 1.44 2010/05/13 16:39:43 adunstan Exp $
|
|
|
|
subdir = src/pl/plperl
|
|
top_builddir = ../../..
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
ifeq ($(perl_useshrplib),true)
|
|
shared_libperl = yes
|
|
endif
|
|
ifeq ($(perl_useshrplib),yes)
|
|
shared_libperl = yes
|
|
endif
|
|
|
|
# If we don't have a shared library and the platform doesn't allow it
|
|
# to work without, we have to skip it.
|
|
ifneq (,$(findstring yes, $(shared_libperl)$(allow_nonpic_in_shlib)))
|
|
|
|
ifeq ($(PORTNAME), win32)
|
|
perl_archlibexp := $(subst \,/,$(perl_archlibexp))
|
|
perl_privlibexp := $(subst \,/,$(perl_privlibexp))
|
|
perl_lib := $(basename $(notdir $(wildcard $(perl_archlibexp)/CORE/perl[5-9]*.lib)))
|
|
perl_embed_ldflags = -L$(perl_archlibexp)/CORE -l$(perl_lib)
|
|
override CPPFLAGS += -DPLPERL_HAVE_UID_GID
|
|
# Perl on win32 contains /* within comment all over the header file,
|
|
# so disable this warning.
|
|
override CFLAGS += -Wno-comment
|
|
endif
|
|
|
|
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE
|
|
|
|
rpathdir = $(perl_archlibexp)/CORE
|
|
|
|
|
|
NAME = plperl
|
|
|
|
OBJS = plperl.o SPI.o Util.o
|
|
|
|
PERLCHUNKS = plc_perlboot.pl plc_trusted.pl
|
|
|
|
SHLIB_LINK = $(perl_embed_ldflags)
|
|
|
|
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=plperl --load-language=plperlu
|
|
REGRESS = plperl plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu
|
|
# if Perl can support two interpreters in one backend,
|
|
# test plperl-and-plperlu cases
|
|
ifneq ($(PERL),)
|
|
ifeq ($(shell $(PERL) -V:usemultiplicity), usemultiplicity='define';)
|
|
REGRESS += plperl_plperlu
|
|
endif
|
|
endif
|
|
# where to find psql for running the tests
|
|
PSQLDIR = $(bindir)
|
|
|
|
include $(top_srcdir)/src/Makefile.shlib
|
|
|
|
plperl.o: perlchunks.h plperl_opmask.h
|
|
|
|
plperl_opmask.h: plperl_opmask.pl
|
|
$(PERL) $< $@
|
|
|
|
perlchunks.h: $(PERLCHUNKS)
|
|
$(PERL) $(srcdir)/text2macro.pl --strip='^(\#.*|\s*)$$' $^ > $@
|
|
|
|
all: all-lib
|
|
|
|
SPI.c: SPI.xs
|
|
$(PERL) $(perl_privlibexp)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap $< >$@
|
|
|
|
Util.c: Util.xs
|
|
$(PERL) $(perl_privlibexp)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap $< >$@
|
|
|
|
install: all installdirs install-lib
|
|
|
|
installdirs: installdirs-lib
|
|
|
|
uninstall: uninstall-lib
|
|
|
|
installcheck: submake
|
|
$(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir=$(PSQLDIR) $(REGRESS_OPTS) $(REGRESS)
|
|
|
|
.PHONY: submake
|
|
submake:
|
|
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
|
|
|
|
clean distclean maintainer-clean: clean-lib
|
|
rm -f SPI.c Util.c $(OBJS) perlchunks.h plperl_opmask.h
|
|
rm -rf results
|
|
rm -f regression.diffs regression.out
|
|
|
|
else # can't build
|
|
|
|
all:
|
|
@echo ""; \
|
|
echo "*** Cannot build PL/Perl because libperl is not a shared library."; \
|
|
echo "*** You might have to rebuild your Perl installation. Refer to"; \
|
|
echo "*** the documentation for details."; \
|
|
echo ""
|
|
|
|
endif # can't build
|