pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Newbie confused about pg_hba/md5 and password field in PQsetdbLogin
4+ messages / 2 participants
[nested] [flat]

* Newbie confused about pg_hba/md5 and password field in PQsetdbLogin
@ 2002-08-21 16:59 Scott Dunbar <scott@xigole.com>
  2002-08-21 17:03 ` Re: Newbie confused about pg_hba/md5 and password field Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Scott Dunbar @ 2002-08-21 16:59 UTC (permalink / raw)
  To: pgsql-interfaces

Hello,
I'm pretty new to PostgreSQL in general and even newer to libpq.  I am 
trying to get a C program working (the authpgsql module in courier-imap) 
that uses PQsetdbLogin().  I've got 7.2.1 installed and running and have 
had no problem accessing it via JDBC.  I have encrypted passwords in 
pg_shadow and have "md5" set for the AUTH_TYPE in pg_hba.conf.  However, 
when using PQsetdbLogin the only way I could get a login to work was to 
use unencrypted passwords in pg_shadow and change pg_hba.conf to use 
"password" instead of "md5" for the database I want access to through 
authpgsql.

Why is this?  Do I somehow have to md5 the clear text password before 
calling PQsetdbLogin()?  Does PQconnectdb() handle this and I should 
update the code?  I feel that the client code should be unaware of the 
over the wire encryption method used and the encryption method of the 
password in pg_shadow but I may be way off base on the underlying issue.

Thanks in advance for any information.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Newbie confused about pg_hba/md5 and password field
  2002-08-21 16:59 Newbie confused about pg_hba/md5 and password field in PQsetdbLogin Scott Dunbar <scott@xigole.com>
@ 2002-08-21 17:03 ` Bruce Momjian <pgman@candle.pha.pa.us>
  2002-08-21 20:55   ` Re: Newbie confused about pg_hba/md5 and password field Scott Dunbar <scott@xigole.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Bruce Momjian @ 2002-08-21 17:03 UTC (permalink / raw)
  To: Scott Dunbar <scott@xigole.com>; +Cc: pgsql-interfaces


Sorry, this seems impossible: libpq's PQsetdbLogin() doesn't allow MD5
passwords?  You shouldn't have to do anything special;  it should just
accept the password.PQconnectdb() has the same handling as
PQsetdbLogin().

Is it possible your libpq version is older than 7.2.1?

---------------------------------------------------------------------------

Scott Dunbar wrote:
> Hello,
> I'm pretty new to PostgreSQL in general and even newer to libpq.  I am 
> trying to get a C program working (the authpgsql module in courier-imap) 
> that uses PQsetdbLogin().  I've got 7.2.1 installed and running and have 
> had no problem accessing it via JDBC.  I have encrypted passwords in 
> pg_shadow and have "md5" set for the AUTH_TYPE in pg_hba.conf.  However, 
> when using PQsetdbLogin the only way I could get a login to work was to 
> use unencrypted passwords in pg_shadow and change pg_hba.conf to use 
> "password" instead of "md5" for the database I want access to through 
> authpgsql.
> 
> Why is this?  Do I somehow have to md5 the clear text password before 
> calling PQsetdbLogin()?  Does PQconnectdb() handle this and I should 
> update the code?  I feel that the client code should be unaware of the 
> over the wire encryption method used and the encryption method of the 
> password in pg_shadow but I may be way off base on the underlying issue.
> 
> Thanks in advance for any information.
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Newbie confused about pg_hba/md5 and password field
  2002-08-21 16:59 Newbie confused about pg_hba/md5 and password field in PQsetdbLogin Scott Dunbar <scott@xigole.com>
  2002-08-21 17:03 ` Re: Newbie confused about pg_hba/md5 and password field Bruce Momjian <pgman@candle.pha.pa.us>
@ 2002-08-21 20:55   ` Scott Dunbar <scott@xigole.com>
  2002-08-21 21:20     ` Re: Newbie confused about pg_hba/md5 and password field Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Scott Dunbar @ 2002-08-21 20:55 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-interfaces

Bruce,
Thanks for the information.  On further testing I indeed cannot 
reproduce the issue with a standalone program, only with the authlib 
that I'm trying to get to work.  I did learn that my thinking was wrong 
though.  I thought the AUTH_TYPE in pg_hba.conf was for transport only, 
having nothing to do with the encryption used to encrypt passwords in 
pg_shadow.  That does not appear to be the case as if you use md5 in 
your pg_shadow and just "password" in your pg_hba.conf file you'll get 
an error.

I'll keep digging.  I am confident that my libpg.so is correct as this 
is a new installation of everything.

Thanks again for the feedback.

 
Bruce Momjian wrote:

