Skip to content

Commit

Permalink
Fixed a couple incompatibilities with 7.3.2 that crept in.
Browse files Browse the repository at this point in the history
REVOKE EXECUTE ON FUNCTION plr_environ() FROM PUBLIC to avoid security
problems from non-priv users seeing the environment.

Updated docs for changes since 0.3.1
  • Loading branch information
postgres committed May 1, 2003
1 parent b0bf1b1 commit 9540c61
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 18 deletions.
45 changes: 35 additions & 10 deletions doc/plr.sgml
Expand Up @@ -56,13 +56,11 @@

<note>
<para>
PL/R should build cleanly with PostgreSQL 7.3.x. It was developed using libR
from R 1.6.2 under Red Hat 7.3 & 8.0.
</para>

<para>
PL/R has also passed its regression test with PostgreSQL 7.4devel and
R 1.7devel under Red Hat 7.3 & 8.0.
PL/R should build cleanly with PostgreSQL 7.3.x, and 7.4devel. It was
initially developed using libR from R 1.6.2 under Red Hat 7.3 & 8.0. PL/R
has also passed its regression test with R 1.7.0 under Red Hat 7.3 & 8.0.
On Red Hat 9, the R-patched (R 1.7.0 with subsequent release 1.7.x patches)
distribution is required (and passes `make installcheck`).
</para>
</note>

Expand Down Expand Up @@ -790,7 +788,21 @@ select * from test_spi_execp('sp') as t(typeid oid, typename name);
</varlistentry>

<varlistentry>
<term><function>array</function>
<term><function>reload_plr_modules</function>
()
</term>
<listitem>
<para>
Force re-loading of R code from the <literal>plr_modules</literal>
table. It is useful after modifying the contents of
<literal>plr_modules</literal>, so that the change will have an
immediate effect.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><function>plr_singleton_array</function>
(<type>float8</type> <replaceable>first_element</replaceable>)
</term>
<listitem>
Expand Down Expand Up @@ -820,7 +832,7 @@ select array('hello','world');
</varlistentry>

<varlistentry>
<term><function>array_push</function>
<term><function>plr_array_push</function>
(<type>float8[]</type> <replaceable>array</replaceable>,
<type>float8</type> <replaceable>next_element</replaceable>)
</term>
Expand Down Expand Up @@ -849,7 +861,7 @@ select array_push(array('hello','world'), 'how are you');
</varlistentry>

<varlistentry>
<term><function>array_accum</function>
<term><function>plr_array_accum</function>
(<type>float8[]</type> <replaceable>state_value</replaceable>,
<type>float8</type> <replaceable>next_element</replaceable>)
</term>
Expand Down Expand Up @@ -896,6 +908,19 @@ select array_accum('{23,35}', 42);
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><function>plr_environ</function>()</term>
<listitem>
<para>
Displays the environment under which the Postmaster is currently
running. This may be useful to debug issues related to R specific
environment variables. This function is installed with EXECUTE
permission revoked from PUBLIC.
</para>
</listitem>
</varlistentry>

</variablelist>
</chapter>

Expand Down
3 changes: 1 addition & 2 deletions pg_backend_support.c
Expand Up @@ -182,8 +182,7 @@ void
perm_fmgr_info(Oid functionId, FmgrInfo *finfo)
{
fmgr_info_cxt(functionId, finfo, TopMemoryContext);
finfo->fn_mcxt = thisQueryContext;
finfo->fn_expr = (Node *) NULL;
INIT_AUX_FMGR_ATTS;
}

void
Expand Down
2 changes: 1 addition & 1 deletion pg_userfuncs.c
Expand Up @@ -295,7 +295,7 @@ plr_environ(PG_FUNCTION_ARGS)
rsinfo->returnMode = SFRM_Materialize;

/* initialize our tuplestore */
tupstore = tuplestore_begin_heap(true, false, SortMem);
tupstore = TUPLESTORE_BEGIN_HEAP;

for (current_env = environ;
current_env != NULL && *current_env != NULL;
Expand Down
17 changes: 12 additions & 5 deletions plr.h
Expand Up @@ -194,7 +194,13 @@ extern SEXP R_ParseVector(SEXP, int, int *);
} while (0)

#define CHECK_POLYMORPHIC_TYPES
#define thisQueryContext QueryContext

#define INIT_AUX_FMGR_ATTS \
do { \
finfo->fn_mcxt = QueryContext; \
} while (0)

#define palloc0(sz_) palloc(sz_)

#else
/*************************************************************************
Expand Down Expand Up @@ -251,10 +257,11 @@ extern SEXP R_ParseVector(SEXP, int, int *);
} \
} while (0)

#define thisQueryContext MessageContext
#undef thisQueryContext /* temporary until Tom's mcxt changes are committed */
#define thisQueryContext QueryContext

#define INIT_AUX_FMGR_ATTS \
do { \
finfo->fn_mcxt = QueryContext; \
finfo->fn_expr = (Node *) NULL; \
} while (0)

#endif /* PG_VERSION_73_COMPAT */

Expand Down
2 changes: 2 additions & 0 deletions plr.sql.in
Expand Up @@ -37,6 +37,8 @@ RETURNS SETOF plr_environ_type
AS 'MODULE_PATHNAME','plr_environ'
LANGUAGE 'C';

REVOKE EXECUTE ON FUNCTION plr_environ() FROM PUBLIC;

CREATE TYPE r_typename AS (typename text, typeoid oid);
CREATE OR REPLACE FUNCTION r_typenames()
RETURNS SETOF r_typename AS '
Expand Down

0 comments on commit 9540c61

Please sign in to comment.