X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7A7219DC9D1 for ; Wed, 11 Jan 2006 12:21:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07256-10 for ; Wed, 11 Jan 2006 12:21:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 347429DC9C7 for ; Wed, 11 Jan 2006 12:21:56 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k0BGLt42013330; Wed, 11 Jan 2006 11:21:55 -0500 (EST) To: Ludek Finstrle cc: pgsql-interfaces@postgresql.org Subject: Re: libpq and auth type In-reply-to: <20060111161115.GB28494@soptik.pzkagis.cz> References: <20060108085851.GA24997@soptik.pzkagis.cz> <20060111105020.GA11904@soptik.pzkagis.cz> <12709.1136992353@sss.pgh.pa.us> <20060111161115.GB28494@soptik.pzkagis.cz> Comments: In-reply-to Ludek Finstrle message dated "Wed, 11 Jan 2006 17:11:15 +0100" Date: Wed, 11 Jan 2006 11:21:55 -0500 Message-ID: <13329.1136996515@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.083 required=5 tests=[AWL=0.083] X-Spam-Score: 0.083 X-Spam-Level: X-Archive-Number: 200601/23 X-Sequence-Number: 5939 Ludek Finstrle writes: > There is the problem that I don't know if the parameter is required > or not (it depends on authentication method: ident, krb, trust doesn't > require uid, pwd; other auth methods does). > If I don't want break this behaviour with krb I need to know what > auth method is used. I don't see another way. Do you? Why do you have to know whether the parameter is required or not? If the user enters something, fine, else try to proceed without. It's impossible by definition to know whether a password is required until you have the host, user, and database names, since the server's pg_hba.conf might well specify different auth methods depending on the user and/or database name. You could imagine trying to make a connection the instant you have the first three, and only asking for a password if you get a "no password supplied" failure, but I think it'd be simpler to just put up a dialog box with room for all four and let the user leave the password blank if he thinks he doesn't need it. regards, tom lane