Thread: Problems with new DBD

Problems with new DBD

From
Glen Eustace
Date:
I have just upgraded to the new DBD, but am still using postgresql 7.0.3

I am now getting access errors. I have had to go back into the db and
GRANT ALL on <ALL> to PUBLIC as a work around.

Even though I have specified a userid and password on the DBI->connect,
Pg seems to be using the actual user.

NB: I didn't change any of my code, just upgraded to DBD 0.96, I have
since upgraded to DBI 1.15 but that hasn't helped.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Glen and Rosanne Eustace,
GodZone Internet Services, a division of AGRE Enterprises Ltd.,
P.O. Box 8020, Palmerston North, New Zealand 5301
Ph/Fax: +64 6 357 8168, Mob: +64 21 424 015

Re: Problems with new DBD

From
"Jeff Duffy"
Date:
On Thu, 19 Apr 2001 10:52:31 +1200, Glen Eustace alluded:

> I have just upgraded to the new DBD, but am still using postgresql 7.0.3
>
>  I am now getting access errors. I have had to go back into the db and
>  GRANT ALL on <ALL> to PUBLIC as a work around.
>
>  Even though I have specified a userid and password on the DBI->connect,
>  Pg seems to be using the actual user.

 There's a bug in the authentication code in DBD::Pg 0.96. Here's a patch:



--- Pg.dist    Wed Apr 18 20:18:18 2001
+++ Pg.pm    Wed Apr 18 20:20:18 2001
@@ -79,11 +79,11 @@
     $Name =~ s/^.*dbname\s*=\s*//;
     $Name =~ s/\s*;.*$//;

+        $user = $ENV{DBI_USER} unless defined($user) and length($user);
+        $auth = $ENV{DBI_PASS} unless defined($auth);
+
     $user = "" unless defined($user);
     $auth = "" unless defined($auth);
-
-     $user = $ENV{DBI_USER} unless $user eq "";
-     $auth = $ENV{DBI_PASS} unless $auth eq "";

     my($dbh) = DBI::_new_dbh($drh, {
         'Name' => $Name,




 Jeff Duffy
 jduffy@greatbridge.com


Re: Problems with new DBD

From
"Brett W. McCoy"
Date:
On Thu, 19 Apr 2001, Glen Eustace wrote:

> I have just upgraded to the new DBD, but am still using postgresql 7.0.3
>
> I am now getting access errors. I have had to go back into the db and
> GRANT ALL on <ALL> to PUBLIC as a work around.
>
> Even though I have specified a userid and password on the DBI->connect,
> Pg seems to be using the actual user.
>
> NB: I didn't change any of my code, just upgraded to DBD 0.96, I have
> since upgraded to DBI 1.15 but that hasn't helped.

There's a bug in Pg::DBD 0.96.  Here's the patch:



*** DBD-Pg-0.96/Pg.pm-orig    Tue Apr 10 03:44:18 2001
--- DBD-Pg-0.96/Pg.pm    Sun Apr 15 10:26:16 2001
***************
*** 79,89 ****
          $Name =~ s/^.*dbname\s*=\s*//;
          $Name =~ s/\s*;.*$//;

!         $user = "" unless defined($user);
!         $auth = "" unless defined($auth);
!
!         $user = $ENV{DBI_USER} unless $user eq "";
!         $auth = $ENV{DBI_PASS} unless $auth eq "";

          my($dbh) = DBI::_new_dbh($drh, {
              'Name' => $Name,
--- 79,88 ----
          $Name =~ s/^.*dbname\s*=\s*//;
          $Name =~ s/\s*;.*$//;

!         $user ||= $ENV{DBI_USER};
!         $auth ||= $ENV{DBI_PASS};
!     $user ||= "";
!     $auth ||= "";

          my($dbh) = DBI::_new_dbh($drh, {
              'Name' => $Name,

                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
It's amazing how many people you could be friends with if only they'd
make the first approach.


Re: Problems with new DBD

From
Justin Clift
Date:
Hi guys,

Which of these patch is "better"?  I'd like to include this this on the
techdocs.postgresql.org website with a patch for it.

Just have to know which one to include.

Regards and best wishes,

Justin Clift

"Brett W. McCoy" wrote:
>
> On Thu, 19 Apr 2001, Glen Eustace wrote:
>
> > I have just upgraded to the new DBD, but am still using postgresql 7.0.3
> >
> > I am now getting access errors. I have had to go back into the db and
> > GRANT ALL on <ALL> to PUBLIC as a work around.
> >
> > Even though I have specified a userid and password on the DBI->connect,
> > Pg seems to be using the actual user.
> >
> > NB: I didn't change any of my code, just upgraded to DBD 0.96, I have
> > since upgraded to DBI 1.15 but that hasn't helped.
>
> There's a bug in Pg::DBD 0.96.  Here's the patch:
>
> *** DBD-Pg-0.96/Pg.pm-orig      Tue Apr 10 03:44:18 2001
> --- DBD-Pg-0.96/Pg.pm   Sun Apr 15 10:26:16 2001
> ***************
> *** 79,89 ****
>           $Name =~ s/^.*dbname\s*=\s*//;
>           $Name =~ s/\s*;.*$//;
>
> !         $user = "" unless defined($user);
> !         $auth = "" unless defined($auth);
> !
> !         $user = $ENV{DBI_USER} unless $user eq "";
> !         $auth = $ENV{DBI_PASS} unless $auth eq "";
>
>           my($dbh) = DBI::_new_dbh($drh, {
>               'Name' => $Name,
> --- 79,88 ----
>           $Name =~ s/^.*dbname\s*=\s*//;
>           $Name =~ s/\s*;.*$//;
>
> !         $user ||= $ENV{DBI_USER};
> !         $auth ||= $ENV{DBI_PASS};
> !       $user ||= "";
> !       $auth ||= "";
>
>           my($dbh) = DBI::_new_dbh($drh, {
>               'Name' => $Name,
>
>                                    http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> It's amazing how many people you could be friends with if only they'd
> make the first approach.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Re: Problems with new DBD

From
"Brett W. McCoy"
Date:
On Thu, 19 Apr 2001, Justin Clift wrote:

> Which of these patch is "better"?  I'd like to include this this on the
> techdocs.postgresql.org website with a patch for it.
>
> Just have to know which one to include.

Actually, I think Jeff's has a minor fix to it, so use the one he posted.

-- Brett
                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Sacred cows make great hamburgers.