summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorPeter Eisentraut2002-02-18 23:11:58 +0000
committerPeter Eisentraut2002-02-18 23:11:58 +0000
commit8adf56f77aa0cc8cf4af7a19f0d235fc56fbabc7 (patch)
treecab3054a1a1fba1fe1722bb75a1fc3c06eda964d /src/bin
parent5e035031265aef8608fd32a31897240a3aff3d8d (diff)
Privileges on functions and procedural languages
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/initdb/initdb.sh20
-rw-r--r--src/bin/scripts/createlang.sh13
2 files changed, 31 insertions, 2 deletions
diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh
index c823ee627d7..c75d44c6a30 100644
--- a/src/bin/initdb/initdb.sh
+++ b/src/bin/initdb/initdb.sh
@@ -27,7 +27,7 @@
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.142 2001/11/25 22:19:30 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.143 2002/02/18 23:11:28 petere Exp $
#
#-------------------------------------------------------------------------
@@ -833,6 +833,24 @@ EOF
| "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
echo "ok"
+# Set most system catalogs and built-in functions as world-accessible.
+# Some objects may require different permissions by default, so we
+# make sure we don't overwrite privilege sets that have already been
+# set (NOT NULL).
+$ECHO_N "setting privileges on built-in objects... "$ECHO_C
+(
+ cat <<EOF
+ UPDATE pg_class SET relacl = '{"=r"}' \
+ WHERE relkind IN ('r', 'v', 'S') AND relacl IS NULL;
+ UPDATE pg_proc SET proacl = '{"=r"}' \
+ WHERE proacl IS NULL;
+ UPDATE pg_language SET lanacl = '{"=r"}' \
+ WHERE lanpltrusted;
+EOF
+) \
+ | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
+echo "ok"
+
$ECHO_N "vacuuming database template1... "$ECHO_C
"$PGPATH"/postgres $PGSQL_OPT template1 >/dev/null <<EOF
diff --git a/src/bin/scripts/createlang.sh b/src/bin/scripts/createlang.sh
index 5034f65cbe6..d2aabe30c55 100644
--- a/src/bin/scripts/createlang.sh
+++ b/src/bin/scripts/createlang.sh
@@ -7,7 +7,7 @@
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.33 2002/02/18 05:48:44 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.34 2002/02/18 23:11:30 petere Exp $
#
#-------------------------------------------------------------------------
@@ -289,4 +289,15 @@ if [ "$?" -ne 0 ]; then
exit 1
fi
+if test -n "$trusted"; then
+ sqlcmd="GRANT USAGE ON LANGUAGE \"$langname\" TO PUBLIC;"
+ if [ "$showsql" = yes ]; then
+ echo "$sqlcmd"
+ fi
+ $PSQL "$sqlcmd"
+ if [ "$?" -ne 0 ]; then
+ echo "$CMDNAME: language installation failed" 1>&2
+ exit 1
+ fi
+fi
exit 0