Skip site navigation (1) Skip section navigation (2)

why local_preload_libraries does require a separate directory ?

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: why local_preload_libraries does require a separate directory ?
Date: 2011-12-03 14:56:46
Message-ID: 4EDA38AE.5030003@fuzzy.cz (view raw or flat)
Thread:
Lists: 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

Responses

pgsql-hackers by date

Next:From: Magnus HaganderDate: 2011-12-03 14:59:46
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Previous:From: NISHIYAMA TomoakiDate: 2011-12-03 14:49:47
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group