Hi Ola,

Ola Lundqvist schrieb:
> I do not fully understand what you want to be done here...

I'll try to explain. There are mode how you can access the database: as
admin or as user. You change this mode by setting the use_dbuser
variable. pgsql.get then uses differnt usernames and passwords.

In pgsql-exec.sh you first want to access the systemdb template1. For
that you need to use the admin permissions. After that you want to
access the userdb. Now you need the user permissions.

I try to comment it in the patch below.

> On Thu, Aug 11, 2005 at 05:31:42PM +0200, Christoph Martin wrote:
> 
>>--- /usr/share/wwwconfig-common/pgsql-exec.sh~  2005-03-22 17:21:56.000000000 
>>+0100
>>+++ /usr/share/wwwconfig-common/pgsql-exec.sh   2005-08-11 17:27:35.000000000 
>>+0200
>>@@ -27,18 +27,23 @@
>> 
>> . /usr/share/wwwconfig-common/pgsql.get

pqsql.get sets use_dbuser=true as default. But we need use_dbuser=false
for the first command.

>> 
>>+use_dbuser=false
>>+
>> if [ -z "$dbserver" ] ; then
>>     error="No database server specified."

The corrent command-name is psql and not pgsql

>>-elif [ ! -x $(which pgsql) ] ; then
>>+elif [ ! -x $(which psql) ] ; then
>>     error="No pgsql client to execute, install the pgsql client package and
>>     run 'dpkg-reconfigure -plow packagename'."

The next change is optional. For consistency use the -d option everywhere.

>>-elif ! eval $pgsqlcmd $systemdb -c "\"select usename from pg_shadow;\"" 
>>>/dev/null 2>&1 ; then
>>+elif ! eval $pgsqlcmd -d $systemdb -c "\"select usename from pg_shadow;\"" 
>>>/dev/null 2>&1 ; then
>>     error="Error when trying to connect to the pgsql database.
>>     This error can occur if you have no database to connect to, or
>>     if the password was incorrect.
>>        use: dpkg-reconfigure -plow packagename to reconfigure."
>> else
>>     log="${log}Executing command to pgsql."

The next command should be executed with user permissions. Therefore set
use_dbuser to false again.

>>+
>>+    use_dbuser=true
>>+
>>     if eval $pgsqlcmd -d $dbname < $sqlfile > /dev/null 2>&1 ; then
>>        status=exec
>>     else
>>

Feel free to ask, if you need more explanations.

Christoph

-- 
============================================================================
Christoph Martin, EDV der Verwaltung, Uni-Mainz, Germany
 Internet-Mail:  [EMAIL PROTECTED]
  Telefon: +49-6131-3926337
      Fax: +49-6131-3922856

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to