Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lorWU-0006Tr-UV for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Jun 2021 17:52:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lorWT-0007q8-Mo for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Jun 2021 17:52:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lorWT-0007pz-F9 for pgsql-hackers@lists.postgresql.org; Thu, 03 Jun 2021 17:52:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lorWN-0006M4-Dk for pgsql-hackers@postgresql.org; Thu, 03 Jun 2021 17:52:49 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 153Hqf2T014841; Thu, 3 Jun 2021 13:52:41 -0400 From: Tom Lane To: Peter Eisentraut cc: Jacob Champion , "pgsql-hackers@postgresql.org" Subject: Re: SSL SNI In-reply-to: <14368.1622742108@sss.pgh.pa.us> References: <7289d5eb-62a5-a732-c3b9-438cee2cb709@enterprisedb.com> <9407b344-7342-b2b7-004f-d5250687be42@enterprisedb.com> <4eaa2b56-c3d0-67b6-4716-010d001c7601@enterprisedb.com> <4bf3ae1c-b28e-8960-e89f-c390c5cf01a2@enterprisedb.com> <504c276ab6eee000bb23d571ea9b0ced4250774e.camel@vmware.com> <14368.1622742108@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 03 Jun 2021 13:41:48 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14839.1622742761.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Jun 2021 13:52:41 -0400 Message-ID: <14840.1622742761@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Jacob Champion writes: >> It looks like this code needs some guards for a NULL conn->pghost. For = example when running >> psql 'dbname=3Dpostgres sslmode=3Drequire hostaddr=3D127.0.0.1' >> with no PGHOST in the environment, psql is currently segfaulting for >> me. > Duplicated here: It looks like the immediate problem can be resolved by just adding a check for conn->pghost not being NULL, since the comment above says * Per RFC 6066, do not set it if the host is a literal IP address (IP= v4 * or IPv6). and having only hostaddr certainly fits that case. But I didn't check to see if any more problems arise later. regards, tom lane