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 1lqcTR-0003u4-CN for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jun 2021 14:12:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lqcTP-0000Nj-Im for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jun 2021 14:12:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqcTO-0000Ha-K2 for pgsql-hackers@lists.postgresql.org; Tue, 08 Jun 2021 14:12:55 +0000 Received: from forward2-smtp.messagingengine.com ([66.111.4.226]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqcTL-0001MT-BJ for pgsql-hackers@postgresql.org; Tue, 08 Jun 2021 14:12:53 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailforward.nyi.internal (Postfix) with ESMTP id 12ED61940B37; Tue, 8 Jun 2021 10:12:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 08 Jun 2021 10:12:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=ssjo2QlsjwNEBmoQcURIgwhMgcINHL/raJkJNZ0/k qE=; b=O62Bi9GMJZmFbBDD2JU7USK7XZyZAAX/5oaumDYgdwHrSJ4gx2mv5Lw/D Uz3MACDIdH7FpxmrmtfvAx12xMk3xfXFXwwD8ujJBhkNwyPe5winzjcZmeNCKbi0 MMOjtsemtsWI0dqmx9arwhovV5PTgDiWccE4qZnLbnMsmOy6PoBGwzxSXC7+CFGq CvUSM6WRA2+h407fiJfkOgDoHVTKBVtXmD4NeaUOuWhMZ7oFMqeLQKG1us22GTzE z4MsI280IeRsxD76U7bCb9tIT5B0AO5mkEfQpXJzlYX0w27Pwzd7tLsJ+piaCwsZ Bdq1w11wbQDBS4gmRg2WGosdKRoBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedtledgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefheenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhephfefleefueevuddvffeh jedtjeejgfelhfdtvdffheeludetudegfeeftdffffejnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Jun 2021 10:12:46 -0400 (EDT) Subject: Re: SSL SNI To: Michael Paquier , Tom Lane Cc: Jacob Champion , "pgsql-hackers@postgresql.org" References: <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> <14840.1622742761@sss.pgh.pa.us> <15936.1622744081@sss.pgh.pa.us> <5df46438-c1b4-161c-4669-f6e6ab6797f0@enterprisedb.com> <878795.1623080064@sss.pgh.pa.us> From: Peter Eisentraut Message-ID: <559ffbc8-05ed-c44c-728a-d2a71d1232a7@enterprisedb.com> Date: Tue, 8 Jun 2021 16:12:44 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 08.06.21 08:54, Michael Paquier wrote: > On Mon, Jun 07, 2021 at 11:34:24AM -0400, Tom Lane wrote: >> Yeah, I'd include the empty-string test just because it's standard >> practice in this area of libpq. Whether those tests are actually >> triggerable in every case is obscure, but ... > > Checking after a NULL string and an empty one is more libpq-ish. > >> Patch looks sane by eyeball, though I didn't test it. > > I did, and I could not break it. > > + SSLerrfree(err); > + SSL_CTX_free(SSL_context); > + return -1; > It seems to me that there is no need to free SSL_context if > SSL_set_tlsext_host_name() fails here, except if you'd like to move > the check for the SNI above SSL_CTX_free() around L1082. There is no > harm as SSL_CTX_free() is a no-op on NULL input. Good point. Committed that way.