X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E7DDD1B182 for ; Mon, 28 Jun 2004 12:11:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20630-07 for ; Mon, 28 Jun 2004 15:11:10 +0000 (GMT) Received: from hotmail.com (bay8-dav37.bay8.hotmail.com [64.4.26.94]) by svr1.postgresql.org (Postfix) with ESMTP id A6C1FD1B1BE for ; Mon, 28 Jun 2004 12:11:06 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 28 Jun 2004 08:11:08 -0700 Received: from 80.21.203.85 by bay8-dav37.bay8.hotmail.com with DAV; Mon, 28 Jun 2004 15:11:08 +0000 X-Originating-IP: [80.21.203.85] X-Originating-Email: [reina_ga@hotmail.com] X-Sender: reina_ga@hotmail.com From: "Tony and Bryn Reina" To: "Tom Lane" Cc: References: <272e4be7.0406270913.7a65f99f@posting.google.com> <14320.1088374357@sss.pgh.pa.us> Subject: Re: Password with libpq Date: Mon, 28 Jun 2004 17:11:02 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Message-ID: X-OriginalArrivalTime: 28 Jun 2004 15:11:08.0533 (UTC) FILETIME=[23DF6250:01C45D22] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/351 X-Sequence-Number: 14011 Thanks Tom. I found the relevant bit of code in the psql files. Looks like it's just a simple loop that compares the error with the phrase "fe_sendauth: no password supplied" and then prompts for the password and tries again. Of course, if someone in the future decides to change the error message, then the code gets broke. I doubt that's likely however. -Tony ----- Original Message ----- From: "Tom Lane" To: "Tony Reina" Cc: Sent: Monday, June 28, 2004 12:12 AM Subject: Re: [ADMIN] Password with libpq > reina_ga@hotmail.com (Tony Reina) writes: > > However, what about in the general case where my client program > > doesn't know if a password is required or not. Is there any libpq > > function to query the server if a password is required? Perhaps, > > there's a return value for PQconnectdb which would tell me that the > > connection failed because of the password? (In which case, I can ask > > for the password and try the connection again.) > > Look into the psql source code; it does essentially this. > > regards, tom lane >