Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2rpz-000gKr-1G for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 14:25:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2rpy-00BPfC-09 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 14:25:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2rpx-00BPf4-1z for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 14:25:29 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2rpt-00000000N55-3HFB for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 14:25:28 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id C996F554C5F for ; Wed, 18 Mar 2026 15:25:24 +0100 (CET) Received: from s981.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id B88C5554770; Wed, 18 Mar 2026 15:25:24 +0100 (CET) Received: from localhost (unknown [172.22.191.5]) by s981.loopia.se (Postfix) with ESMTP id B34E722B178C; Wed, 18 Mar 2026 15:25:24 +0100 (CET) X-Virus-Scanned: amavis at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s473.loopia.se (amavis); dkim=pass (2048-bit key) header.d=yesql.se Received: from s899.loopia.se ([172.22.191.6]) by localhost (s473.loopia.se [172.22.190.13]) (amavis, port 10024) with UTF8LMTP id 4RDHuTyCa_q7; Wed, 18 Mar 2026 15:25:24 +0100 (CET) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.236 Received: from smtpclient.apple (customer-89-255-232-236.stosn.net [89.255.232.236]) (Authenticated sender: daniel@yesql.se) by s899.loopia.se (Postfix) with ESMTPSA id E779C2C8BACA; Wed, 18 Mar 2026 15:25:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1773843924; bh=dDBgDLW+uDxaoMpxGg1mDleOz2sZ/QggBrd3kesGIDg=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=X/DjAvIPDb1mCUcxADJvj4ZnNHx0qVUkUFILgBYK+bgkisTq8al4GikMkDR9ebIJ5 PK3YHf+zrrVr+YbkkgpuUjxu3Rk4/0GdMqry4mQPJ1EtlvNwNk13g0n784HuwBupF8 rds/wh+AVwmQxRakw+oH2WkuF4FmhKtE1k3y1wvhUtgONEYla2TnEcL+diLiIc6ujh OVRunVcjV9AfRQhsyzi6z7ynY7fb+NguHAgvAENxYl82M9KXtRPW6c1Lw/2zKRiyfc y/3vtx7L3L9OQ/lr1B6fIwDRe8FwtSXJsQcjw0FPYJyO5S1nB3rw677EkCEUnJtYUZ QnARF+alrGPBg== From: Daniel Gustafsson Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_F9ABFF2E-28A9-4799-905A-12CE46BFEEF4" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.2\)) Subject: Re: Serverside SNI support in libpq Date: Wed, 18 Mar 2026 15:25:13 +0100 In-Reply-To: Cc: Zsolt Parragi , Jelte Fennema-Nio , Heikki Linnakangas , Dewei Dai , "li.evan.chao" , Michael Paquier , Andres Freund , Pgsql Hackers To: Jacob Champion References: <88986722-5A72-4DEC-8750-BDBF67FF8C01@yesql.se> <7E77028B-5A3A-436B-9046-8E9992E9F94A@yesql.se> <0BC5B9B1-6503-4563-AAC6-33DEF264AE3F@yesql.se> <80F4F8F4-8E4F-4B6F-866B-D837057C1192@yesql.se> <0C53C316-C24E-4307-807B-D825CA3F7254@yesql.se> <378D83FA-338C-4EA1-BC60-397BE08D0F01@yesql.se> <2025112617144938459246@163.com> <0217DEFA-9684-4A77-A005-D30EBEF155C4@yesql.se> <5D0E78E0-EA79-480E-ABD3-B1EF0156BF8B@yesql.se> <785C0B88-7068-4576-AF55-251D06CEC112@yesql.se> <01412917-C42E-4238-97E2-707C32940DDD@yesql.se> <1C38F269-E552-4F78-9E88-E91CEDB12F35@yesql.se> <23D19F69-A8DE-4F89-99F6-5FC48762CE4D@yesql.se> <561BF011-1626-43A5-BD82-913E67EEBA8B@yesql.se> X-Mailer: Apple Mail (2.3776.700.51.11.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_F9ABFF2E-28A9-4799-905A-12CE46BFEEF4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 18 Mar 2026, at 14:01, Jacob Champion = wrote: >=20 > On Wed, Mar 18, 2026 at 5:19=E2=80=AFAM Daniel Gustafsson = wrote: >> longfin has so far reported a test failure which I am looking into. >=20 > I took a quick look at culicidae and I think that's just due to the > use of EXEC_BACKEND. Rather than $windows_os the SKIP logic should > probably use something like 001_server's $exec_backend. That's a bit embarrassing, I spent some time investigating passphrase = reloading under EXEC_BACKEND as part of this patchset.. The longfin issue is a bit more odd, I can reproduce it on macOS with = OpenSSL 1.1.1 but nowhere else. Rather than reporting an SSL error for aborted handshake it reports a SYSCALL error. Using SYSCALL error for when the = server close the connection abruptly is documented, but not really this case = where it does so with no error codes at all (which given OpenSSL documentation = doesn't really say much..). The change in the attached diff does fix it for me = but I'm a bit hesitant to apply something like that, I would be more inclined to = the change the expected output in the test. What are your thoughts? -- Daniel Gustafsson --Apple-Mail=_F9ABFF2E-28A9-4799-905A-12CE46BFEEF4 Content-Disposition: attachment; filename=bf_fixes.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="bf_fixes.diff" Content-Transfer-Encoding: 7bit diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c index fbd3c63fb5d..943dd2d6767 100644 --- a/src/interfaces/libpq/fe-secure-openssl.c +++ b/src/interfaces/libpq/fe-secure-openssl.c @@ -1381,6 +1381,8 @@ open_client_SSL(PGconn *conn) else if (r == -1 && save_errno != 0) libpq_append_conn_error(conn, "SSL SYSCALL error: %s", SOCK_STRERROR(save_errno, sebuf, sizeof(sebuf))); + else if (save_errno == 0 && vcode == X509_V_OK && ecode == 0) + libpq_append_conn_error(conn, "SSL error: handshake failure"); else libpq_append_conn_error(conn, "SSL SYSCALL error: EOF detected"); pgtls_close(conn); diff --git a/src/test/ssl/t/004_sni.pl b/src/test/ssl/t/004_sni.pl index 4e06475b125..878e32ff107 100644 --- a/src/test/ssl/t/004_sni.pl +++ b/src/test/ssl/t/004_sni.pl @@ -47,6 +47,9 @@ $ENV{PGHOST} = $node->host; $ENV{PGPORT} = $node->port; $node->start; +my $exec_backend = $node->safe_psql('postgres', 'SHOW debug_exec_backend'); +chomp($exec_backend); + $ssl_server->configure_test_server_for_ssl($node, $SERVERHOSTADDR, $SERVERHOSTCIDR, 'trust'); @@ -320,9 +323,10 @@ unlike( SKIP: { - # Passphrase reloads must be enabled on Windows to succeed even without a - # restart - skip "Passphrase command reload required on Windows", 1 if ($windows_os); + # Passphrase reloads must be enabled on Windows (and EXEC_BACKEND) to + # succeed even without a restart + skip "Passphrase command reload required on Windows", 1 + if ($windows_os || $exec_backend =~ /on/); $node->connect_ok( "$connstr sslrootcert=ssl/root+server_ca.crt sslmode=require host=localhost", --Apple-Mail=_F9ABFF2E-28A9-4799-905A-12CE46BFEEF4--