提交 239d6124 编写于 作者: D Dave Cramer

fix: allow classpath to be absolute

Previously the  classpath was relative
to $GPHOME/lib/postgresql/java/

The implication of this is that in order to reference jars outside
of this directory the classpath will look like ../../../ etc.

This patch retains that behaviour but adds the ability to use absolute
paths.

For security purposes changing the classpath can only be done by a
super user or set in postgresql.conf
上级 7afc98bc
......@@ -95,7 +95,20 @@ public class Loader extends ClassLoader
{
try
{
URL url = new URL("file:///" + jarpath + "/" + m_classpath[i]);
String path="file:///";
// Previous behaviour required that paths be relative to $GPHOME/lib/postgresql/java/
// if the user specifies a relative path we will respect that behaviour
if (!m_classpath[i].startsWith("/"))
{
path += jarpath + '/';
}
// add the classpath, note from above that if the path starts with /
// then the classpath will be absolute.
path += m_classpath[i];
URL url = new URL(path);
JarLoader loader = new JarLoader(this, url);
m_jarloaders.add(loader);
}
......
......@@ -7773,10 +7773,10 @@ static struct config_string ConfigureNamesString[] =
"", NULL, NULL
},
{
{"pljava_classpath", PGC_USERSET, CUSTOM_OPTIONS,
{"pljava_classpath", PGC_SUSET, CUSTOM_OPTIONS,
gettext_noop("classpath used by the the JVM"),
NULL,
GUC_GPDB_ADDOPT
GUC_GPDB_ADDOPT | GUC_NOT_IN_SAMPLE | GUC_SUPERUSER_ONLY
},
&pljava_classpath,
"", NULL, NULL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册