Package: dbconfig-common
Version: 1.8.41
Severity: important
Tags: patch
The "dbc_dbuser" is not allowed to create schemas on the newly created database.
There are many possible fixes for this problem. I am not sure about
the privileges this user is supposed to have, but following the mysql
version, I have created a patch that simply GRANTS ALL PRIVILEGES.
The fix was done by granting the privilege just after the database creation.
If the database were created before the user, we could instead:
* BEGIN a transaction;
* CREATE USER;
* GRANT privileges;
* END the transaction;
There seems to be no reason for creating the database after creating the user
since the user is not the database owner. The patch seems OK, though, since
the failure to create the database will imply on the failure to grant the
privileges, making the retval correct.
André Caldas.
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages dbconfig-common depends on:
ii debconf [debconf-2.0] 1.5.27 Debian configuration management sy
ii ucf 3.0018 Update Configuration File: preserv
dbconfig-common recommends no packages.
Versions of packages dbconfig-common suggests:
ii postgresql-client-8.3 [postgr 8.3.7-2 front-end programs for PostgreSQL
ii postgresql-client-8.4 [postgr 8.4.0-2 front-end programs for PostgreSQL
-- debconf information excluded
diff --git a/internal/pgsql b/internal/pgsql
index 76f6352..b57a501 100644
--- a/internal/pgsql
+++ b/internal/pgsql
@@ -115,7 +115,7 @@ _dbc_createdb(){
extrasql=" WITH ENCODING = '$dbc_pgsql_createdb_encoding'";
fi
extra="$extra template1"
- _dbc_pgsql_exec_command "CREATE DATABASE \"$dbc_dbname\"$extrasql"
+ _dbc_pgsql_exec_command "CREATE DATABASE \"$dbc_dbname\"$extrasql; GRANT ALL PRIVILEGES ON DATABASE \"$dbc_dbname\" TO \"$dbc_dbuser\";"
retval=$?
_dbc_psql_cmd_cleanup
return $retval