Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 02838682EAC for ; Sat, 3 Dec 2011 10:57:00 -0400 (AST) Received: from [2001:1528:137::f1] (helo=mail.gransy.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RWr1P-000765-ER for pgsql-hackers@postgreSQL.org; Sat, 03 Dec 2011 14:57:00 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id DB5884A209A for ; Sat, 3 Dec 2011 15:56:46 +0100 (CET) Received: from mail.gransy.com ([82.208.29.194]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id T9+pAOQShe2O for ; Sat, 3 Dec 2011 15:56:46 +0100 (CET) Received: from [192.168.1.237] (ip-78-45-133-255.net.upcbroadband.cz [78.45.133.255]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id A73084A2095 for ; Sat, 3 Dec 2011 15:56:46 +0100 (CET) Message-ID: <4EDA38AE.5030003@fuzzy.cz> Date: Sat, 03 Dec 2011 15:56:46 +0100 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: pgsql-hackers@postgreSQL.org Subject: why local_preload_libraries does require a separate directory ? Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:1528:137::f1 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201112/116 X-Sequence-Number: 199368 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