Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7703e55

Browse files
committed
Make the default pg_hba.conf include an entry for ::1 only if configure
set HAVE_IPV6. Per recent discussions.
1 parent f4ed650 commit 7703e55

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

configure

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11193,6 +11193,7 @@ fi
1119311193

1119411194

1119511195

11196+
HAVE_IPV6=no
1119611197
echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5
1119711198
echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6
1119811199
if test "${ac_cv_type_struct_sockaddr_in6+set}" = set; then
@@ -11314,11 +11315,13 @@ cat >>confdefs.h <<\_ACEOF
1131411315
#define HAVE_IPV6 1
1131511316
_ACEOF
1131611317

11318+
HAVE_IPV6=yes
1131711319
fi
1131811320

1131911321
fi
1132011322

1132111323

11324+
1132211325
echo "$as_me:$LINENO: checking for PS_STRINGS" >&5
1132311326
echo $ECHO_N "checking for PS_STRINGS... $ECHO_C" >&6
1132411327
if test "${pgac_cv_var_PS_STRINGS+set}" = set; then
@@ -18286,6 +18289,7 @@ s,@python_configdir@,$python_configdir,;t t
1828618289
s,@python_includespec@,$python_includespec,;t t
1828718290
s,@python_libspec@,$python_libspec,;t t
1828818291
s,@LIBOBJS@,$LIBOBJS,;t t
18292+
s,@HAVE_IPV6@,$HAVE_IPV6,;t t
1828918293
s,@THREAD_CFLAGS@,$THREAD_CFLAGS,;t t
1829018294
s,@THREAD_LIBS@,$THREAD_LIBS,;t t
1829118295
s,@HAVE_POSIX_SIGNALS@,$HAVE_POSIX_SIGNALS,;t t

configure.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.283 2003/09/01 23:01:49 petere Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.284 2003/09/07 03:36:02 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -832,12 +832,15 @@ AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid memmove poll pstat setproc
832832

833833
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
834834

835+
HAVE_IPV6=no
835836
AC_CHECK_TYPE([struct sockaddr_in6],
836837
[AC_CHECK_FUNC(inet_ntop,
837-
[AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if you have support for IPv6.])])],
838+
[AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if you have support for IPv6.])
839+
HAVE_IPV6=yes])],
838840
[],
839841
[$ac_includes_default
840842
#include <netinet/in.h>])
843+
AC_SUBST(HAVE_IPV6)
841844

842845
AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
843846
[AC_TRY_LINK(

src/Makefile.global.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.167 2003/09/01 23:01:49 petere Exp $
2+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.168 2003/09/07 03:36:02 tgl Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -263,6 +263,9 @@ host_tuple = @host@
263263
host_os = @host_os@
264264
host_cpu = @host_cpu@
265265

266+
# Make HAVE_IPV6 available for initdb script creation
267+
HAVE_IPV6= @HAVE_IPV6@
268+
266269
# The HP-UX port makefile, for one, needs access to this symbol
267270
HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
268271

src/backend/libpq/pg_hba.conf.sample

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
5252

5353
local all all trust
54+
# IPv4-style local connections:
5455
host all all 127.0.0.1 255.255.255.255 trust
55-
56-
# uncomment this to support IPv6 loopback connections
57-
# host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust
56+
# IPv6-style local connections:
57+
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust

src/bin/initdb/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.28 2002/09/03 21:45:43 petere Exp $
8+
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.29 2003/09/07 03:36:03 tgl Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -18,6 +18,7 @@ all: initdb
1818
initdb: initdb.sh $(top_builddir)/src/Makefile.global
1919
sed -e 's/@VERSION@/$(VERSION)/g' \
2020
-e 's,@SHELL@,$(SHELL),g' \
21+
-e 's,@HAVE_IPV6@,$(HAVE_IPV6),g' \
2122
-e 's,@bindir@,$(bindir),g' \
2223
-e 's,@datadir@,$(datadir),g' \
2324
$< >$@

src/bin/initdb/initdb.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
2828
# Portions Copyright (c) 1994, Regents of the University of California
2929
#
30-
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.200 2003/08/26 15:38:25 tgl Exp $
30+
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.201 2003/09/07 03:36:03 tgl Exp $
3131
#
3232
#-------------------------------------------------------------------------
3333

@@ -76,6 +76,7 @@ CMDNAME=`basename $0`
7676

7777
# Placed here during build
7878
VERSION='@VERSION@'
79+
HAVE_IPV6='@HAVE_IPV6@'
7980
bindir='@bindir@'
8081
# Note that "datadir" is not the directory we're initializing, it's
8182
# merely how Autoconf names PREFIX/share.
@@ -584,15 +585,21 @@ echo "$nconns"
584585

585586
$ECHO_N "creating configuration files... "$ECHO_C
586587

587-
cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely
588-
cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf || exit_nicely
589588
sed -e "s/^#shared_buffers = 1000/shared_buffers = $nbuffers/" \
590589
-e "s/^#max_connections = 100/max_connections = $nconns/" \
591590
-e "s/^#lc_messages = 'C'/lc_messages = '`pg_getlocale MESSAGES`'/" \
592591
-e "s/^#lc_monetary = 'C'/lc_monetary = '`pg_getlocale MONETARY`'/" \
593592
-e "s/^#lc_numeric = 'C'/lc_numeric = '`pg_getlocale NUMERIC`'/" \
594593
-e "s/^#lc_time = 'C'/lc_time = '`pg_getlocale TIME`'/" \
595594
"$POSTGRESQL_CONF_SAMPLE" > "$PGDATA"/postgresql.conf || exit_nicely
595+
if [ "x$HAVE_IPV6" = xyes ]
596+
then
597+
cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely
598+
else
599+
sed -e "/ ::1 / s/^host/#host/" \
600+
"$PG_HBA_SAMPLE" > "$PGDATA"/pg_hba.conf || exit_nicely
601+
fi
602+
cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf || exit_nicely
596603

597604
chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
598605
"$PGDATA"/postgresql.conf

0 commit comments

Comments
 (0)