>Sorry, this seems impossible: libpq's PQsetdbLogin() doesn't allow MD5
>passwords?  You shouldn't have to do anything special;  it should just
>accept the password.PQconnectdb() has the same handling as
>PQsetdbLogin().
>
>Is it possible your libpq version is older than 7.2.1?
>
>---------------------------------------------------------------------------
>
>Scott Dunbar wrote:
>  
>
>>Hello,
>>I'm pretty new to PostgreSQL in general and even newer to libpq.  I am 
>>trying to get a C program working (the authpgsql module in courier-imap) 
>>that uses PQsetdbLogin().  I've got 7.2.1 installed and running and have 
>>had no problem accessing it via JDBC.  I have encrypted passwords in 
>>pg_shadow and have "md5" set for the AUTH_TYPE in pg_hba.conf.  However, 
>>when using PQsetdbLogin the only way I could get a login to work was to 
>>use unencrypted passwords in pg_shadow and change pg_hba.conf to use 
>>"password" instead of "md5" for the database I want access to through 
>>authpgsql.
>>
>>Why is this?  Do I somehow have to md5 the clear text password before 
>>calling PQsetdbLogin()?  Does PQconnectdb() handle this and I should 
>>update the code?  I feel that the client code should be unaware of the 
>>over the wire encryption method used and the encryption method of the 
>>password in pg_shadow but I may be way off base on the underlying issue.
>>
>>Thanks in advance for any information.
>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>
>>    
>>
>
>  
>







^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Newbie confused about pg_hba/md5 and password field
  2002-08-21 16:59 Newbie confused about pg_hba/md5 and password field in PQsetdbLogin Scott Dunbar <scott@xigole.com>
  2002-08-21 17:03 ` Re: Newbie confused about pg_hba/md5 and password field Bruce Momjian <pgman@candle.pha.pa.us>
  2002-08-21 20:55   ` Re: Newbie confused about pg_hba/md5 and password field Scott Dunbar <scott@xigole.com>
@ 2002-08-21 21:20     ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2002-08-21 21:20 UTC (permalink / raw)
  To: Scott Dunbar <scott@xigole.com>; +Cc: pgsql-interfaces


Well, if you store your passwords as encrypted in pg_shadow, then only
MD5 will work for authentication.  If you don't encrypt them, you can
use any auth method like 'crypt' or 'password'.

I don't know what authlib is, but it is very possible it doesn't have
this md5 capability.

---------------------------------------------------------------------------

Scott Dunbar wrote:
> Bruce,
> Thanks for the information.  On further testing I indeed cannot 
> reproduce the issue with a standalone program, only with the authlib 
> that I'm trying to get to work.  I did learn that my thinking was wrong 
> though.  I thought the AUTH_TYPE in pg_hba.conf was for transport only, 
> having nothing to do with the encryption used to encrypt passwords in 
> pg_shadow.  That does not appear to be the case as if you use md5 in 
> your pg_shadow and just "password" in your pg_hba.conf file you'll get 
> an error.
> 
> I'll keep digging.  I am confident that my libpg.so is correct as this 
> is a new installation of everything.
> 
> Thanks again for the feedback.
> 
>  
> Bruce Momjian wrote:
> 
> >Sorry, this seems impossible: libpq's PQsetdbLogin() doesn't allow MD5
> >passwords?  You shouldn't have to do anything special;  it should just
> >accept the password.PQconnectdb() has the same handling as
> >PQsetdbLogin().
> >
> >Is it possible your libpq version is older than 7.2.1?
> >
> >---------------------------------------------------------------------------
> >
> >Scott Dunbar wrote:
> >  
> >
> >>Hello,
> >>I'm pretty new to PostgreSQL in general and even newer to libpq.  I am 
> >>trying to get a C program working (the authpgsql module in courier-imap) 
> >>that uses PQsetdbLogin().  I've got 7.2.1 installed and running and have 
> >>had no problem accessing it via JDBC.  I have encrypted passwords in 
> >>pg_shadow and have "md5" set for the AUTH_TYPE in pg_hba.conf.  However, 
> >>when using PQsetdbLogin the only way I could get a login to work was to 
> >>use unencrypted passwords in pg_shadow and change pg_hba.conf to use 
> >>"password" instead of "md5" for the database I want access to through 
> >>authpgsql.
> >>
> >>Why is this?  Do I somehow have to md5 the clear text password before 
> >>calling PQsetdbLogin()?  Does PQconnectdb() handle this and I should 
> >>update the code?  I feel that the client code should be unaware of the 
> >>over the wire encryption method used and the encryption method of the 
> >>password in pg_shadow but I may be way off base on the underlying issue.
> >>
> >>Thanks in advance for any information.
> >>
> >>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >>
> >>    
> >>
> >
> >  
> >
> 
> 
> 
> 
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-08-21 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-21 16:59 Newbie confused about pg_hba/md5 and password field in PQsetdbLogin Scott Dunbar <scott@xigole.com>
2002-08-21 17:03 ` Re: Newbie confused about pg_hba/md5 and password field Bruce Momjian <pgman@candle.pha.pa.us>
2002-08-21 20:55   ` Re: Newbie confused about pg_hba/md5 and password field Scott Dunbar <scott@xigole.com>
2002-08-21 21:20     ` Re: Newbie confused about pg_hba/md5 and password field Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox