[glom] Revert "Self hosting: Avoid use of unix-domain sockets."



commit 6eae2818f77e08f703bd1b4ffa23bff2cdd865f8
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Oct 29 08:38:00 2012 +0100

    Revert "Self hosting: Avoid use of unix-domain sockets."
    
    This reverts commit 145bc61b7fde6048884a8e94174ba9b412d3e24e.
    
    Conflicts:
    	ChangeLog
    	glom/libglom/connectionpool_backends/postgres_self.cc
    
    Bring back unix-domain sockets because TCP connections with trust
    are not specific to a single user on multiuser systems.

 ChangeLog                                          |   13 -------------
 .../connectionpool_backends/postgres_self.cc       |   20 +++++++++-----------
 2 files changed, 9 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2062b09..a5ce183 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,19 +8,6 @@
 	from non-localhost. This also removes the use of the deprecated 
 	postgres -i option.
 
-2012-10-25  Murray Cumming  <murrayc murrayc com>
-
-        Self hosting: Avoid use of unix-domain sockets.
-
-        * glom/libglom/connectionpool_backends/postgres_self.cc:
-	Use -k '' with the postgres executable, and remove any local lines in
-	pg_hba.conf, to (hopefully, presumably) allow only TCP connections
-	and no unix-domain socket connections.
-	This avoids the new restricitons on the characters allowed in the 
-	path given to -k (unix_socket_directory or unix_socket_directories 
-	in postgresql.conf).
-	Therefore, this fixes the tests on Fedora 17.
-
 2012-08-31  Murray Cumming  <murrayc murrayc com>
 
         Catch exceptions when updating the libgda metastore.
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc b/glom/libglom/connectionpool_backends/postgres_self.cc
index 2afb7f3..9a81fd4 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -67,9 +67,11 @@ namespace ConnectionPoolBackends
 #define DEFAULT_CONFIG_PG_HBA_LOCAL_8p3 \
 "# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD\n" \
 "\n" \
+"# local is for Unix domain socket connections only\n" \
 "# trust allows connection from the current PC without a password:\n" \
-"host    all         all         127.0.0.1    255.255.255.255    trust\n" \
-"host    all         all         ::1/128               trust\n" \
+"local   all         all                               trust\n" \
+"local   all         all                               ident sameuser\n" \
+"local   all         all                               md5\n" \
 "\n" \
 "# TCP connections from the same computer, with a password:\n" \
 "host    all         all         127.0.0.1    255.255.255.255    md5\n" \
@@ -79,9 +81,11 @@ namespace ConnectionPoolBackends
 #define DEFAULT_CONFIG_PG_HBA_LOCAL_8p4 \
 "# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD\n" \
 "\n" \
+"# local is for Unix domain socket connections only\n" \
 "# trust allows connection from the current PC without a password:\n" \
-"host    all         all         127.0.0.1    255.255.255.255    trust\n" \
-"host    all         all         ::1/128               trust\n" \
+"local   all         all                               trust\n" \
+"local   all         all                               ident\n" \
+"local   all         all                               md5\n" \
 "\n" \
 "# TCP connections from the same computer, with a password:\n" \
 "host    all         all         127.0.0.1    255.255.255.255    md5\n" \
@@ -430,13 +434,7 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
                                   + " -h " + listen_address
                                   + " -c hba_file=" + Glib::shell_quote(dbdir_hba)
                                   + " -c ident_file=" + Glib::shell_quote(dbdir_ident)
-
-                                  // This seems to be a way to disable unix sockets.
-                                  // See http://archives.postgresql.org/pgsql-general/2012-10/msg00727.php
-                                  // Recent versions of PostgreSQL (patched 9.1 in Fedora)
-                                  // do not allow some unusual characters in the path, so it is better to avoid it altogether.
-                                  + " -k ''"
-
+                                  + " -k " + Glib::shell_quote(dbdir)
                                   + " --external_pid_file=" + Glib::shell_quote(dbdir_pid);
   //std::cout << G_STRFUNC << ": debug: " << command_postgres_start << std::endl;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]