why local_preload_libraries does require a separate directory ? - Mailing list pgsql-hackers

From Tomas Vondra
Subject why local_preload_libraries does require a separate directory ?
Date
Msg-id 4EDA38AE.5030003@fuzzy.cz
Whole thread Raw
Responses Re: why local_preload_libraries does require a separate directory ?
List pgsql-hackers
Hi,

why the libraries loaded using local_preload_libraries need to be placed
in a different subdirectory than libraries loaded using
shared_preload_libraries?

And why it does not use dynamic_library_path but a hardcoded path
'$libdir/plugins'?

I do understand that leaving the users to load whatever libraries they
want is a bad idea, but when the library is loaded from postgresql.conf
it should be safe.

Therefore I'd expect / propose this behaviour:

1) libs loaded from shared_preload_libraries/local_preload_libraries
  - any paths are allowed (relative and absolute)  - relative paths are resolved using dynamic_library_path if
specified,$libdir otherwise  - absolute paths are allowed, may load libraries from other locations
 

2) libs loaded using LOAD
  - check that the library is loaded from dynamic_library_path (if    specified), $libdir otherwise


AFAIK this prevents '..' type attacks and makes it easier to install
extensions (shared libs are installed to $libdir, so if you need to load
a library using local_preload_libraries, you have to copy it manually).

Tomas


pgsql-hackers by date:

Previous
From: NISHIYAMA Tomoaki
Date:
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Next
From: Magnus Hagander
Date:
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64