Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D5B5463282B for ; Wed, 14 Jul 2010 04:02:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 40475-05 for ; Wed, 14 Jul 2010 07:02:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f46.google.com (mail-bw0-f46.google.com [209.85.214.46]) by mail.postgresql.org (Postfix) with ESMTP id C99506324A7 for ; Wed, 14 Jul 2010 04:02:15 -0300 (ADT) Received: by bwz1 with SMTP id 1so705175bwz.19 for ; Wed, 14 Jul 2010 00:02:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.162.203 with SMTP id w11mr1951719bkx.41.1279090932742; Wed, 14 Jul 2010 00:02:12 -0700 (PDT) Received: by 10.204.61.208 with HTTP; Wed, 14 Jul 2010 00:02:12 -0700 (PDT) In-Reply-To: <18252.1279058967@sss.pgh.pa.us> References: <201007130825.o6D8Pepl005798@wwwmaster.postgresql.org> <18252.1279058967@sss.pgh.pa.us> Date: Wed, 14 Jul 2010 09:02:12 +0200 Message-ID: Subject: Re: BUG #5559: Full SSL verification fails when hostaddr provided From: Magnus Hagander To: Tom Lane Cc: Christopher Head , pgsql-bugs Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201007/97 X-Sequence-Number: 27441 On Wed, Jul 14, 2010 at 00:09, Tom Lane wrote: > "Christopher Head" writes: >> When establishing a connection to a PostgreSQL server using a connection >> string, there are two parameters that can be provided to specify where t= o >> connect to: "host" and "hostaddr". If both are provided, the documentati= on >> states that "hostaddr" is used to actually establish the socket (thus >> avoiding >> a potentially-expensive DNS lookup), while "host" is used for doing some >> Kerberos stuff. > >> It makes sense that in the case of an SSL connection with >> "sslmode=3Dverify-full" (check that the server's certificate is signed b= y a >> trusted CA and has the >> correct hostname), if both parameters are provided, that "host" also be = used >> for certificate checking. Unfortunately, as per line 536 of the file >> fe-secure.c in the PostgreSQL sources, if hostaddr is specified, SSL ful= l >> verification just plain fails without trying at all. I suspect this line >> should be "if (!conn->pghost)" instead of "if (conn->pghostaddr)". > > That's really a definitional change, but it seems like a reasonable one > to me. =A0Magnus, what do you think? Yeah, I think it is, but I haven't had the time to look into the code yet to see if I agree with the fix as well. Hope to get there soon. --=20 =A0Magnus Hagander =A0Me: http://www.hagander.net/ =A0Work: http://www.redpill-linpro.com/