Hello
On Fri, Aug 12, 2005 at 11:39:16AM +0200, Christoph Martin wrote:
> 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.
Now I understand, thanks.
Regards,
// Ola
> > 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
--
--- Ola Lundqvist systemkonsult --- M Sc in IT Engineering ----
/ [EMAIL PROTECTED] Annebergsslingan 37 \
| [EMAIL PROTECTED] 654 65 KARLSTAD |
| http://www.opal.dhs.org Mobile: +46 (0)70-332 1551 |
\ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 /
---------------------------------------------------------------
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]