Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 37F61633918 for ; Tue, 13 Jul 2010 19:09:38 -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 27686-03 for ; Tue, 13 Jul 2010 22:09:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D1F7A632228 for ; Tue, 13 Jul 2010 19:09:30 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o6DM9R9s018253; Tue, 13 Jul 2010 18:09:27 -0400 (EDT) To: "Christopher Head" cc: pgsql-bugs@postgresql.org, Magnus Hagander Subject: Re: BUG #5559: Full SSL verification fails when hostaddr provided In-reply-to: <201007130825.o6D8Pepl005798@wwwmaster.postgresql.org> References: <201007130825.o6D8Pepl005798@wwwmaster.postgresql.org> Comments: In-reply-to "Christopher Head" message dated "Tue, 13 Jul 2010 08:25:40 +0000" Date: Tue, 13 Jul 2010 18:09:27 -0400 Message-ID: <18252.1279058967@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/92 X-Sequence-Number: 27436 "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 to > connect to: "host" and "hostaddr". If both are provided, the documentation > 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=verify-full" (check that the server's certificate is signed by 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 full > 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. Magnus, what do you think? regards, tom lane