Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 823C4632421 for ; Wed, 14 Jul 2010 18:35:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 25400-04 for ; Wed, 14 Jul 2010 21:35:24 +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 485FF632238 for ; Wed, 14 Jul 2010 18:35:25 -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 o6ELZMKL018348; Wed, 14 Jul 2010 17:35:22 -0400 (EDT) To: Stephen Frost cc: Magnus Hagander , Christopher Head , pgsql-bugs Subject: Re: BUG #5559: Full SSL verification fails when hostaddr provided In-reply-to: <20100714212805.GP21875@tamriel.snowman.net> References: <201007130825.o6D8Pepl005798@wwwmaster.postgresql.org> <18252.1279058967@sss.pgh.pa.us> <6811.1279123338@sss.pgh.pa.us> <7342.1279124972@sss.pgh.pa.us> <20100714173942.GM21875@tamriel.snowman.net> <9371.1279130114@sss.pgh.pa.us> <20100714183240.GO21875@tamriel.snowman.net> <10950.1279135209@sss.pgh.pa.us> <20100714212805.GP21875@tamriel.snowman.net> Comments: In-reply-to Stephen Frost message dated "Wed, 14 Jul 2010 17:28:05 -0400" Date: Wed, 14 Jul 2010 17:35:21 -0400 Message-ID: <18347.1279143321@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/105 X-Sequence-Number: 27449 Stephen Frost writes: > krb5_sname_to_principal() will use the passed hostname for the second > component. If type is KRB5_NT_SRV_HST this name will be looked up with > gethostbyname(). If hostname is NULL, the local hostname will be used. > If we were passing in NULL before when hostaddr was set and host wasn't, > then we were probably ending up with Kerberos trying to use the local > hostname, which almost certainly wasn't right. Ah. I agree that that would be unexpected behavior. > I expect that the > correct answer here would be to do whatever the actual connection logic > does- if it connects using host, then use host, if it connects using > hostaddr, then use hostaddr. Uh, no, because hostaddr is (required to be) a numeric IP. The odds of it being useful in this context seem negligible. At this point I'm satisfied that what the code is doing is right. We can't authenticate against Kerberos without knowing the server host name, because we can't form a correct principal name. Whether use of hostaddr would avoid an rDNS lookup inside the library is not relevant. regards, tom lane