Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZwxkI-0006Sq-Fp for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2015 19:41:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZwxkI-00061v-2E for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2015 19:41:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZwxkH-00061B-2s for pgsql-bugs@postgresql.org; Thu, 12 Nov 2015 19:41:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zwxk9-00016B-IA for pgsql-bugs@postgresql.org; Thu, 12 Nov 2015 19:41:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tACJf3qM015140; Thu, 12 Nov 2015 14:41:03 -0500 From: Tom Lane To: Alvaro Herrera cc: Fujii Masao , Michael Paquier , Haribabu Kommi , brown@fastmail.com, "pgsql-bugs@postgresql.org" Subject: Re: BUG #13741: vacuumdb does not accept valid password In-reply-to: <20151112170303.GN614468@alvherre.pgsql> References: <20151102192626.GG6104@alvherre.pgsql> <20151104021618.GP6104@alvherre.pgsql> <20151112170303.GN614468@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 12 Nov 2015 14:03:03 -0300" Date: Thu, 12 Nov 2015 14:41:03 -0500 Message-ID: <15139.1447357263@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Alvaro Herrera writes: > Fujii Masao wrote: >> ISTM that the attached simpler patch can fix the problem. >> But maybe I'm missing something... > Hmm, this is a very good and simple idea that looks like it should do > the trick. I would just add a comment explaining why we're using a > static. NAK. This changes the behavior of connectDatabase() for *all* users of that function, not only vacuumdb. But the proposed behavioral change is only appropriate for calling programs in which only a single host/port/database target is used per execution. In other contexts, reusing the prior password is not just inappropriate but could actually create security issues. (It's possible that this behavior would be okay for all existing callers, but that doesn't mean we should put in a security gotcha for future uses.) We could make this approach work if connectDatabase() remembered all the parameters internally, and only tried to reuse the password when they all match. Or maybe it'd be better to alter the API so the caller can say whether to try to reuse a saved password or not. But I'm not sure whether either of those answers is cleaner than the previous patch. (BTW, I notice that pg_dumpall.c has a version of connectDatabase in which the "static" trick is already being used, sans any documentation. That's okay for pg_dumpall, but might be an issue if anyone copies-and- pastes that version somewhere else ... and in any case it's fair to ask why that version hasn't been merged with common.c.) regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs